Skip to content

Handle ELF binary with no program segments #140

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ffontaine
Copy link
Contributor

@ffontaine ffontaine commented Mar 6, 2025

Do not return False for NX and No for RELRO when there is no program segments in the ELF binary file (e.g. kernel module).

This is inspired from slimm609/checksec@29aea68

For RELRO, a new NA value is added
For NX, True is returned to avoid changing NX type from boolean to string

@ffontaine ffontaine changed the title Handle binary with no program segments Handle ELF binary with no program segments Mar 6, 2025
@ffontaine ffontaine force-pushed the master branch 2 times, most recently from a603c84 to 4b042e4 Compare March 6, 2025 16:10
@ffontaine
Copy link
Contributor Author

relro_na will have to be added to tests/binaries/elf to fix tests

@Wenzel
Copy link
Owner

Wenzel commented Mar 21, 2025

Hi @ffontaine and thanks for this PR.

Could you provide a test binary and make a PR into https://github.com/Wenzel/checksec.py-test-binaries ?

@ffontaine
Copy link
Contributor Author

Hi, PR created: Wenzel/checksec.py-test-binaries#2

@Wenzel
Copy link
Owner

Wenzel commented Mar 30, 2025

@ffontaine just merged your test binary
can you update the submodule here ?

@ffontaine
Copy link
Contributor Author

Done

@Wenzel
Copy link
Owner

Wenzel commented Mar 31, 2025

Thanks !
can you make the CI go green ? 🟢

@ffontaine
Copy link
Contributor Author

I sent a new PR as pytest does not handle link on usb-storage.ko: Wenzel/checksec.py-test-binaries#3

Do not return False for NX and No for RELRO when there is no program
segments in the ELF binary file (e.g. kernel module).

This is inspired from
slimm609/checksec@29aea68

For RELRO, a new NA value is added
For NX, True is returned to avoid changing NX type from boolean to
string

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
@ffontaine
Copy link
Contributor Author

CI is finally green :-)

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

Successfully merging this pull request may close these issues.

2 participants