Near space has been paid more and more attentionin recent years due to its military application value. However, flow characteristics of some fundamental configurations (e.g., the cavity) in near space have rarely been investigated due to rarefied gas effects, which make the numerical simulation methods based on continuous flow hypothesis lose validity. In this work, the direct simulation Monte Carlo (DSMC), one of the most successful particle simulation methods in treating rarefied gas dynamics, is employed to explore flow characteristics of a hypersonic cavity with sweepback angle in near space by considering a variety of cases, such as the cavity at a wide range of altitudes 20–60 km, the cavity at freestream Mach numbers of 6–20, and the cavity with a sweepback angle of 30°–90°. By analyzing the simulation results, flow characteristics are obtained and meanwhile some interesting phenomena are also found. The primary recirculation region, which occupies the most area of the cavity, causes pressure and temperature stratification due to rotational motion of fluid inside it, whereas the pressure and temperature in the secondary recirculation region, which is a small vortex and locates at the lower left corner of the cavity, change slightly due to low-speed movement of fluid inside it. With the increase of altitude, both the primary and secondary recirculation regions contract greatly and it causes them to separate. A notable finding is that rotation direction of the secondary recirculation region would be reversed at a higher altitude. The overall effect of increasing the Mach number is that the velocity, pressure, and temperature within the cavity increase uniformly. The maximum pressure nearby the trailing edge of the cavity decreases rapidly as the sweepback angle increases, whereas the influence of sweepback angle on velocity distribution and maximum temperature within the cavity is slight.