GHSA-jmr4-p576-v565: listmonk Vulnerable to Stored XSS Leading to Admin Account Takeover
Security Advisory: Stored XSS Leading to Admin Account Takeover**Affected Versions:** ≤ 5.1.0  
**Vulnerability Type:** CWE-79: Stored Cross-Site ScriptingSummaryA lower-privileged user with campaign management permissions can inject malicious JavaScript into campaigns or templates. When a higher-privileged user (Super Admin) views or previews this content, the XSS executes in their browser context, allowing the attacker to perform privileged actions such as creating backdoor admin accounts.The attack can be weaponized via the **public archive feature**, where victims simply need to visit a link - no preview click required.Required Attacker Permissions**Note:** These are common permissions for content managers who are not full admins.Attack VectorsVector 1: Raw HTML (Direct Script Tag)Vector 2: Go Template `Safe` FunctionAttack ScenariosScenario 1: Campaign Preview AttackAttacker creates campaign with XSS payloadRequest is made to super admin: *"Please review my newsletter draft"*Super admin opens campaign and clicks **Preview**XSS executes → Backdoor admin account createdAttacker logs in with `backdoor` / `Hacked123`Scenario 2: Archive Link Attack (No Click Required)Attacker creates campaign with XSS payloadAttacker enables **Archive** for the campaignAttacker shares archive link: `http://localhost:9000/archive/{uuid}`Super admin visits the link (no preview click needed!)XSS executes automatically → Account takeoverProof of ConceptStep 1: Create Malicious CampaignAs lower-privileged user, create campaign with body:Step 2: Enable Archive (Optional - for link-based attack)Edit campaign settingsEnable "Archive"Copy archive URL: `http://localhost:9000/archive/{campaign-uuid}`Step 3: Trigger Execution**Option A - Preview:**Send campaign to super admin for "review"Super admin previews → XSS fires**Option B - Archive Link:**Share archive URL with super adminSuper admin visits link → XSS fires automaticallyStep 4: Verify TakeoverEvidence Screenshots**[Screenshot 1: Lower-privileged user creating malicious campaign]**
<img width="1892" height="781" alt="Screenshot 2025-12-27 170259" src="https://github.com/user-attachments/assets/b9af26bf-0c5b-4667-ba9a-eea774156d0b" />**[Screenshot 2: Super admin previewing campaign]**
<img width="1686" height="709" alt="image" src="https://github.com/user-attachments/assets/4ca3d5ff-0cd9-4f22-bca0-e26e13c6b1c7" />**[Screenshot 3: Backdoor user successfully created]**
<img width="1370" height="469" alt="Screenshot 2025-12-27 170413" src="https://github.com/user-attachments/assets/18135128-f5af-4023-9aa7-8662a1405ed2" />Impact| Action | Possible via XSS |
|--------|-----------------|
| Create backdoor admin | ✅ Yes |
| Export all subscribers | ✅ Yes |
| Modify SMTP settings | ✅ Yes |
| Delete all campaigns | ✅ Yes |
| Access API keys/secrets | ✅ Yes |Affected Components| Component | XSS Works? | Method |
|-----------|-----------|--------|
| Campaign body (Raw HTML) | ✅ Yes | Direct `<script>` tag |
| Campaign body (Template) | ✅ Yes | `{{ \` \` \| Safe }}` |
| Template body | ✅ Yes | Both methods |
| Campaign archive | ✅ Yes | Automatic execution on visit |
CVSS v4.0: 5.4