• This repository has been archived on 13/Oct/2019
  • Stars
    star
    133
  • Rank 272,600 (Top 6 %)
  • Language
    JavaScript
  • Created over 9 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

JavaScript ROP framework

JuSt-ROP

A framework which lets you directly write dynamic ROP chains in JavaScript before executing them via a browser exploit.

Using JavaScript to write and execute dynamic ROP chains gives us a tremendous advantage over a standard buffer overflow attack.

For one thing, we can read the modules table and calculate the addresses of all gadgets before we trigger ROP execution, bypassing ASLR.

We can also read the user agent of the browser, and provide a different ROP chain for different browser versions.

We can even use JavaScript to read the memory at our gadgets' addresses to check that they are correct.

Writing ROP chains dynamically, rather than generating them with a script beforehand, just makes sense.

Porting to your exploits

All gadgets and chains shown here were tested on PlayStation 4 firmware 1.76. To use this with any other exploit you will need to make several manual tweaks (for 32bit, you should replace things like * 8 with * 4 for example).

Expose the following globally:

  • getU8(address), getU64(address), and setU64(address, value)
  • stackBase
  • returnAddress (so stackBase + returnAddress points to the return value of a function)
  • moduleBases (an array of module base addresses)

Modify the chainAddress declaration to point somewhere suitable for your exploit.

Then place your gadgets in the the gadgets array, using this syntax to declare a gadget:

gadget(instructions, module, address)

For example:

// moduleBases[webkit] is the base address of the webkit module
var webkit = 14;
var libKernel = 1;

var gadgets = {
    "mov [rax], rcx": new gadget([0x48, 0x89, 0x08], webkit, 0x9ecde6),
    "mov [rax], rdx": new gadget([], webkit, 0x3579c0),
    "mov [rax], rsi": new gadget([], webkit, 0x2adea7),
    
    "mov [rdi], rax": new gadget([0x48, 0x89, 0x07], libKernel, 0xb0c8),
}

The instructions parameter is optional, if it is non-empty then the memory at the gadget's pointer will be checked to ensure that it is correct (and followed by a ret instruction).

Usage

Make sure to include just-rop.js before gadgets.js to avoid getting a reference error:

<script type="text/javascript" src="just-rop.js"></script>
<script type="text/javascript" src="gadgets.js"></script>

And what you can do now depends largely on what gadgets you have available, and the system that you are exploiting (sandboxing might disable some system calls for example).

Here's a simple example chain:

var chain = new rop();

try {
    chain.syscall("getpid", 20);
    
    // rax is the return value
    chain.write_rax_ToVariable(0);
    
    chain.execute(function() {
        console.log("PID: " + chain.getVariable(0).toString());
    });
}
catch(e) {
    logAdd("Incorrect gadget address " + e.toString(16));
}

More Repositories

1

FreeDVDBoot

PlayStation 2 DVD Player Exploit
C
2,196
star
2

PS4-SDK

Open source PS4 SDK
C
1,021
star
3

Cinoop

Multiplatform Game Boy emulator
C
493
star
4

PS4-playground

A set of PS4 experiments using the WebKit exploit
JavaScript
251
star
5

3DSController

C
214
star
6

PS2-Yabasic-Exploit

PS2 exploit for demo discs containing Yabasic that allows arbitrary code execution.
Assembly
72
star
7

GameBoy_GhidraSleigh

Ghidra Processor support for Nintendo Game Boy
60
star
8

cturt.github.io

HTML
50
star
9

shogihax

Remote code execution exploit against Morita Shogi 64 for Nintendo 64
C
47
star
10

CFW-Suite

Tools which can be used to create a custom firmware for the Nintendo DS
C
41
star
11

dsgmLib

C
36
star
12

LDFS

OpenGL Windowing System
C
26
star
13

TCP-Dump

Dumps TCP packets
C
19
star
14

NiFiCapture

Capture local wireless 802.11 traffic, 'NiFi', on Nintendo DS
C
14
star
15

WiFi-Loader

Send a file over TCP
C
12
star
16

dsgmDSWiFi

A fork of http://sourceforge.net/projects/devkitpro/files/dswifi/
C
12
star
17

PS4-Pong

Makefile
10
star
18

CTC

Lossless compression algorithm
C
9
star
19

DARA

Collection of save game exploits for FIFA games to run unsigned code on the DS
C
9
star
20

PS4-Loader

C
8
star
21

Exception

Small library for exception handling in C
C
7
star
22

HTTP

Simple HTTP server in C
C
6
star
23

CTC2

Lossless compression algorithm
C
6
star
24

IconExtractor

Extract the icon from a DS ROM
C
6
star
25

bin2u32

Makefile
5
star
26

Preoop

Experimental object orientation for C via the preprocessor
C
4
star
27

ARM-Pong

Makefile
3
star
28

HTTP-client

C
3
star
29

MD2Combiner

Combines all frames from two MD2s into one MD2
C
2
star
30

dsgmGfx

C#
1
star
31

GameOfLifeDS

Makefile
1
star