Giter VIP home page Giter VIP logo

qualcomm_baseband_scripts's Introduction

qualcomm_baseband_scripts

Collection of scripts for reversing Qualcomm baseband / modem firmware

All offsets/addresses in the scripts have been updated to the Pixel 5 March firmware and need to be changed if using a different version.

Merging

merge_modem_firmware.py Merges all of the modem.b** (modem.b00, modem.b01, etc.) files into a single monolithic binary named modem.bin. This makes it much easier to load into IDA and Ghidra.

Decompression

clade_extractor and dlpage_extractor decompress the CLADE and Delta compressed sections.

clade_extractor is compiled to x86 (or your native arch) and will output the decompressed section to a file. As far as I know, there is no publicly available information or code published for Qualcomm CLADE compression aside from the patent. CLADE has replaced q6zip as the main compression method for user-mode modules and is a pain to reverse because it's mostly implemented in hardware.

dlpage_extractor is compiled for Hexagon and emulated in QEMU (as previous works have done). The decompressed memory will then need to be dumped in GDB. There is also code here for the old q6zip compression method, although this is no longer used on newer modem binaries. The delta section only has a couple diag command handler structs, so the CLADE compressed section is where most of the meat is. I wouldn't even bother with this on newer binaries, it's only here for older ones.

Merging Again

Once you have the decompressed CLADE section, you can run add_decompressed_section_to_modem_bin.py to add it to modem.bin. This can be done manually in IDA and Ghidra, but this script makes it a bit easier to load and backup the final binaries.

Reversing

qshrink4_qdb_ghidra_script.py decodes all calls to msg_v4_send* into their respective debug strings. It will add a comment to the top of every function that uses them. These debug strings are incredibly useful for reversing as they always give the file name and some context for the function. To make it even better, they sometimes contain function names, variable names, and more. Check the file path that's being opened for help on getting the qdb file from the Pixel 5 firmware file. Just keep binwalk extracting until you get what you need.

diag_handler_locator_ghidra_script.py locates and rename all diag command handler functions into a <op1>_<op2>_diag_cmd_handler naming scheme so that they're easier to search for in Ghidra.

Credit

A couple of the scripts have code taken from other sources. I've tried to give credit for everything, but I may have forgotten one or two. Please let me know if I used your code and forgot to credit you.

If this repo helped you, please ⭐ it!

qualcomm_baseband_scripts's People

Contributors

mzakocs avatar

Stargazers

Date Huang avatar Daniyal Shahzad avatar  avatar  avatar Marius Muench avatar Jiska Classen avatar  avatar Wesley Santos da SIlva avatar Yohanes Nugroho avatar  avatar Huski avatar 0xBKAKER avatar HYPOXIC | Trunk avatar  avatar fdgnneig avatar  avatar  avatar Can avatar  avatar  avatar Philipp Huth avatar  avatar  avatar Tom Hebb avatar  avatar Brinly  avatar 执着 avatar Grant Hernandez avatar David Gotrik avatar  avatar  avatar  avatar Rafael Ristovski avatar Alexey Terentev avatar YiMing Liu avatar  avatar rulio avatar  avatar  avatar  avatar s0nlx avatar  avatar Lays avatar Casey Strouse avatar  avatar  avatar Noob_daidai avatar Larson T. avatar Gr3yD0g avatar Sagi Kedmi avatar tu95 avatar Lemuel Lew avatar o0xmuhe avatar wr3cckl3ss avatar Bjoern Kerler avatar  avatar DAssemblerxXBin3ryNinj! avatar frqmod avatar  avatar Gionne Cannister avatar Josh Collyer avatar Dady Nasser 89 avatar Hakyong Chang avatar 0xsunsama avatar  avatar Kira233 avatar Philip avatar Derrick Croteau avatar Aleksei Kulaev avatar  avatar fish avatar Jakob Link avatar Peterpan0927 avatar ThomasKing avatar exp-sky avatar Orochi avatar LordCasser avatar antx avatar  avatar  avatar BlueT - Matthew Lien - 練喆明 avatar Scott Muller avatar kvalerio avatar Lars Sætaberget avatar Computer button pusher // Pousseur de boutons en informatique  || SIN - SIN HACK - HACK || NO-CODE evangelist || Black coffee like my sense of humor avatar Proteas avatar  avatar Alexander Pick avatar Superfro avatar linuxct avatar Leopold avatar zero idea avatar Paul Kenyon avatar R avatar Lech Perczak avatar OneBadAlien avatar  avatar AjMaChInE avatar Theodor Arsenij avatar chann avatar

Watchers

Jevin Sweval avatar Omar El-Domeiri avatar Fernand Lone Sang avatar Brinly  avatar  avatar  avatar  avatar Philipp Huth avatar  avatar ybtag 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.