-
Notifications
You must be signed in to change notification settings - Fork 6
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
Only build payload paths on attack #473
base: main
Are you sure you want to change the base?
Conversation
timokoessler
commented
Dec 9, 2024
- Find multiple occurrences in same source
+ Find multiple occurrences in same source
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
if (path === ".origin" || path === ".referer") { | ||
const url = tryParseURL(str); | ||
if (!!url && url.host === `localhost:${port}`) { | ||
ignoredPaths++; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has become complex. Any way to avoid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, the !!
is no longer necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same feeling
@@ -211,7 +211,7 @@ function wrapDNSLookupCallback( | |||
if (agent.shouldBlock()) { | |||
return callback( | |||
new Error( | |||
`Zen has blocked ${attackKindHumanName("ssrf")}: ${operation}(...) originating from ${found.source}${escapeHTML(found.pathToPayload)}` | |||
`Zen has blocked ${attackKindHumanName("ssrf")}: ${operation}(...) originating from ${found.source}${escapeHTML(found.pathsToPayload.join())}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defend vs potential crash
library/sinks/undici/wrapDispatch.ts
Outdated
@@ -110,7 +110,7 @@ function blockRedirectToPrivateIP(url: URL, context: Context, agent: Agent) { | |||
|
|||
if (agent.shouldBlock()) { | |||
throw new Error( | |||
`Zen has blocked ${attackKindHumanName("ssrf")}: fetch(...) originating from ${found.source}${escapeHTML(found.pathToPayload)}` | |||
`Zen has blocked ${attackKindHumanName("ssrf")}: fetch(...) originating from ${found.source}${escapeHTML(found.pathsToPayload.join())}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defend vs potential crash
library/helpers/attackPath.ts
Outdated
|
||
const attackPayloadLowercase = attackPayload.toLowerCase(); | ||
|
||
const traverse = (value: unknown, path: PathPart[] = []) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add a max_depth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this is only executed in case of an attack, it's not so important for performance, or?
if (path === ".origin" || path === ".referer") { | ||
const url = tryParseURL(str); | ||
if (!!url && url.host === `localhost:${port}`) { | ||
ignoredPaths++; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same feeling
Co-authored-by: Hans Ott <[email protected]>