<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->

---
id: xss-f209d56b
title: Detecting Cross-Site Scripting
description: >
  Detect and analyze XSS vulnerabilities in web applications
  using automated analysis and remediation techniques.
mode: RED
tags:
  - browser-security
  - xss
  - injection
  - web-application
metadata:
  mitre-attack: ["T1189", "T1059.007"]
---

# Detecting Cross-Site Scripting

> **`[MODE: RED]`** — Detect and analyze XSS vulnerabilities in web applications.

## Quick Reference

```bash
# Run the detecting-cross-site-scripting agent
node scripts/agent.js --target <TARGET> --mode scan

# Generate a report
node scripts/agent.js --target <TARGET> --mode report --output report.json

# Analyze with verbose output
node scripts/agent.js --target <TARGET> --mode analyze --verbose
```

## Overview

Detecting Cross-Site Scripting is a critical browser security technique that addresses
common security risks in modern environments. This skill provides automated
tooling and structured methodology for practitioners to detect and analyze xss vulnerabilities in web applications.

### Key Concepts

- **Identification**: Detect relevant indicators and patterns
- **Analysis**: Evaluate severity and business impact
- **Remediation**: Apply targeted fixes with verification
- **Monitoring**: Establish ongoing detection coverage

## Workflow

### Phase 1 — Discovery

Enumerate the target environment and identify the attack surface
relevant to detecting cross site scripting.

```bash
node scripts/agent.js --target <TARGET> --mode scan --phase discovery
```

**Expected output**: JSON inventory of identified targets and initial findings.

### Phase 2 — Analysis

Perform deep analysis of discovered items to determine risk level
and exploitability.

```bash
node scripts/agent.js --target <TARGET> --mode analyze --phase analysis
```

**Expected output**: Categorized findings with severity ratings.

### Phase 3 — Remediation

Apply recommended fixes and generate compliance evidence.

```bash
node scripts/agent.js --target <TARGET> --mode report --phase remediation
```

**Expected output**: Remediation report with before/after comparison.

## Verification

### Automated Verification

```bash
# Verify remediation was applied correctly
node scripts/agent.js --target <TARGET> --mode scan --verify

# Run regression check
node scripts/agent.js --target <TARGET> --mode analyze --regression
```

### Manual Verification Checklist

- [ ] All identified issues have been addressed
- [ ] Remediation does not break functionality
- [ ] Detection rules are deployed and tested
- [ ] Documentation is updated with findings
- [ ] Stakeholders have been notified of changes

### Validation Criteria

| Check | Expected Result | Tool |
|-------|----------------|------|
| Configuration audit | No critical findings | `agent.js --mode scan` |
| Regression test | All tests pass | `agent.js --verify` |
| Detection coverage | Rules firing on test data | SIEM validation |

## Detection Opportunities

When operating in RED mode, consider these detection angles:

- Monitor for configuration changes related to detecting cross site scripting
- Alert on anomalous patterns that indicate exploitation attempts
- Correlate findings with threat intelligence feeds
- Baseline normal behavior to identify deviations

```yaml
title: Cross Site Scripting Detection
id: a02c42ea-dc46-482d-8981-afe8294df612
status: experimental
description: Detects suspicious activity related to detecting cross site scripting techniques in browser security context
logsource:
  category: proxy
  product: windows
detection:
  selection:
    cs_uri_query: "*script*"
  condition: selection
level: medium
tags:
  - attack.t1189
  - attack.t1059.007
  - attack.initial_access
falsepositives:
  - Browser security extensions performing routine URL reputation checks
```

## References

- [MITRE ATT&CK](https://attack.mitre.org/) — Technique mapping
- [CIS Benchmarks](https://www.cisecurity.org/cis-benchmarks) — Hardening standards
- [NIST SP 800-53](https://csrc.nist.gov/publications/detail/sp/800-53/rev-5/final) — Security controls
- [OWASP](https://owasp.org/) — Web application security guidance
- See also: `references/api-reference.md` for API documentation
