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

Inapplicable path traversal attack error message #1310

Closed
CmP-lt opened this issue Dec 20, 2021 · 3 comments
Closed

Inapplicable path traversal attack error message #1310

CmP-lt opened this issue Dec 20, 2021 · 3 comments

Comments

@CmP-lt
Copy link
Contributor

CmP-lt commented Dec 20, 2021

Opening any DEX file leads to error message of the following type getting logged:

ERROR: Path traversal attack detected, invalid name: C:\Users\Admin\Downloads\classes.dex

It seems that when a DEX file is opened separately, not as part of an APK file, JADX mistakenly treats it as being an entry of a ZIP archive and calls the following method to check validity of file path, as if it was name of an entry in a ZIP archive:

// checks that entry name contains no any traversals
// and prevents cases like "../classes.dex", to limit output only to the specified directory
public static boolean isValidZipEntryName(String entryName) {
try {
File currentPath = new File(".").getCanonicalFile();
File canonical = new File(currentPath, entryName).getCanonicalFile();
if (isInSubDirectoryInternal(currentPath, canonical)) {
return true;
}
LOG.error("Path traversal attack detected, invalid name: {}", entryName);
return false;
} catch (Exception e) {
LOG.error("Path traversal attack detected, invalid name: {}", entryName);
return false;
}
}

@skylot
Copy link
Owner

skylot commented Dec 20, 2021

@CmP-lt I can't reproduce your issue 😞
Can you provide jadx version and how you run jadx-gui (if from command line: share that command)?
Also, maybe someone else saw this issue and can add any detail? Stack trace to that method will be the best option 🤣

@CmP-lt
Copy link
Contributor Author

CmP-lt commented Dec 20, 2021

JADX version: 1.3.1
Java version: 11.0.12
Startup type: double-clicking "jadx-gui.bat" file

@skylot
Copy link
Owner

skylot commented Dec 20, 2021

@CmP-lt thanks! I commit a fix 👍
This issue not appear on Linux only on Windows. Unlike Windows, Linux is fine with merging two absolute paths 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants