All Projects → RischardV → Riscv Alphanumeric Shellcoding

RischardV / Riscv Alphanumeric Shellcoding

Licence: other
Alphanumeric+1 shellcoding tools for RISC-V

Programming Languages

shellcode
44 projects

Labels

Projects that are alternatives of or similar to Riscv Alphanumeric Shellcoding

Riscv
RISC-V CPU Core (RV32IM)
Stars: ✭ 272 (+806.67%)
Mutual labels:  risc-v
Rars
RARS -- RISC-V Assembler and Runtime Simulator
Stars: ✭ 413 (+1276.67%)
Mutual labels:  risc-v
Renode
Renode - Antmicro's virtual development framework for complex embedded systems
Stars: ✭ 525 (+1650%)
Mutual labels:  risc-v
Shecc
A self-hosting and educational C compiler
Stars: ✭ 286 (+853.33%)
Mutual labels:  risc-v
Scr1
SCR1 is a high-quality open-source RISC-V MCU core in Verilog
Stars: ✭ 393 (+1210%)
Mutual labels:  risc-v
Chipyard
An Agile RISC-V SoC Design Framework with in-order cores, out-of-order cores, accelerators, and more
Stars: ✭ 436 (+1353.33%)
Mutual labels:  risc-v
Tock
A secure embedded operating system for microcontrollers
Stars: ✭ 3,258 (+10760%)
Mutual labels:  risc-v
Rt Thread
RT-Thread is an open source IoT operating system.
Stars: ✭ 6,466 (+21453.33%)
Mutual labels:  risc-v
Cores Swerv
SweRV EH1 core
Stars: ✭ 406 (+1253.33%)
Mutual labels:  risc-v
Eclipse Plugins
The Eclipse Embedded CDT plug-ins for Arm & RISC-V C/C++ developers (formerly known as the GNU MCU Eclipse plug-ins). Includes the archive of previous plug-ins versions, as Releases.
Stars: ✭ 507 (+1590%)
Mutual labels:  risc-v
Lbforth
Self-hosting metacompiled Forth, bootstrapping from a few lines of C; targets Linux, Windows, ARM, RISC-V, 68000, PDP-11, asm.js.
Stars: ✭ 293 (+876.67%)
Mutual labels:  risc-v
Riscv Software List
The RISC-V software tools list, as seen on riscv.org
Stars: ✭ 335 (+1016.67%)
Mutual labels:  risc-v
Ibex
Ibex is a small 32 bit RISC-V CPU core, previously known as zero-riscy.
Stars: ✭ 457 (+1423.33%)
Mutual labels:  risc-v
Os kernel lab
OS kernel labs based on Rust/C Lang & RISC-V 64/X86-32
Stars: ✭ 3,332 (+11006.67%)
Mutual labels:  risc-v
Platformio Core
PlatformIO is a professional collaborative platform for embedded development 👽 A place where Developers and Teams have true Freedom! No more vendor lock-in!
Stars: ✭ 5,539 (+18363.33%)
Mutual labels:  risc-v
Maxine Vm
Maxine VM: A meta-circular research VM
Stars: ✭ 274 (+813.33%)
Mutual labels:  risc-v
Firesim
FireSim: Easy-to-use, Scalable, FPGA-accelerated Cycle-accurate Hardware Simulation in the Cloud
Stars: ✭ 415 (+1283.33%)
Mutual labels:  risc-v
Reko
Reko is a binary decompiler.
Stars: ✭ 942 (+3040%)
Mutual labels:  risc-v
Ripes
A graphical processor simulator and assembly editor for the RISC-V ISA
Stars: ✭ 584 (+1846.67%)
Mutual labels:  risc-v
Riscv Cores List
RISC-V Cores, SoC platforms and SoCs
Stars: ✭ 471 (+1470%)
Mutual labels:  risc-v

RISC-V: #/'Alphanumeric Shellcoding

By Hаdrien Ваrrаl, Rémi Géraud-Stewart, Georges-Axel Jaloyan, and David Naccache

This work has been presented at WOOT'19 (paper) and DEFCON27 (slides)

Overview

This tool helps design RISC-V (specifically RV64GC) shellcodes capable of running arbitrary code, whose ASCII binary representation use only letters a–zA–Z, digits 0–9, and either of the three characters: #, /, .

It consists of an alphanumeric (+1 character) unpacker. For any target shellcode (non-alphanumeric), the tool will produce an alphanumeric (+1 character) shellcode with the unpacker and the packed version of your shellcode. Run it on a RISC-V simulator/cpu and enjoy!

For a general introduction on RISC-V shellcoding, you may read the blog post by Thomas Karpiniec.

Folder contents:

  • baremetal: Full source code and QEMU demo for each of the three variants
  • fedora: Demos running on Fedora on QEMU
  • hifiveu: Demos running on the HiFive-Unleashed board
  • payload: Source code of the payloads used
  • lists: How we generated the available instructions
  • scripts / tools: Various helpers

Quick-try

Building the shellcodes requires to build a RISC-V toolchain from source. We only provide easy-to-test pre-built baremetal shellcodes.

The only prerequisite is having a RISC-V QEMU v4.0.0 or newer https://www.qemu.org/

Then:

  • cd riscv-alphanumeric-shellcoding/baremetal/prebuilt
  • cat hash.bin (optional, to print the shellcode)
  • sh launch_hash use Ctrl+A then X to exit
  • cat slash.bin (optional, to print the shellcode)
  • sh launch_slash use Ctrl+A then X to exit
  • cat tick.bin (optional, to print the shellcode)
  • sh launch_tick use Ctrl+A then X to exit

Building && Testing

Start by cloning the repository:

git clone https://github.com/RischardV/riscv-alphanumeric-shellcoding.git
cd riscv-alphanumeric-shellcoding

Prerequisites:

/!\ Warning: unless you are using a rolling-release distribution, you probably will not be able to simply install packages. You will need to install yourself the tools below:

QEMU bare-metal shellcodes

  • Build the instructions lists (takes some time)
    • cd riscv-alphanumeric-shellcoding/baremetal/lists
    • make
  • Build the shellcodes
    • cd riscv-alphanumeric-shellcoding/baremetal/hash
    • make
    • cd riscv-alphanumeric-shellcoding/baremetal/slash
    • make
    • cd riscv-alphanumeric-shellcoding/baremetal/tick
    • make
  • Run the shellcodes
    • cd riscv-alphanumeric-shellcoding/baremetal/hash
    • cat shellcode.bin (optional, to print the shellcode)
    • sh l use Ctrl+A then X to exit
    • cd riscv-alphanumeric-shellcoding/baremetal/slash
    • cat shellcode.bin (optional, to print the shellcode)
    • sh l use Ctrl+A then X to exit
    • cd riscv-alphanumeric-shellcoding/baremetal/tick
    • cat shellcode.bin (optional, to print the shellcode)
    • sh l use Ctrl+A then X to exit Expected results: The string "Hello, world!" should print on the screen.

QEMU Linux shellcodes

Prerequisites: A Fedora 28 Linux image running in a QEMU riscv environment (see here and here).

  • Build the shellcodes
    • cd riscv-alphanumeric-shellcoding/fedora
    • make
  • Run the shellcodes
    • Start your Fedora RISC-V virtual machine

    • From the host: Send the compiled files riscv-alphanumeric-shellcoding/fedora/{out,build/vuln.bin} to the virtual machine (e.g. using scp)

    • On the guest Fedora VM: run the shellcodes using:

      • Hello word shellcodes:
        • ./vuln.bin < out/hello_hash.txt for the 'hash' flavored shellcode
        • ./vuln.bin < out/hello_slash.txt for the 'slash' flavored shellcode
        • ./vuln.bin < out/hello_tick.txt for the 'tick' flavored shellcode

      Expected results: the string "Hello, world from shellcode!\n" should print on stdout

      • Execve /bin/sh shellcodes:
        • (cat out/shell_hash.txt; echo ""; cat) | ./vuln.bin for the 'hash' flavored shellcode
        • (cat out/shell_slash.txt; echo ""; cat) | ./vuln.bin for the 'slash' flavored shellcode
        • (cat out/shell_tick.txt; echo ""; cat) | ./vuln.bin for the 'tick' flavored shellcode

      Expected results: a shell should spawn with no prompt. To test it, type any command (e.g. id) and press enter. To exit the shell, type exit and then press enter.

      • Printing /etc/shadow shellcodes:
        • ./vuln.bin < out/shadow_hash.txt for the 'hash' flavored shellcode
        • ./vuln.bin < out/shadow_slash.txt for the 'slash' flavored shellcode
        • ./vuln.bin < out/shadow_tick.txt for the 'tick' flavored shellcode

      Expected results: the contents of the shadow file should be printed on stdout

      • Custom payloads (section 5.3 of the paper). You may modify the payload located in the riscv_alphanumeric/payload directory.

HiFive Unleashed Linux shellcodes

Prerequisites:

Running instructions are very similar to QEMU Linux shellcodes above. Refer to them.

Documentation

Our academic paper gives a lot of details about design choices. We encourage you to read it if you want to understand how the code works.

Link to paper

License

This tool is released under MIT license. See LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].