Client-Side Vulnerabilities
Client-side vulnerabilities target user browsers and can lead to session hijacking, data theft, and malicious actions performed on behalf of users.Cross-Site Scripting (XSS)
Types of XSS
| Type | Storage | Delivery | Risk |
|---|---|---|---|
| Reflected | None | URL/Request | High |
| Stored | Database | Page content | Critical |
| DOM-based | None | Client-side | High |
Reflected XSS
Occurs when user input is immediately reflected in the response.Stored XSS
Malicious script stored and served to other users.DOM-based XSS
Vulnerability exists entirely in client-side code.XSS Context Analysis
AIPTx identifies XSS context for accurate payloads:| Context | Example | Payload |
|---|---|---|
| HTML body | <div>USER_INPUT</div> | <script>alert(1)</script> |
| HTML attribute | <input value="USER_INPUT"> | " onfocus=alert(1) autofocus=" |
| JavaScript string | var x = "USER_INPUT"; | ";alert(1)// |
| URL parameter | <a href="USER_INPUT"> | javascript:alert(1) |
| CSS | <style>USER_INPUT</style> | </style><script>alert(1)</script> |
Cross-Site Request Forgery (CSRF)
CSRF Testing
AIPTx tests state-changing operations for CSRF protection:CSRF Protection Analysis
| Protection | Check | Status |
|---|---|---|
| CSRF Token | Token present and validated | ✅/❌ |
| SameSite Cookie | Cookie has SameSite attribute | ✅/❌ |
| Origin Header | Origin header validated | ✅/❌ |
| Referer Check | Referer header validated | ✅/❌ |
Clickjacking
Testing Methodology
AIPTx checks for:- Missing
X-Frame-Optionsheader - Missing
Content-Security-Policyframe-ancestors - Frameable sensitive pages
Example Finding
Content Security Policy
CSP Analysis
AIPTx evaluates CSP headers for weaknesses:| Directive | Finding | Risk |
|---|---|---|
script-src | 'unsafe-inline' | XSS possible |
script-src | 'unsafe-eval' | Code injection |
default-src | * | All sources allowed |
| Missing CSP | No header | No protection |
Example Finding
Open Redirects
Testing
Bypass Techniques Tested
WebSocket Security
Testing Areas
- Authentication on WebSocket connections
- Message validation
- Cross-origin WebSocket requests
PostMessage Vulnerabilities
Testing Scenarios
Example Finding
Client-Side Storage
Testing Areas
| Storage | Test | Risk |
|---|---|---|
| localStorage | Sensitive data stored | Data theft via XSS |
| sessionStorage | Tokens stored | Session hijacking |
| Cookies | Missing flags | Cookie theft |
| IndexedDB | Unencrypted PII | Data exposure |
Example Finding
Remediation Guidelines
XSS Prevention
XSS Prevention
CSRF Protection
CSRF Protection
Security Headers
Security Headers