Gallopsled / Gallopsled/pwntools

Add support for specific MIPS releases

Open
#2,455 0 comments 1 reaction 0 assignees View on GitHub
feature
Dominant language
Python
Stars
13.7k
Forks
1.9k
Avg merge
6d 23h
Merged PRs (30d)
3

Description

When setting the architecture in pwntools (for compiling shellcode or `gdb.attach()`), only basic MIPS architectures are supported (namely `mips` and `mips64`). Specific releases like `mips32r5` or `mips32r6` are not available. This means all MIPS code is treated as Release 1 and will give incorrect results for later releases.

This issue occurs both when compiling shellcode and when using GDB to debug my script. I ran into this problem because I discovered `pwntools` was setting the GDB architecture as `mips` even though it should be `mips:isa32r6` for my binary (and that's also what's autodetected by GDB). I noticed this issue because MIPS32r6 is not backwards-compatible, so some assembly code was showing up incorrectly and confusing me haha.

My current workaround is to set the first line of my `gdbscript` in `gdb.attach()` to `set architecture mips:isa32r6`, not sure what a workaround in compiling shellcode would look like. It seems a similar issue has been reported for ARM (https://github.com/Gallopsled/pwntools/issues/1431) since ARM also has several sub-architectures, but nothing has been done with that since 2020. I think a configurable sub-architecture field for context would be fantastic.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how the architecture in pwntools context is used for shellcode compilation and by gdb.attach(), including the generated GDB architecture setting. Support specific MIPS releases such as mips32r5 and mips32r6 in both paths, with behavior matching GDB's mips:isa32r6 architecture name.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.