Skip to content

Commit eeb1432

Browse files
authored
Create 2.1.11.yaml
Signed-off-by: Hamed Salimian <[email protected]>
1 parent 146fb2f commit eeb1432

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

templates/headless/2.1.11.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
id: ASVS-4-0-3-V2-1-11
2+
3+
info:
4+
name: ASVS 2.1.11 Check
5+
author: Hamed Salimian
6+
severity: low
7+
classification:
8+
cwe-id: CWE-521
9+
reference:
10+
- https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/04-Authentication_Testing/07-Testing_for_Weak_Password_Policy.html
11+
- https://snbig.github.io/Vulnerable-Pages/ASVS_2_1_11/
12+
tags: asvs,2.1.11
13+
description: |
14+
Verify that "paste" functionality, browser password helpers, and external password managers are permitted.
15+
Run with `-show-browser` switch.
16+
17+
variables:
18+
password_field_name: "password"
19+
20+
headless:
21+
- steps:
22+
- args:
23+
url: "{{BaseURL}}"
24+
action: navigate
25+
26+
- action: waitload
27+
28+
- action: script
29+
name: anyFieldsFunctional
30+
args:
31+
code: |
32+
() => {
33+
return (function verifyPasteFunction(testValue = "{{rand_text_alphanumeric(16)}}") {
34+
const passwordFields = document.querySelectorAll('input[name="{{password_field_name}}"]');
35+
36+
if (passwordFields.length === 0) {
37+
return false; // No password fields found
38+
}
39+
40+
let isAnyPasteFunctional = false; // Flag to track if any field is functional
41+
42+
passwordFields.forEach((field) => {
43+
// Verify paste functionality
44+
field.value = ""; // Clear the field
45+
46+
// Simulate paste by directly setting the value
47+
field.focus();
48+
document.execCommand("insertText", false, testValue); // Programmatic paste
49+
50+
const pastedValue = field.value;
51+
if (pastedValue === testValue) {
52+
isAnyPasteFunctional = true; // Set the flag to true if paste works
53+
}
54+
});
55+
56+
// Return true if any field was functional, otherwise false
57+
return isAnyPasteFunctional;
58+
})();
59+
}
60+
61+
matchers:
62+
- type: dsl
63+
dsl:
64+
- anyFieldsFunctional == "true"

0 commit comments

Comments
 (0)