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

Web滲透技巧(上)

Lionbug
October 01, 2016

 Web滲透技巧(上)

The Declaration of Hacker (TDOH) WorkShop

Lionbug

October 01, 2016
Tweet

More Decks by Lionbug

Other Decks in Research

Transcript

  1. HTTP Request GET /index.php HTTP/1.1 Host: lionbug.tw User-Agent: Mozilla/5.0 (Windows

    NT 10.0; WOW64; Trident/7.0; rv:11.0) Accept: text/html,application/xhtml+xml,application/xml;q=0.9 Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Connection: keep-alive
  2. HTTP GET Request GET /index.php HTTP/1.1 Host: lionbug.tw User-Agent: Mozilla/5.0

    (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) Accept: text/html,application/xhtml+xml,application/xml;q=0.9 Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Connection: keep-alive
  3. HTTP OPTIONS Request SUCCESS HTTP/1.1 200 OK Allow: OPTIONS, TRACE,

    GET, HEAD, POST Server: Microsoft-IIS/7.5 Public: OPTIONS, TRACE, GET, HEAD, POST X-Powered-By: ASP.NET
  4. HTTP OPTIONS Request Failed HTTP/1.1 200 OK Date: Thu, 29

    Sep 2016 07:43:10 GMT Server: Apache
  5. HTTP Request URI GET /index.php HTTP/1.1 Host: lionbug.tw User-Agent: Mozilla/5.0

    (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) Accept: text/html,application/xhtml+xml,application/xml;q=0.9 Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Connection: keep-alive
  6. HTTP Request URI • /index.php • /upload/ • /blog/1 •

    /index.php/blog/1 • ../../../../../etc/passwd
  7. HTTP Request Version GET /index.php HTTP/1.1 Host: lionbug.tw User-Agent: Mozilla/5.0

    (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) Accept: text/html,application/xhtml+xml,application/xml;q=0.9 Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Connection: keep-alive
  8. HTTP Request Version • ଉ憎粚๜ • 1.0 • 1.1 •

    Host • Connection: Keep-Alive • 2.0 • HTTP2.0ܐᦓᤩ฿4ӻṛܧ笙၏牧 ݢ膌๐ۓ瑊ૄმ(Freebuf)
  9. HTTP Request Header GET /index.php HTTP/1.1 Host: lionbug.tw User-Agent: Mozilla/5.0

    (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) Accept: text/html,application/xhtml+xml,application/xml;q=0.9 Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Connection: keep-alive
  10. Requests User-Agent • User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0;

    rv:11.0) • 战ग़翕ᒊ螡䢔珊匍獉਻ • Shellshock (bash CVE-2014-6271) • () { :; }; ping -c 5 lionbug.tw • …
  11. Requests Accept 疑碢 • Accept: text/html; • Accept-Language: zh-TW,zh; •

    Accept-Encoding: gzip, deflate • Accept-Ranges: bytes=0-1 • …
  12. HTTP Status Code HTTP/1.1 200 OK Date: Wed, 25 May

    2016 11:48:22 GMT Server: Apache Content-Length: 72 Connection: close Content-Type: text/html
  13. HTTP Status Code • 1xx ૪ᤩ矑ݑ牧襑ᥝ媣媲蒂ቘ • 2xx ૪౮ۑᤩ֑๐瑊矑硩牏ቘ薹牏㪔矑ݑ •

    3xx 制眲嘨አ㬵᯿碝疩ݻ牧盅媲ጱ藶穩֖࣎ • 4xx դ蔭ԧአ䜛ᒒ፡蚏㬵ݢ胼咳ኞԧ梊藮牧ঘ繸 ԧ֑๐瑊ጱ蒂ቘ • 5xx ֑๐瑊ࣁ蒂ቘ藶穩ጱ螂纷Ӿ磪梊藮౲ᘏ吖ଉ 制眲咳ኞ
  14. HTTP Status Code • 200 OK • 3xx • 301

    Moved Permanently • 302 Found • 4xx • 401 Unauthorized • 403 Forbidden • 500 Internal Server Error
  15. HTTP Response Header HTTP/1.1 200 OK Date: Wed, 25 May

    2016 11:48:22 GMT Server: Apache Content-Length: 72 Connection: close Content-Type: text/html
  16. ֵአ૪Ꭳ笙၏زկ • A9 - Using Components with Known Vulnerabilities •

    ଉ憎笙၏ॺկ • FCKeditor, CKeditor • WordPress or Plugin • WPScan
  17. ᪜ᒊٛݷ藶穩 • A8 – Cross Site Request Forgery (CSRF) •

    藶穩ےӤtoken • 蝐抓牫᯿ᗝੂ嘨牫 • <img src=“http://lionbug.tw/newpass?pass=123”>
  18. 耬੝ۑ胼羷獨ጱਂ玲矒ګ • A7 – Missing Function Level Access Control •

    /admin/upload.php • .git .svn • index.php~ • robots.txt
  19. robots.txt # robots.txt to deny the robots access User-agent: *

    Disallow: /admin Disallow: /admin.ex Disallow: /config
  20. 犋吚ጱਞ獊奲眲戔ਧ • A5 – Security Misconfiguration • ୧ੂ嘨? admin? root?

    1234? • port • 3306 mysql • 6379 redis • 8081 tomcat • …
  21. 犋ਞ獊ጱᇔկ㷢ᘍ • A4 – Insecure Direct Object References • ଘᤈ稗褖

    • /?stuid=u9823001 • /cgpwd.php?username=admin&pass=1234 • /delete.php?id=123
  22. Facebook Fixes Vulnerability That Led to Account Takeover, Pays Researcher

    $16K https://threatpost.com/facebook-fixes-vulnerability-that- led-to-account-takeover-pays-researcher-16k/120688/
  23. Security Researcher Discovers Bug That Would Let Hackers Delete Any

    Photo Off Facebook https://techcrunch.com/2013/09/02/security-researcher-discovers- bug-that-would-let-hackers-delete-any-photo-off-facebook/
  24. ०硳ጱ涢挨膏蝫娄ᓕቘ • A2 – Broken Authentication and Session Management •

    Session and Cookie • Cookie • admin=0; • user=21232f297a57a5a743894a0e4a801fc3; • HMAC ?? • …
  25. ဳ獈硭䢗 • A1 – Injection • ဳ獈圵觊 • SQL Injection

    • Code Injection • Command Injection • LDAP Injection • …
  26. user.php?id=1 SELECT id, name, password From member Where id =

    1 id name password 1 admin asdxcx 2 lin 5657 3 jhe 123 4 lionbug qwe
  27. user.php?id=1 or 1=1 SELECT id, name, password From member Where

    id = 1 Or 1=1 id name password 1 admin asdxcx 2 lin 5657 3 jhe 123 4 lionbug qwe id name password 1 admin asdxcx 2 lin 5657 3 jhe 123 4 lionbug qwe
  28. Login SELECT … Where name = ‘admin’ AND password =

    ‘asdxcx’ id name password 1 admin asdxcx 2 lin 5657 3 jhe 123 4 lionbug qwe id name password 1 admin asdxcx 2 lin 5657 3 jhe 123 4 lionbug qwe id name password 1 admin asdxcx 2 lin 5657 3 jhe 123 4 lionbug qwe
  29. Login SELECT … Where name = ‘admin’ or 1 =

    1 -- ‘’ AND password = ‘’ id name password 1 admin asdxcx 2 lin 5657 3 jhe 123 4 lionbug qwe id name password 1 admin asdxcx 2 lin 5657 3 jhe 123 4 lionbug qwe id name password 1 admin asdxcx 2 lin 5657 3 jhe 123 4 lionbug qwe id name password 1 admin asdxcx 2 lin 5657 3 jhe 123 4 lionbug qwe
  30. == TRUE FALSE 1 0 -1 "1" "0" "-1" NULL

    array() "php" "" TRUE TRUE FALSE TRUE FALSE TRUE TRUE FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE TRUE FALSE TRUE TRUE FALSE TRUE 1 TRUE FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE 0 FALSE TRUE FALSE TRUE FALSE FALSE TRUE FALSE TRUE FALSE TRUE TRUE -1 TRUE FALSE FALSE FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE "1" TRUE FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE "0" FALSE TRUE FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE "-1" TRUE FALSE FALSE FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE NULL FALSE TRUE FALSE TRUE FALSE FALSE FALSE FALSE TRUE TRUE FALSE TRUE array() FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE "php" TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE "" FALSE TRUE FALSE TRUE FALSE FALSE FALSE FALSE TRUE FALSE FALSE TRUE