-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Labels
securityIssues and PRs related to security.Issues and PRs related to security.semver-majorPRs that contain breaking changes and should be released in the next major version.PRs that contain breaking changes and should be released in the next major version.urlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.whatwg-urlIssues and PRs related to the WHATWG URL implementation.Issues and PRs related to the WHATWG URL implementation.
Description
-
Version:
N/A -
Platform:
N/A -
Subsystem:
I found this article.
According to the article, Java and Python has ftp protocol injection to decode CRLF in the url.
ftp://foo:bar%0d%[email protected]/file.png
The url has the newline(CRLF) in authority part. Java and Python ftp server recognize following injected code.
USER foo
PASS bar
INJECTED
TYPE I
EPSV ALL
PASV
...
And our url module has the same issue for CRLF.
> url.parse('ftp://foo:bar%0d%[email protected]/file.png')
Url {
protocol: 'ftp:',
slashes: true,
auth: 'foo:bar\r\nINJECTED',
host: 'example.net',
port: null,
hostname: 'example.net',
hash: null,
search: null,
query: null,
pathname: '/file.png',
path: '/file.png',
href: 'ftp://foo:bar%0D%[email protected]/file.png' }
I tried WHATWG URL
, the new url parser does not decode the authority part.
new URL('ftp://foo:bar%0d%[email protected]/file.png')
// Chrome
{
hash: "",
host: "example.net",
hostname: "example.net",
href: "ftp://foo:bar%0d%[email protected]/file.png",
origin: "ftp://example.net",
password: "bar%0d%0aINJECTED",
pathname: "/file.png",
port: "",
protocol: "ftp:",
search: "",
username: "foo"
}
// Node v7.8 REPL
URL {
href: ftp://foo:bar%0d%[email protected]/file.png
protocol: ftp:
username: foo
password: --------
hostname: example.net
pathname: /file.png
}
Question
Why our url.parse decode authority by default?
And should we fix this CRLF problem?
I tried to fix this problem to sanitize CRLF url. but this change breaks compatibility. so I would like to hear some opinions.
I tried some npm modules related to ftp, but I cannot find vulnerabilities using this problem.
related urls
Metadata
Metadata
Assignees
Labels
securityIssues and PRs related to security.Issues and PRs related to security.semver-majorPRs that contain breaking changes and should be released in the next major version.PRs that contain breaking changes and should be released in the next major version.urlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.whatwg-urlIssues and PRs related to the WHATWG URL implementation.Issues and PRs related to the WHATWG URL implementation.