Decoding Rust Strings in ELF Firmware Binaries#2418
Open
carlospolop wants to merge 1 commit into
Open
Conversation
Collaborator
Author
🔗 Additional ContextOriginal Blog Post: https://pentestpartners.com/security-blog/decoding-rust-strings Content Categories: Based on the analysis, this content was categorized under "Reversing / Reversing Tools & Basic Methods or Hardware/Physical Access / Firmware Analysis". Repository Maintenance:
Review Notes:
Bot Version: HackTricks News Bot v1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Automated Content Update
This PR was automatically generated by the HackTricks News Bot based on a technical blog post.
📝 Source Information
🎯 Content Summary
Overview
The post explains a practical reverse-engineering technique for recovering Rust strings from Linux ELF firmware binaries, especially embedded/ARM device binaries where Ghidra may fail to identify Rust string references correctly. The author encountered this while reversing a custom ARM-based device binary that acted as both a web server and a system controller. The binary was written in Rust, which made normal string discovery less effective because Rust does not al...
🔧 Technical Details
Rust ELF string reconstruction: Rust binaries may store string references as metadata tuples instead of NUL-terminated byte arrays. In the observed
rustcoutput, each reference is an 8-byte little-endian pointer followed by an 8-byte little-endian length. The actual string bytes live sequentially in.rodatawithout separators, so generic string scanners can merge multiple logical strings together. To recover the strings, inspect the ELF sections withreadelf -Sorobjdump -h, identify the virtual address and size of.rodata, then scan.data.rel.roword-by-word. Any word whose value falls inside the.rodatarange is a candidate string pointer, and the following word is the candidate length. Read exactly that many bytes from.rodataand apply sanity filters such as ignoring values below 4 bytes or above 100 bytes.Improving Ghidra analysis for Rust fir...
🤖 Agent Actions
Updated
src/reversing/reversing-tools-basic-methods/README.md.What I added:
.data.rel.ro.rodatareadelf -S/objdump -hworkflowrust-stringsRustStrings.pyWhy this location:
Validation:
mdbook build, butmdbookis not installed in this environment (/bin/bash: mdbook: command not found).This PR was automatically created by the HackTricks Feed Bot. Please review the changes carefully before merging.