-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Fail to build secure XML DocumentBuilderFactory #2291
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
As there is no Android version of Jadx you seem to use Jadx as library. However the version "latest unstable version" does not really match the stack trace you have posted. Especially the stack trace element The exception is caused by Android XML parser. It seems like it doesn't support all the features of a regular J2SE XML parser. Which Android version do you use? |
@Lohita9 Please never post code like gradle config as screenshot, especially not as truncated screenshot. Edit: There is a related question in Stackoverflow on DocumentBuilderFactory on Android: https://stackoverflow.com/questions/67605248/how-to-prevent-xxe-attacks-on-android-when-documentbuilderfactory-doesnt-allow As the DocumentBuilderFactory configuration we use in Jadx is not supported on Android the only way would be to make this function overridable so that you could modify it on Android. The getSecureDbf() function had been added in 2017, we should also check if it is still necessary as we have changed our JDK requirement since that time. |
Ok, I am currently running jdk 21. |
I just noticed that there is already a setting that allows to disable XML security checks which causes the problems on Android. The problem is that jadx currently expects you to set I assume this configuration settings via ENV variable were introduced mainly for jad-core command-line users. For jadx library users using ENV variables doesn't make much sense. May be on a long term perspective we ,may need a configuration system that is a little bit more flexible. @skylot What do you think? @Lohita9 I just checked the code in jadx-code library in jadx/jadx-core/src/main/java/jadx/core/xmlgen/XmlSecurity.java Lines 25 to 27 in b26abdc
if (DISABLE_CHECKS) { .
Therefore the version you use is not the latest unstable version - gradle doesn't seem to recognize that there is a newer snapshot available. I would recommend to delete the cached jadx library dependencies somewhere below |
Not working.
|
@jpstotz looks like the only way is to allow completely replace implementation. And sure, any jadx env variable shouldn't be needed in 'jadx as a library' usage. I recently done similar thing for 'various files' properties in b26abdc, such changes also useful for jadx plugins. And there are a lot of things needs to be extracted in similar way 😢 |
I commit fix allowing disable or completely replace xml security checks. Set<JadxSecurityFlag> flags = JadxSecurityFlag.all();
jadxArgs.setSecurity(new JadxSecurity(flags)); Here @Lohita9 also I created an example Android app with jadx lib usage, check https://github.com/jadx-decompiler/jadx-lib-android-example repo. Main jadx usage code can be found here. Hope this will help 🙂 |
Issue details
This issue occurs when I decompile an APK using Jadx on my Android device.
Relevant log output or stacktrace
Provide sample and class/method full name
my-debug.zip
Jadx version
latest unstable version
The text was updated successfully, but these errors were encountered: