@profullstack/threatcrush 0.13.63 → 0.13.64

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.
package/dist/daemon.js CHANGED
@@ -16017,12 +16017,19 @@ async function runScan(targetPath) {
16017
16017
  }
16018
16018
 
16019
16019
  // src/commands/pentest.ts
16020
+ function decodeMarkupForXssDetection(html) {
16021
+ return html.replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&#39;|&apos;/gi, "'").replace(/&#x([0-9a-f]+);?/gi, (_, hex) => String.fromCodePoint(parseInt(hex, 16))).replace(/&#([0-9]+);?/g, (_, dec) => String.fromCodePoint(parseInt(dec, 10)));
16022
+ }
16023
+ function containsXssPayload(html) {
16024
+ const candidate = decodeMarkupForXssDetection(html);
16025
+ return /<script\b[^>]*>[\s\S]*?\b(?:alert|confirm|prompt)\s*\(/i.test(candidate) || /<[a-z][^>]*\bon(?:error|load|mouseover|focus)\s*=\s*[^>]*(?:alert|confirm|prompt)\s*\(/i.test(candidate);
16026
+ }
16020
16027
  var PENTEST_CHECKS = [
16021
16028
  {
16022
- name: "XSS Reflected",
16023
- test: (html) => /<script>alert\(1\)<\/script>|<img\s+src=x\s+onerror=alert/i.test(html),
16024
- severity: "critical",
16025
- message: "Reflected XSS payload rendered in response"
16029
+ name: "XSS Payload in Response",
16030
+ test: (html) => containsXssPayload(html),
16031
+ severity: "high",
16032
+ message: "Response contains an executable-looking XSS payload (raw or HTML-escaped)"
16026
16033
  },
16027
16034
  {
16028
16035
  name: "Open Redirect",