arXiv:2610.18831cs.CROct 2026

Manuscript Offprint

arXiv:2610.18831

AegisAsync: Symbolic Async-Event Simulation for Risks in Python Asynchronous Programs

Baihong Chen, Wen Li

BAIHONG CHEN, Utah State University, USA

WEN LI, Utah State University, USA

Security and robustness risks in Python async programs depend on event order, object identity, and execution after exceptions or cancellation. Detecting these risks requires connecting related operations across function calls and tracking their effects along execution paths. We present AEGISAsync, a bytecode-based analysis of Python async risks for CPython 3.10–3.14. Its Async Event Transition Graph combines bytecode control flow, resolved calls, async events, and symbolic object relations. Bounded path-local simulation tracks event order and object states and explores cancellation at await suspensions. Six detector plugins evaluate the resulting traces and states to produce candidates with supporting witnesses. On AsyncBench, our benchmark of 180 labeled risks, AEGISAsync detects all labeled risks with zero false positives on each of the five versions. Across five path budgets on 2,500 PyPI package versions, source review confirms 457 of 910 AEGISAsync candidate records (50.2%), representing 457 unique bugs; across three FLAKE8-ASYNC samples, 70 of 2,187 review judgments are confirmed (3.2%). By submission, 166 PoCs reproduce AEGISAsync findings, and we have reported 157 bugs to developers, of which 16 have been confirmed and fixed.

CCS Concepts: • Software and its engineering → Software testing and debugging; • Security and privacy → Software and application security.

Additional Key Words and Phrases: Python async programming, bytecode analysis, static analysis, event-loop security, vulnerability detection

1 Introduction

Python asynchronous programming is widely used in web services, API servers, database clients, and AI-serving systems. These systems use features such as await, task creation, cancellation, and asynchronous resource management to support high concurrency [21, 27, 30]. However, asynchronous execution can also introduce security and robustness risks. Blocking operations can stall the event loop. Unobserved tasks can hide failures. Input-dependent task creation and unbounded queues can exhaust resources. Cancellation can interrupt cleanup or be suppressed unintentionally. External operations without timeouts can remain pending indefinitely [12, 22, 23]. Detecting these risks requires more than identifying individual API calls. Their effects often depend on the order of events, the identities and lifetimes of runtime objects, and how execution proceeds through exceptions and cancellation.

These risks matter across the Python ecosystem. Our three-year PyPI study shows that asynchronous programming is widespread across major Python application domains [18, 19]. Public advisories also document serious async-related failures, including denial-of-service and resource-management errors [8, 15, 17]. Existing tools capture only part of this problem. General Python analyzers reason about security patterns, types, or call relations [2, 14, 26]. Async-aware linters such as FLAKE8-ASYNC [7] detect known risky usage patterns. However, async risks can depend on how events involving the same runtime object unfold over time. Dynamic testing can expose these failures, but depends on suitable inputs and execution conditions [9, 11, 16]. This motivates a static analysis that recovers async-event relations along execution paths and reports candidates with supporting evidence.

Building such an analysis raises four challenges. (C1) Recovering async execution. Source code describes async behavior at a high level, while bytecode shows how the behavior is executed. The challenge is to recover this execution flow while preserving source locations for reporting. (C2)

Authors' Contact Information: Baihong Chen, Utah State University, USA; Wen Li, Utah State University, USA.

Baihong Chen and Wen Li

Tracking async objects. Async risks can depend on how objects are created and used over time. The challenge is to track these objects together with the execution flow. (C3) Tracking event order. Async risks can depend on the order of events along one execution path and on the same object. The challenge is to track these events in the order they occur. (C4) Checking risk conditions. Different async risks depend on different events and object states. The challenge is to check these conditions and keep the evidence for each reported candidate.

To address these challenges, we present AEGISASYNC, a static analysis framework for finding async risks in Python bytecode. For each target package, AEGISASYNC analyzes the bytecode compiled for a fixed CPython version. The analysis begins by constructing an Async Event Transition Graph (AETG), which connects bytecode execution with async operations and symbolic object relations (C1–C2). It then explores selected execution paths over the AETG, tracking event order, object state, and cancellation behavior (C3). Risk-specific detectors evaluate the resulting traces and states to identify candidates and retain the evidence supporting each report (C4).

We evaluate AEGISASYNC in two settings. First, we use AsyncBench, a benchmark we construct with 180 labeled risk instances, to test evidence preservation and detection across CPython 3.10–3.14. AEGISASYNC detects all 180 risks with zero false positives on each version. Second, we analyze 2,500 real-world Python package versions. At the default path budget Np=4096N_p = 4096, AEGISASYNC reports 572 candidates, of which source review confirms 259. Deduplicating reports across all five tested path budgets yields 910 candidates, of which 457 are confirmed (50.2%). In the three risk families covered by both tools, the combined AEGISASYNC results contain 484 candidates, compared with 5,581 diagnostics from FLAKE8-ASYNC on the same packages. Manual review across three baseline samples produces 2,187 judgments, including 70 confirmations (3.2%) covering 33 unique sites. AEGISASYNC reports candidates at all 33 sites. By submission, 166 executable PoCs reproduce the reported runtime behaviors across all six risk families. This paper makes the following contributions:

• An Async Event Transition Graph (AETG) that combines bytecode control flow, async events, and relations among symbolic objects.

  • A path-local symbolic simulation that tracks event order and object states and explores cancellation continuations. Six detector plugins evaluate the resulting traces and states and report candidates with supporting witnesses.

  • A study of 2,500 real-world Python package versions. Source review confirms 457 bugs from 910 candidates across five path budgets, and 166 executable PoCs reproduce the reported bugs.

  • A version-aware implementation of AEGISASYNC for CPython 3.10–3.14, with adapters for version-specific bytecode and a pipeline for compiling and analyzing Python packages.