Cross-Layer Semantic Flow Reconstruction for Attack Detection in Agentic Systems
Organizations: Department of Software Technology, Zhejiang University, Ningbo, China · Department of Computer Science and Technology, Zhejiang University, Hangzhou, China
Abstract
Agentic systems increasingly orchestrate complex, tool-using workflows within agentic execution environments, where high-level goals and tool invocations at the application layer materialize as process, file, and network activities at the operating-system layer. This cross-layer execution creates security risks that conventional input guardrails cannot capture, because malicious intent may become observable only through downstream execution effects. In multi-agent deployments, inter-agent communication and delegation introduce additional propagation paths. To address this gap, we propose AScope, an execution-aware framework that correlates application-level agent semantics with kernel-level audit events and reconstructs them as cross-layer semantic flows. AScope connects fragmented operations into causal behavioral trajectories and uses a supervisor LLM to identify data flow violations, control flow deviations, and intent inconsistencies. We evaluate AScope on published AgentDojo traces with application-layer evidence and on ten multi-agent scenarios with cross-layer telemetry. The results demonstrate strong detection sensitivity across both evidence settings and achieve node- and path-level F1-scores of 85.3% and 66.7% on the cross-layer dataset.
Figures & tables
| Subject | Object | Relationship |
| Agent | Agent | Agent_Invoke; Agent_Resp |
| Process | Process_Start; Process_End | |
| Process | Process | Process_Start; Process_End |
| File | File_Read; File_Write | |
| Network | IP_Send; IP_Receive |
| Policy | Violation Condition |
| Intent Consistency | |
| Data Confidentiality | |
| Control Flow Integrity |
| Attack Type | Gemini-3.6 Flash Baseline | Gemini-3.6 Flash HSEC | GPT-5.6 Sol Baseline | GPT-5.6 Sol HSEC | ||||||||
| Pre. | Rec. | F1 | Pre. | Rec. | F1 | Pre. | Rec. | F1 | Pre. | Rec. | F1 | |
| ① Agent Goal Hijack | 36.4 | 66.7 | 47.1 | 50.0 | 33.3 | 40.0 | 38.5 | 83.3 | 52.6 | 66.7 | 33.3 | 44.4 |
| ② Tool Misuse & Exploitation | 69.2 | 75.0 | 72.0 | 100.0 | 58.3 | 73.7 | 63.2 | 100.0 | 77.4 | 100.0 | 66.7 | 80.0 |
| ③ Identity & Privilege Abuse | 3.4 | 33.3 | 6.2 | 20.0 | 33.3 | 25.0 | 7.4 | 66.7 | 13.3 | 11.1 | 33.3 | 16.7 |
| ④ Agentic Supply Chain Vulnerabilities | 50.0 | 66.7 | 57.1 | 100.0 | 50.0 | 66.7 | 26.3 | 83.3 | 40.0 | 100.0 | 50.0 | 66.7 |
| ⑤ Unexpected Code Execution | 37.5 | 75.0 | 50.0 | 16.7 | 25.0 | 20.0 | 25.0 | 75.0 | 37.5 | 25.0 | 50.0 | 33.3 |
| Model | Precision | Recall | F1 |
| Gemini-3.6 Flash | 72.5 (+29.9) | 54.4 (-17.7) | 62.2 (+8.6) |
| GPT-5.6 Sol | 62.5 (+27.8) | 58.8 (-26.5) | 60.6 (+11.2) |
| DeepSeek V4 Pro | 71.4 (+34.4) | 36.8 (-2.9) | 48.5 (+10.2) |
| Qwen3.7 Max | 60.3 (+23.9) | 51.5 (-5.9) | 55.6 (+11.0) |
| Suite | Method | N | TP | FP | FN | TN | Precision | Recall | F1 | FPR |
| Banking | AlignmentCheck | 160 | 89 | 5 | 1 | 65 | 94.7 | 98.9 | 96.7 | 7.1 |
| AScope | 160 | 89 | 14 | 1 | 56 | 86.4 | 98.9 | 92.2 | 20.0 | |
| Slack | AlignmentCheck | 126 | 97 | 2 | 0 | 27 | 98.0 | 100.0 | 99.0 | 6.9 |
| AScope | 126 | 97 | 18 | 0 | 11 | 84.3 | 100.0 | 91.5 | 62.1 | |
| Travel | AlignmentCheck | 159 | 12 | 10 | 3 | 134 | 54.5 | 80.0 | 64.9 | 6.9 |
| AScope | 159 | 12 | 28 | 3 | 116 | 30.0 | 80.0 | 43.6 | 19.4 |
| Case | Path level | Node level | ||||||
| GT | TP | FP | FN | GT | TP | FP | FN | |
| C1 (①+②+⑧) | 2 | 1 | 0 | 1 | 7 | 5 | 0 | 2 |
| C2 (①+②+⑧) | 4 | 3 | 0 | 1 | 9 | 7 | 0 | 2 |
| C3 (②+③+⑧) | 1 | 1 | 0 | 0 | 5 | 5 | 0 | 0 |
| C4 (②+④+⑧) | 2 | 1 | 1 | 1 | 7 | 5 | 0 | 2 |
| C5 (⑤) | 3 | 1 | 0 | 2 | 9 | 5 | 0 | 4 |
| Method | Precision | Recall | F1 |
| AScope | 96.5 | 76.4 | 85.3 |
| Vanilla GPT | 23.1 | 20.8 | 21.9 |
| Qwen3Guard | 43.1 | 30.6 | 35.8 |
| G-SafeGuard | 6.5 | 19.1 | 9.5 |
| Variant | Precision | Recall | F1 |
| Few-shot prompt | 17.2 | 56.3 | 24.9 |
| w/o graph construction | 23.1 | 20.8 | 21.9 |
| w/o Semantic Extraction | 55.9 | 70.9 | 62.0 |
| w/o Trajectory Analysis | 90.9 | 72.0 | 78.3 |
| AScope | 96.5 | 76.4 | 85.3 |
| Metric | Gemini-3.6 Flash | GPT-5.6 Sol | DeepSeek V4 Pro | Qwen3.7 Max |
| Graph time (ms) | 15.84 | 15.52 | 18.04 | 16.01 |
| Extraction time (s) | 56.26 | 38.17 | 75.34 | 152.15 |
| Extraction tokens (k) | 11.59 | 6.92 | 9.09 | 13.23 |
| Analysis time (s) | 11.14 | 13.70 | 46.17 | 45.22 |
| Analysis tokens (k) | 2.07 | 2.51 | 4.05 | 4.30 |
| Total time (s) | 67.41 | 51.89 | 121.53 | 197.38 |
Appendix figures & tables15 assets
Supplementary material from the paper’s appendix.
Appendix
| Category ( ) | Subcategory ( ) | Samples | Avg. risk |
| Credential & Secrets | Key | 82 | 0.93 |
| Credential & Secrets | Password | 56 | 0.96 |
| Identity & Privacy | Contact Info | 64 | 0.68 |
| System & Infrastructure | Network Config | 43 | 0.57 |
| Relation type | Samples | Avg. risk |
| Agent_Invoke ; Agent_Resp | 120 | 0.31 |
| Process_Start ; Process_End | 115 | 0.57 |
| File_Read ; File_Write | 111 | 0.79 |
| IP_Send ; IP_Receive | 111 | 0.78 |
| Precision | Recall | F1 | |
| 0.4 | 0.70 | 1.00 | 0.82 |
| 0.5 | 0.77 | 1.00 | 0.87 |
| 0.6 | 0.77 | 1.00 | 0.87 |
| 0.7 | 0.78 | 1.00 | 0.88 |
| 0.8 | 0.60 | 0.42 | 0.50 |
| 0.9 | 0.60 | 0.42 | 0.50 |
AI Agent Security
Artificial intelligence agent security studies attacks and safeguards for tool-using, persistent, and collaborative systems across digital and physical settings.
See all 508 papers