-
-
Notifications
You must be signed in to change notification settings - Fork 704
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
ascanrules: Fix FP in Path Traversal directory browsing checks #5387
Conversation
addOns/ascanrules/src/main/java/org/zaproxy/zap/extension/ascanrules/PathTraversalScanRule.java
Outdated
Show resolved
Hide resolved
@kingthorin
For this reason, I decided to replace regex. Slightly increase the number of checks to get rid of FP accurately, as well as remove the hardcoded "href" in order to match plain text. |
addOns/ascanrules/src/main/java/org/zaproxy/zap/extension/ascanrules/PathTraversalScanRule.java
Outdated
Show resolved
Hide resolved
...nrules/src/test/java/org/zaproxy/zap/extension/ascanrules/PathTraversalScanRuleUnitTest.java
Outdated
Show resolved
Hide resolved
...nrules/src/test/java/org/zaproxy/zap/extension/ascanrules/PathTraversalScanRuleUnitTest.java
Outdated
Show resolved
Hide resolved
@kingthorin |
Someone else in the team needs to review and approve (hopefully). |
b323252
to
c36a68c
Compare
ping |
@kingthorin |
As mentioned in #5336 (comment) you should rebase both PRs. |
If you need help with the rebases lemme know I can tackle it |
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
@kingthorin looks like something went wrong... |
Okay no problem, I'll have a look 👀 in a few hours |
… functions Enhanced regex for nix architecture Signed-off-by: mikhail.evtikhov <[email protected]>
Added test for plain text dir_based pathTraversal Signed-off-by: mikhail.evtikhov <[email protected]>
Fixed a typo in the tests. Signed-off-by: mikhail.evtikhov <[email protected]>
Signed-off-by: mikhail.evtikhov <[email protected]>
Signed-off-by: mikhail.evtikhov <[email protected]>
Okay so we have two options:
|
The option 1 will not be present, this PR is from an org's fork. |
@kingthorin
|
Discussed this with the team. We think that "should" work, though it actually seems like more effort than my option 2 😉 |
@kingthorin
|
You probably need to use |
db06f93
to
cd7b0ff
Compare
Looks like it worked :D |
That seems to be back on track. Thanks |
addOns/ascanrules/src/main/java/org/zaproxy/zap/extension/ascanrules/PathTraversalScanRule.java
Show resolved
Hide resolved
Signed-off-by: mikhail.evtikhov <[email protected]>
Can you address the conflict? |
Signed-off-by: mikhailevtikhov <[email protected]>
Done. |
Thank you! |
@mikhailevtikhov thanks for sticking with this and seeing it through! |
Overview
This was extracted from #5336
PathTraversal directory browsing detects (Check 3):
This check finds a large number of FP in various web applications, because the regular expression that parses the response from the server for the nix architecture will not accurately determine that this is the root directory of the OS.
For example, to generate FP on payload "c:" or any other from the LOCAL_DIR_TARGETS array, the words in the response from the server will be enough (etc. , bootstrap.min.js , tabindex) to generate Aletr. The reason for this is a weak pattern check for nix systems implemented in DirNamesContentsMatcher.
You can play this FP on Apache Superset.
In this PR checks for windows and nix directories are implemented with different functions and enhanced regex for nix architecture.
Checklist
./gradlew spotlessApply
for code formatting