Giter Site home page Giter Site logo

sigblock-code-poc's Introduction

CI GPLv3+

android apk signing block payload poc

PoC for an Android app that reads the APK Signing block of its own APK and extracts a payload to alter its behaviour.

Whether the payload is present or not does not affect the validity of the signature.

Thus we get two APKs -- with an identical valid v1+v2+v3 signature -- but one says "nothing to see here..." when you run it, whereas the other says e.g. "This is the payload".

NB: uses the work-in-progress apksigtool to add the payload to the APK.

Example

Generate a dummy keystore

$ keytool -genkey -keystore dummy-ks -alias dummy -keyalg RSA \
    -keysize 4096 -sigalg SHA512withRSA -validity 10000 \
    -storepass dummy-password -dname CN=dummy

Build a release APK

$ ./gradlew assembleRelease

NB: if you get an "SDK location not found" error, you'll need to set ANDROID_HOME first (adjust accordingly if the SDK is in another location than the Android Studio default of ~/Android/Sdk):

$ export ANDROID_HOME=~/Android/Sdk
$ ./gradlew assembleRelease

Sign it with the dummy key

$ cp app/build/outputs/apk/release/app-release-unsigned.apk poc.apk
$ apksigner sign -v --ks dummy-ks --ks-key-alias dummy poc.apk

Add the payload

In a custom block

$ echo 'This is the payload' > payload
$ ./add_poc.py poc.apk payload

Hidden in the verity padding block

$ echo 'This is the payload' > payload
$ ./add_poc.py --verity poc.apk payload

Install on phone

$ adb install poc.apk

License

GPLv3+

sigblock-code-poc's People

Contributors

obfusk avatar

Stargazers

Sunny avatar  avatar  avatar  avatar  avatar Javed Khan avatar Orhun Parmaksız avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.