File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ id : ASVS-4-0-3-V3-4-1
2+
3+ info :
4+ name : ASVS 3.4.1 Check
5+ author : AmirHossein Raeisi
6+ severity : info
7+ classification :
8+ cwe-id : CWE-614
9+ reference :
10+ - https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/06-Session_Management_Testing/02-Testing_for_Cookies_Attributes
11+ - https://vulnerable-pages.onrender.com/set-cookie
12+ - https://github.com/projectdiscovery/nuclei-templates/blob/main/http/misconfiguration/cookies-without-secure.yaml
13+ tags : asvs,3.4.1
14+ description : |
15+ Verify that cookie-based session tokens have the 'Secure' attribute set.
16+
17+ flow : |
18+ http()
19+ javascript()
20+
21+ http :
22+ - method : GET
23+ path :
24+ - " {{BaseURL}}"
25+ host-redirects : true
26+ max-redirects : 2
27+
28+ javascript :
29+ - code : |
30+ content = template.http_all_headers
31+ const setCookieLines = content
32+ .split(/\r\n/)
33+ .filter(line => line.trim().toLowerCase().startsWith('set-cookie:'));
34+ const nonSecureCookies = setCookieLines.filter(line => !line.toLowerCase().includes('secure'));
35+ const cookieNames = nonSecureCookies.map(line => {
36+ const match = line.match(/set-cookie:\s*([^=]+)=/i);
37+ return match ? match[1] : null;
38+ }).filter(Boolean).filter(cookieName => cookieName.toLowerCase().includes('session')); // Check for 'session' in the cookie name
39+ cookieNames
40+
41+ extractors:
42+ - type: regex
43+ regex:
44+ - '[a-zA-Z0-9_-]+'
You can’t perform that action at this time.
0 commit comments