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

Fix Full RELRO/Partial RELRO/No RELRO check for Android #1654

Merged
merged 2 commits into from
Jan 22, 2021

Conversation

SektorROM
Copy link
Contributor

@SektorROM SektorROM commented Jan 21, 2021

Describe the Pull Request

Returned string of relro() in mobsf/StaticAnalyzer/views/android/binary_analysis.py not properly checked in line 94 and 102, always leading to the "else" case in line 102 (no matter actual RELRO level of binary, always "No RELRO" is falsely shown).

This pull request fixes these checks accordingly.

Checklist for PR

  • [ OK] Run MobSF unit tests and lint tox -e lint,test
  • [ Linux] Tested Working on Linux, Mac, Windows, and Docker
  • [ - ] Add unit test for any new Web API (Refer: StaticAnalyzer/tests.py)
  • Make sure tests are passing on your PR MobSF tests

Additional Comments (if any)

iOS not impacted, as no RELRO there.

@ajinabraham
Copy link
Member

ajinabraham commented Jan 21, 2021

Hi @SektorROM Thanks for the PR.
I am seeing the current logic working fine using lief 0.11.0 which we use for library analysis.

Screen Shot 2021-01-21 at 2 03 30 PM

Can you share the APK where you see RELRO not getting detected?

@SektorROM
Copy link
Contributor Author

Hi,

can't share the exact APK due to reasons, but I'll create a new one and try to reproduce.
Strange it works on your side (also weird you have the 'high' tag visible, although 'Full RELRO' is good and should be 'info')

@ajinabraham
Copy link
Member

Now that you mentioned, something looks not alright. will take a look again.

@SektorROM
Copy link
Contributor Author

SektorROM commented Jan 21, 2021

*Exactly. You ran into the case I mentioned (I got confused myself)

Your binary does have "Full RELRO", the "relro" field is propagated correctly through to the WebView, but "desc" and "severity" are the wrong one, because "relro" was only matched against "Full" or "Partial" and not "Full RELRO" and "Partial RELRO", resulting in always landing in the else (No RELRO) case - hence the 'high' tag and description.

Copy link
Member

@ajinabraham ajinabraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this indeed is a bug

@ajinabraham ajinabraham merged commit d21e518 into MobSF:master Jan 22, 2021
fengjixuchui added a commit to fengjixuchui/Mobile-Security-Framework-MobSF that referenced this pull request Jan 22, 2021
Fix Full RELRO/Partial RELRO/No RELRO check for Android (MobSF#1654)
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