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

Add enableRelaxedEndCondition support #25

Open
s0ullight opened this issue Apr 11, 2023 · 2 comments
Open

Add enableRelaxedEndCondition support #25

s0ullight opened this issue Apr 11, 2023 · 2 comments

Comments

@s0ullight
Copy link

XZ 1.9 introduced a new method to LZMAInputStream. When this method is called before any data from the stream is read, the absence of EOS doesn't trigger an exception.

@al3xtjames
Copy link
Owner

Thanks for the notice. ghidra-firmware-utils doesn't actually use XZ for Java directly - it uses Apache commons-compress, which is already included in Ghidra. I think this required manual installation of the jar in the past (at least that's what I thought at the time: cd74930 🤷‍♀️ ), but it seems to work without it. Ghidra already includes it:

$ fd xz $GHIDRA_INSTALL_DIR
Ghidra/Framework/Project/lib/xz-1.9.jar

I'll remove the explicit XZ for Java dependency as it's no longer needed.

Regarding enableRelaxedEndCondition: it seems that commons-compress started calling it in 1.22 (see apache/commons-compress@31d1738). Ghidra 10.2.3 includes 1.2.1:

$ fd commons-compress $GHIDRA_INSTALL_DIR
Ghidra/Framework/Project/lib/commons-compress-1.21.jar

This should get addressed once Ghidra updates the commons-compress dependency. It might be worth opening an issue (or submitting a PR!) in https://github.com/NationalSecurityAgency/ghidra to let the Ghidra maintainers know about this.

By the way, do you have any examples of firmware binaries with compressed sections that require enableRelaxedEndCondition? AFAICT LzmaCompress in EDK II BaseTools uses the LZMA SDK, so it might have been affected by this issue in the past.

@s0ullight
Copy link
Author

Thanks for the quick reply. I noticed the usage of apache commons-compress, but mentioned XZ to avoid confusion about what class has the method.

Regarding firmware binaries: I'm interested in the HP Pavilion 23-q109nb bios, trying to figure out how the nvram var whitelist works.

al3xtjames added a commit that referenced this issue Apr 13, 2023
This was originally added in cd74930 in order
to support LZMA in Apache Commons Compress (included by Ghidra). Recent releases
of Ghidra already include XZ for Java, so there's no need to include it in
ghidra-firmware-utils. See #25 for more info.
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