Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IAST evidence redaction #3160

Merged
merged 2 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class SensitiveHandler {
if (entry.start === i) {
nextSensitive = entry
} else {
sensitive.push(entry)
sensitive.unshift(entry)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,61 @@
]
}
},
{
"type": "VULNERABILITIES",
"description": "Query with string literal $1",
"parameters": {
"$1": [
"john",
"username with 🌉 surrogate"
]
},
"input": [
{
"type": "SQL_INJECTION",
"evidence": {
"dialect": "MYSQL",
"value": "select * from users where username = \"$1\" and last_name = 'another surrogate 😃'",
"ranges": [
{
"start": 14,
"end": 19,
"iinfo": {
"type": "http.request.parameter",
"parameterName": "table",
"parameterValue": "users"
}
}
]
}
}
],
"expected": {
"sources": [
{
"origin": "http.request.parameter",
"name": "table",
"value": "users"
}
],
"vulnerabilities": [
{
"type": "SQL_INJECTION",
"evidence": {
"valueParts": [
{ "value": "select * from " },
{ "source": 0, "value": "users" },
{ "value": " where username = \"" },
{ "redacted": true },
{ "value": "\" and last_name = '" },
{ "redacted": true },
{ "value": "'" }
]
}
}
]
}
},
{
"type": "VULNERABILITIES",
"description": "POSTGRES Query with escaped string literal",
Expand Down Expand Up @@ -929,6 +984,53 @@
]
}
},
{
"type": "VULNERABILITIES",
"description": "Query with string literal containing tainted range",
"input": [
{
"type": "SQL_INJECTION",
"evidence": {
"dialect": "POSTGRES",
"value": "select * from users where username = 'john:doe:ADMIN'",
"ranges": [
{
"start": 43,
"end": 46,
"iinfo": {
"type": "http.request.parameter",
"parameterName": "last_name",
"parameterValue": "doe"
}
}
]
}
}
],
"expected": {
"sources": [
{
"origin": "http.request.parameter",
"name": "last_name",
"redacted": true
}
],
"vulnerabilities": [
{
"type": "SQL_INJECTION",
"evidence": {
"valueParts": [
{ "value": "select * from users where username = '" },
{ "redacted": true },
{ "source": 0, "redacted": true },
{ "redacted": true },
{ "value": "'" }
]
}
}
]
}
},
{
"type": "VULNERABILITIES",
"description": "Query with string literal and tainted range crossing boundaries",
Expand Down Expand Up @@ -978,6 +1080,50 @@
]
}
},
{
"type": "VULNERABILITIES",
"description": "Query with tainted range in two LIKEs with not tainted % char",
"input": [
{
"type": "SQL_INJECTION",
"evidence": {
"dialect": "MYSQL",
"value": "select * from table where name LIKE '%searchparam%' OR description LIKE '%searchparam%'",
"ranges": [
{
"start": 38, "end": 49, "iinfo": { "type": "http.request.parameter", "parameterName": "query", "parameterValue": "searchparam" }
},
{
"start": 74, "end": 85, "iinfo": { "type": "http.request.parameter", "parameterName": "query", "parameterValue": "searchparam" }
}
]
}
}
],
"expected": {
"sources": [
{ "origin": "http.request.parameter", "name": "query", "redacted": true }
],
"vulnerabilities": [
{
"type": "SQL_INJECTION",
"evidence": {
"valueParts": [
{ "value": "select * from table where name LIKE '" },
{ "redacted": true },
{ "source": 0, "redacted": true },
{ "redacted": true },
{ "value": "' OR description LIKE '" },
{ "redacted": true },
{ "source": 0, "redacted": true },
{ "redacted": true },
{ "value": "'" }
]
}
}
]
}
},
{
"type": "VULNERABILITIES",
"description": "Query with string literal and weird tainted range crossing boundaries",
Expand Down