-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
Add support for Linux userland ELF snapshots and fuzzing #192
Conversation
This is based on Kasamir123's pull request at 0vercl0k#102 plus some scripts in snapchange for automatically setting up a Linux VM target. The following improvements have been made as compared to Kasamir123's original pull request: * Fixed bug when calling mlockall, allowing us to remove page touching code * Code requires no custom #ifdefs in wtf * Linux snapshots work w/fuzzing via KVM. Kasamir123's code had some issues with gathering segment registers, and our updates fix these issues, allowing for KVM support * Kasamir123's code injects shellcode into the target process by overwriting code, but never restored the original code. We now restore the original code * Snapshotting is more streamlined, only taking a few manual steps once everything is configured * Some improvements from 0vercl0k's suggestions from ELF Snapshotting and Fuzzing 0vercl0k#102, like implementing raw2dmp in Python * Support for setting breakpoints on symbols in ELF targets plus use of symbols in fuzz harnesses * IDA script for generating coverage breakpoints list so that targets can be fuzzed with KVM * Target VM can run with HW acceleration enabled, Kasamir123's scripts for running the VM and taking a snapshot only worked with SW emulation * Works with recent Linux kernel versions
Damn, this is an amazing contribution and I'm looking forward to diving into it! Thanks again for working on this and contributing back. It's probably going to take me a minute to go through all of this 😅, but bear with me; I really want to get it in! Cheers |
Okay I tried to run through the readme / instructions today and I might be hitting something unexpected; or I am doing something wrong. The set-up part works fine, QEMU / Linux kernel sources are properly downloaded / compiled as far as I can tell. I am starting the VM and it seems to diverge from the README; I hit a bunch of
Then, I start the gdb client:
This triggers a
Again, if I hit continue I get this on the
What gdb version should I use? Or maybe it's something else? My test VM is a Ubuntu 22.04.3 LTS. Cheers |
Thanks for trying this out. I'll work on reproducing these issues and getting fixes in soon. |
Ok, I think both issues you ran into were related to gdb trying to process many SIGUSR1 signals. I've updated Confirmed latest changes work on a fresh Ubuntu 22.04.2 LTS VM:
|
Awesome - I was able to generate a dump, thanks! Working through the rest of the readme now.. Cheers |
@jasocrow the README mentions that one of the limitation is that it doesn't support guests with more than 2GB of RAM - yet the Also, I was wondering what's been your trace debugging workflow? Traces work fine but not sure how you've been symbolizing them? Cheers |
@0vercl0k Awesome, thanks for trying it out and starting to change things up to your liking. Good catch on the README. I guess 4 GB started working at some point and we didn't notice. Perhaps it started working when we moved to using a VM generated from the Snapchange scripts. Ah yeah, we never implemented a symbolizer. We've been using tenet traces and loading them in IDA. |
@0vercl0k I can take a look at adding a symbolizer, but it might be a while before I can get to it. |
No worries - I was more asking from the angle of documenting the
limitations and how people should go about debugging their testcases :)
Cheers
…On Thu, Feb 22, 2024 at 8:55 AM jasocrow ***@***.***> wrote:
@0vercl0k <https://github.com/0vercl0k> I can take a look at adding a
symbolizer, but it might be a while before I can get to it.
—
Reply to this email directly, view it on GitHub
<#192 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALIORM4DPNG2W5SYQZGS73YU5Z6VAVCNFSM6AAAAABCJFQPLGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJZHA3DINZRGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
…ot into linux-snapshot
All right @jasocrow I think this is ready to go - take a look and if this looks good to you, let's merge this! Cheers |
Everything looks good to me, happy if you're ready to merge. Thanks!! |
Great catch, thank you - fixed. Ok cool, thanks for taking a look - will
merge this next week!
Cheers
…On Fri, Mar 29, 2024 at 6:52 AM jasocrow ***@***.***> wrote:
Oh, I just noticed one small thing, looks like the link to Kyle's site in
linux_mode/README.md is not showing correctly.
Screenshot.2024-03-29.at.8.50.33.AM.png (view on web)
<https://github.com/0vercl0k/wtf/assets/153134172/54828663-49d3-44fc-9681-9e0eafbf6dac>
—
Reply to this email directly, view it on GitHub
<#192 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALIORJ5ZWCRHYLWRQVNHB3Y2VW3XAVCNFSM6AAAAABCJFQPLGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRXGI3TMMJWGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This is based on Kasamir123's pull request at
#102 plus some scripts in Snapchange for automatically setting up a Linux VM target.
The following improvements have been made as compared to Kasamir123's original pull request: