Skip to content

Commit 7ca5f36

Browse files
reject ipv4 strings with an octet with a leading zero
Ensuring implementations reject these values will help guard against this security vulnerability. see https://sick.codes/universal-netmask-npm-package-used-by-270000-projects-vulnerable-to-octal-input-data-server-side-request-forgery-remote-file-inclusion-local-file-inclusion-and-more-cve-2021-28918/
1 parent 8e1e1c1 commit 7ca5f36

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed

tests/draft2019-09/optional/format/ipv4.json

+11
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@
3232
"description": "an IP address as an integer (decimal)",
3333
"data": "2130706433",
3434
"valid": false
35+
},
36+
{
37+
"description": "leading zeroes should be rejected, as they are treated as octals",
38+
"comment": "see https://sick.codes/universal-netmask-npm-package-used-by-270000-projects-vulnerable-to-octal-input-data-server-side-request-forgery-remote-file-inclusion-local-file-inclusion-and-more-cve-2021-28918/",
39+
"data": "087.10.0.1",
40+
"valid": false
41+
},
42+
{
43+
"description": "value without leading zero is valid",
44+
"data": "87.10.0.1",
45+
"valid": true
3546
}
3647
]
3748
}

tests/draft2020-12/optional/format/ipv4.json

+11
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@
3232
"description": "an IP address as an integer (decimal)",
3333
"data": "2130706433",
3434
"valid": false
35+
},
36+
{
37+
"description": "leading zeroes should be rejected, as they are treated as octals",
38+
"comment": "see https://sick.codes/universal-netmask-npm-package-used-by-270000-projects-vulnerable-to-octal-input-data-server-side-request-forgery-remote-file-inclusion-local-file-inclusion-and-more-cve-2021-28918/",
39+
"data": "087.10.0.1",
40+
"valid": false
41+
},
42+
{
43+
"description": "value without leading zero is valid",
44+
"data": "87.10.0.1",
45+
"valid": true
3546
}
3647
]
3748
}

tests/draft4/optional/format/ipv4.json

+11
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@
3232
"description": "an IP address as an integer (decimal)",
3333
"data": "2130706433",
3434
"valid": false
35+
},
36+
{
37+
"description": "leading zeroes should be rejected, as they are treated as octals",
38+
"comment": "see https://sick.codes/universal-netmask-npm-package-used-by-270000-projects-vulnerable-to-octal-input-data-server-side-request-forgery-remote-file-inclusion-local-file-inclusion-and-more-cve-2021-28918/",
39+
"data": "087.10.0.1",
40+
"valid": false
41+
},
42+
{
43+
"description": "value without leading zero is valid",
44+
"data": "87.10.0.1",
45+
"valid": true
3546
}
3647
]
3748
}

tests/draft6/optional/format/ipv4.json

+11
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@
3232
"description": "an IP address as an integer (decimal)",
3333
"data": "2130706433",
3434
"valid": false
35+
},
36+
{
37+
"description": "leading zeroes should be rejected, as they are treated as octals",
38+
"comment": "see https://sick.codes/universal-netmask-npm-package-used-by-270000-projects-vulnerable-to-octal-input-data-server-side-request-forgery-remote-file-inclusion-local-file-inclusion-and-more-cve-2021-28918/",
39+
"data": "087.10.0.1",
40+
"valid": false
41+
},
42+
{
43+
"description": "value without leading zero is valid",
44+
"data": "87.10.0.1",
45+
"valid": true
3546
}
3647
]
3748
}

tests/draft7/optional/format/ipv4.json

+11
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@
3232
"description": "an IP address as an integer (decimal)",
3333
"data": "2130706433",
3434
"valid": false
35+
},
36+
{
37+
"description": "leading zeroes should be rejected, as they are treated as octals",
38+
"comment": "see https://sick.codes/universal-netmask-npm-package-used-by-270000-projects-vulnerable-to-octal-input-data-server-side-request-forgery-remote-file-inclusion-local-file-inclusion-and-more-cve-2021-28918/",
39+
"data": "087.10.0.1",
40+
"valid": false
41+
},
42+
{
43+
"description": "value without leading zero is valid",
44+
"data": "87.10.0.1",
45+
"valid": true
3546
}
3647
]
3748
}

0 commit comments

Comments
 (0)