<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
---
name: analyzing-service-worker-security
description: >-
  Analyze Service Worker security risks including scope hijacking, cache poisoning, persistent XSS via SW registration, and man-in-the-browser attacks through intercepted fetch events.
domain: cybersecurity
subdomain: browser-security
tags:
  - service-worker
  - cache-poisoning
  - sw-scope
  - persistence
version: "1.0"
author: defconxt
license: AGPL-3.0
metadata:
  mitre-attack: ["T1189"]
  frameworks: ["MITRE ATT&CK", "OWASP"]
  tools: ["devtools", "burpsuite", "zap"]
---

# Analyzing Service Worker Security

## Overview

Analyze Service Worker security risks including scope hijacking, cache poisoning, persistent XSS via SW registration, and man-in-the-browser attacks through intercepted fetch events.

## Prerequisites

| Tool / Requirement | Details |
|---|---|
| `devtools` | Security tooling |
| `burpsuite` | Security tooling |
| `zap` | Security tooling |
| Browser DevTools, Burp Suite, target web application with Service Workers | Environment requirement |

## Quick Reference

```bash
# Quick start commands
node scripts/agent.js --help
# DevTools > Application > Service Workers
```

## Workflow

### Step 1: Enumerate Service Workers

```bash
# DevTools > Application > Service Workers
node scripts/agent.js enumerate --url https://target.com
```

### Step 2: Analyze SW Scope

```bash
node scripts/agent.js analyze --url https://target.com --check scope
```

### Step 3: Test Cache Poisoning

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

## Detection

```yaml
title: Service Worker Security Detection
id: 24bbaae6-35da-4612-b363-68d426c51b3d
status: experimental
description: Detects suspicious activity related to analyzing service worker security techniques in browser security context
logsource:
  category: proxy
  product: windows
detection:
  selection:
    cs_uri_query: "*script*"
  condition: selection
level: medium
tags:
  - attack.t1189
  - attack.initial_access
falsepositives:
  - Browser security extensions performing routine URL reputation checks
```


**Detection Opportunities**

| Indicator | Source | Detection Logic |
|---|---|---|
| Service Worker Security Detection | windows/proxy | Sigma rule (medium) |
| ATT&CK Coverage | MITRE ATT&CK | T1189 |

## Verification

- **Verify SW enumeration**: `node scripts/agent.js enumerate --url https://target.com`
- **Confirm findings**: `node scripts/agent.js report --url https://target.com`

## References

- MITRE ATT&CK: T1189
- Frameworks: MITRE ATT&CK, OWASP
- Tools: devtools, burpsuite, zap
