Skip to content

Commit e52b06f

Browse files
authored
Create 3.3.5.yaml
Signed-off-by: AmirHossein Raeisi <[email protected]>
1 parent e215fc9 commit e52b06f

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

templates/code/3.3.5.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
id: ASVS-5-0-0-V3-3-5
2+
3+
info:
4+
name: ASVS 3.3.5 Check
5+
author: AmirHossein Raeisi
6+
severity: info
7+
classification:
8+
cwe-id: CWE-613
9+
reference:
10+
- https://en.wikipedia.org/wiki/HTTP_cookie
11+
tags: asvs,3.3.5
12+
description: |
13+
Verify that when the application writes a cookie, the cookie name and value length combined are not over 4096 bytes. Overly large cookies will not be stored by the browser and therefore not sent with requests, preventing the user from using application functionality which relies on that cookie.
14+
15+
flow: |
16+
http()
17+
javascript()
18+
19+
http:
20+
- method: GET
21+
path:
22+
- "{{BaseURL}}"
23+
host-redirects: true
24+
max-redirects: 2
25+
26+
javascript:
27+
- code: |
28+
content = template.http_all_headers;
29+
const setCookieLines = content
30+
.split(/\r\n/)
31+
.filter(line => line.trim().toLowerCase().startsWith('set-cookie:'));
32+
33+
const cookieDetails = setCookieLines
34+
.map(line => {
35+
const match = line.match(/set-cookie:\s*([^=]+)=([^;]+)/i);
36+
if (match) {
37+
const cookieName = match[1];
38+
const cookieValue = match[2];
39+
const cookieString = `${cookieName}=${cookieValue}`;
40+
if (cookieString.length > 4096) {
41+
return cookieName;
42+
}
43+
}
44+
})
45+
.filter(Boolean);
46+
47+
cookieDetails;
48+
49+
extractors:
50+
- type: regex
51+
regex:
52+
- '[a-zA-Z0-9_-]+'

0 commit comments

Comments
 (0)