<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
---
name: detecting-css-injection-attacks
description: >-
  Detect CSS injection attacks including data exfiltration via CSS selectors, keylogging through font-face timing, and UI redressing via injected stylesheets.
domain: cybersecurity
subdomain: browser-security
tags:
  - css-injection
  - data-exfiltration
  - style-injection
  - ui-redress
version: "1.0"
author: defconxt
license: AGPL-3.0
metadata:
  mitre-attack: ["T1059.007"]
  frameworks: ["MITRE ATT&CK", "OWASP"]
  tools: ["burpsuite", "semgrep", "devtools"]
---

# Detecting Css Injection Attacks

## Overview

Detect CSS injection attacks including data exfiltration via CSS selectors, keylogging through font-face timing, and UI redressing via injected stylesheets.

## Prerequisites

| Tool / Requirement | Details |
|---|---|
| `burpsuite` | Security tooling |
| `semgrep` | Security tooling |
| `devtools` | Security tooling |
| Burp Suite, semgrep, understanding of CSS selector abuse techniques | Environment requirement |

## Quick Reference

```bash
# Quick start commands
node scripts/agent.js --help
semgrep --config p/css-injection ./src
```

## Workflow

### Step 1: Find CSS Injection Points

```bash
semgrep --config p/css-injection ./src
```

### Step 2: Test Data Exfiltration

```bash
node scripts/agent.js test --url https://target.com --vector attribute-selector
```

### Step 3: Verify Style Injection

```bash
node scripts/agent.js verify --url https://target.com
```

## Detection

```yaml
title: Css Injection Attacks Detection
id: ba223c6c-53ab-4a81-8cc6-bab2121e15c8
status: experimental
description: Detects suspicious activity related to detecting css injection attacks techniques in browser security context
logsource:
  category: proxy
  product: windows
detection:
  selection:
    cs_uri_query: "*script*"
  condition: selection
level: medium
tags:
  - attack.t1059.007
  - attack.initial_access
falsepositives:
  - Browser security extensions performing routine URL reputation checks
```


**Detection Opportunities**

| Indicator | Source | Detection Logic |
|---|---|---|
| Css Injection Attacks Detection | windows/proxy | Sigma rule (medium) |
| ATT&CK Coverage | MITRE ATT&CK | T1059.007 |

## Verification

- **Verify injection points**: `node scripts/agent.js scan --url https://target.com`
- **Confirm exfiltration**: `node scripts/agent.js test --url https://target.com --vector attribute-selector`

## References

- MITRE ATT&CK: T1059.007
- Frameworks: MITRE ATT&CK, OWASP
- Tools: burpsuite, semgrep, devtools
