756 Commits
Author SHA1 Message Date
Sascha Schirra a2ffccf046 Merge pull request #197 from FranciscoPombal/fix-escape-sequences
Fix `SyntaxWarning` invalid escape sequences in regex strings
2026-08-22 19:05:00 +02:00
Sascha Schirra 1354ad399f Merge pull request #199 from robbiegal/master
Add ARM execve chain support and a ret2libc spawn_shell generator (x86/x86_64/ARM)
2026-08-22 19:04:41 +02:00
RobbieandClaude Opus 4.8 a602167c58 Add ARM execve chain support and a ret2libc spawn_shell generator
ARM --chain execve: ArchitectureArm previously raised "does not have
support for execve chain generation". This adds ARM gadget categories
(pop/ldm pop-pc LOAD_REG, WRITE_MEM, LOAD_MEM, SYSCALL) and the svc 0
SYS ending, plus a generator that discovers terminal pop-pc / ldm
dispatch gadgets, fills r0/r1/r2/r7 with a re-loading-aware register
cover planner, writes the command into .data, and emits clearly-labelled
placeholders when a gadget (svc 0, an r0 pop, ...) is missing.

New --chain spawn_shell for x86, x86_64 and ARM: a ret2libc
system("/bin/sh") generator emitting the correct per-arch calling
convention -- x86 cdecl (stack arg), x86_64 System V (rdi + a movaps
stack-alignment ret), ARM AAPCS (r0 + pc dispatch). Options: cmd
(default /bin/sh, any path), address (libc system), string (&cmd),
align (x86_64).

system() resolution: address= > a system symbol defined in the binary
(rebased) > verified system@plt > import hint > placeholder. _findPltStub
disassembles .plt/.plt.sec/.plt.got and returns the stub whose indirect
jump provably dereferences system's GOT slot (x86_64 jmp [rip+disp],
x86 jmp [abs], ARM add ip,pc,#imm[,#rot] ; ... ; ldr pc,[ip,#imm]!),
verified against the relocation, so it never emits a silently-wrong
address; x86 PIE jmp [ebx+off] and stripped PLTs fall back to the hint.

"/bin/sh" resolution: string= > an existing copy already in the binary
(no write) > write the string into a writable scratch section, .bss
preferred, via write-what-where gadgets > placeholder. _findWritableSection
reads ELF section headers directly (SHF_WRITE|SHF_ALLOC, not TLS,
sh_size >= needed) so writability and free space are verified natively;
it avoids getSection('.bss') because .bss is SHT_NOBITS (raw is None,
size comes from sh_size).

Correctness fixes:
- The scratch-buffer pointer was double-imageBase-subtracted (pointer !=
  written bytes); it now uses the same rebase_N(offset) convention as the
  write.
- x86_64 _paddingNeededFor's ^pop (...)$ regex dropped pop r8/pop r9
  (2-char regs), under-padding chains; broadened to \w{2,3} (also hardens
  execve/mprotect).
- _useBinaryForRebase registers the binary with the gadgets' own
  (fileName, section) identity, so a later gadget registration reuses the
  entry instead of emitting a duplicate IMAGE_BASE.
- The written string is always NUL-terminated: the shared
  _nulTerminateAndPad appends the NUL unconditionally before word-aligning
  (ARM previously skipped it for cmd lengths that were a multiple of 4).

Help text (--help epilog in options.py, README.md, interactive ropchain
help in console.py) lists spawn_shell, the .bss write and cmd=, and marks
execve as ARM-capable. Tests: testcases/test_chain_arm.py and
testcases/test_chain_spawn_shell.py; full suite 58/58.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-03 07:29:25 +03:00
Francisco Pombal ac1b1716f9 fix invalid escape sequences in regexes 2026-05-28 01:17:48 +01:00
Sascha Schirra c9e66e1d73 Merge pull request #189 from sashs/fix
Fix
v1.13.13
2025-02-28 22:47:30 +01:00
Sascha Schirra 1d23047c68 version changed 2025-02-28 22:46:15 +01:00
Sascha Schirra 76faf9befa add all packages; fixes #188 2025-02-28 22:46:05 +01:00
Sascha Schirra cdd04d20aa version changed v1.13.12 2025-02-23 20:02:20 +01:00
Sascha Schirra ce1c936fa5 version changed 2025-02-23 20:00:23 +01:00
Sascha Schirra aa6b9ad122 Merge pull request #184 from CheddarJon/dockerfile
Updates Dockerfile
v1.13.11
2025-02-23 19:07:35 +01:00
Sascha Schirra 31403ada70 Merge pull request #187 from sashs/bugfix
Bugfix: CS_ARCH_AARCH64
2025-02-23 19:05:11 +01:00
Sascha Schirra 0125d9cd64 look for CS_ARCH_ARM64 2025-02-23 18:55:57 +01:00
Sascha Schirra 983995f4ab added CS_ARCH_ARM64 as well to be compatible with all versions 2024-10-27 12:36:50 +01:00
Sascha Schirra caac38b4af ARM64 to AARCH64 due to renaming of the variable in capstone bindings 2024-10-27 10:18:13 +01:00
CheddarJon 808d0c20ff Dockerfile: Uses pip3 and pyproject.toml 2024-09-24 09:39:30 +02:00
Sascha Schirra 525bcf7f04 Merge pull request #182 from jakelamberson/pyproject-toml
Migrate to pyproject.toml
2024-07-30 22:07:33 +02:00
Jake Lamberson e677729c43 Migrate to pyproject.toml 2024-06-26 09:16:55 -04:00
Sascha Schirra a1141ab665 version changed v1.13.10 2024-05-08 13:53:20 +02:00
Sascha Schirra ada7176979 do not filter rop gadgets that contains jmp 2024-05-08 13:52:18 +02:00
Sascha Schirra a5a4de29b8 version changed v1.13.9 2024-05-02 23:17:52 +02:00
Sascha Schirra 651d400750 Merge pull request #179 from nbailluet/master
Add pop.w regex pattern for ArmThumb architecture
2024-05-01 20:01:54 +02:00
Nicolas Bailluet 3abbaa5962 Add pop.w regex pattern for ArmThumb architecture 2024-04-25 14:57:41 +02:00
Sascha Schirra 1296f729c9 Merge pull request #178 from tomg404/master
fixed typos and grammatical errors in help text
2024-01-11 22:54:59 +01:00
Tom Gaimann 83d16dc78f update help text in readme 2024-01-11 17:23:27 +01:00
Tom Gaimann 2738c0a4be fixed typos and gramatical errors in help text 2024-01-11 17:21:45 +01:00
Sascha Schirra 85e03793db Merge pull request #168 from tabun-dareka/master
fix typos
2023-04-24 07:36:20 +02:00
Adrian e6bfd41e4c fix typos
fix typos in command descriptions
2023-04-18 13:30:28 +02:00
Sascha Schirra c03cfe5090 Merge pull request #163 from oddrabbit/master
Create Dockerfile
2022-10-27 08:58:13 +02:00
OddRabbit edb838be4a Update Dockerfile 2022-10-26 19:49:59 +11:00
OddRabbit b7574a983d Create Dockerfile 2022-10-26 18:06:04 +11:00
Sascha Schirra b1b2cd378e version changed v1.13.8 2022-08-07 22:25:38 +02:00
Sascha Schirra b0d71d3310 removed tests for python2 2022-08-07 22:25:21 +02:00
Sascha Schirra b87fe6b802 Bugfix: context has already been set 2022-08-07 22:25:05 +02:00
Sascha Schirra 9811612313 Merge pull request #146 from cbayet/master
BUGFIX: gadgets missed because of a bad declaration of the pop pc gadget.
2022-08-07 12:54:35 +02:00
Sascha Schirra 637255828b Merge pull request #158 from brandonssipes/master
fixed ldm sp jop
2022-08-07 12:44:58 +02:00
paul 2a13b14ba5 fixed ldm sp jop 2022-05-08 09:35:47 -04:00
Sascha Schirra 73bc568c59 version changed v1.13.7 2022-01-29 15:36:20 +01:00
Sascha Schirra c821360228 Bugfix: push gadgets in ropchain, closes #154 2022-01-29 15:34:26 +01:00
Sascha Schirra 5f62b0463e Bugfix: object of type 'NoneType' has no len() when search in multiple files 2022-01-29 15:24:15 +01:00
Sascha Schirra 5e6692092b rename multiprocessing variable 2022-01-29 15:23:14 +01:00
Sascha Schirra 4a9ff91bed rename multiprocessing module 2022-01-29 15:22:23 +01:00
Sascha Schirra d8ede83c21 Bugfix: 'Ropper' object has no attribute '__gatherGadgetsByEndings' 2022-01-29 15:09:35 +01:00
Sascha Schirra dd4c71e03b Bugfix: push gadgets in ropchain 2022-01-29 15:08:40 +01:00
Corentin Bayet 66adeb0a1d BUGFIX: fix the detection of pop pc that is invalid 2021-06-15 10:45:37 +02:00
Corentin Bayet b05e90aed4 BUGFIX: Added the detection of the gadget pop {pc} in the pattern for ARM and ARMBE 2021-06-14 17:23:41 +02:00
Corentin Bayet d8fad95ac7 BUGFIX: Fixing invalid opcode for pop with more than 5 destinations, making ropper to miss gadgets 2021-06-14 15:47:58 +02:00
Sascha Schirra c4d785d48b Merge pull request #143 from mkrasnitski/master
Control cache location with environment variables
2021-05-05 08:38:33 +02:00
Michael Krasnitski 8a5c7755ad let user control cache location with env vars 2021-05-04 09:51:46 -04:00
Sascha Schirra 9a948026b8 version changes v1.13.6 2021-02-14 21:22:22 +01:00
Sascha Schirra b4f01571c8 split help 2021-02-14 21:20:59 +01:00