Posts

API - JWT Validation

Image
JWT Token Validation. 1. Tamper the Username from alex to alex2. Tamper with the username value. 2. Verify the removal of the signature validation of the JWT token. 3. Modify the algorithm of JWT. 4. Verify the weak security algorithm. 5. Brute force the sensitive paths in the JWT path location. url/v1/ BFLA (Broken Function Level Authorization) Step 1: Create the user name as Alex2 and log in as the Alex user. Step 2: Modify the JWT token for Alex in the alex2 account and change the username from alex2 to Alex. Step 3: Successfully placed the order in the Alex2 account using Alex's user details. BOLA (Broken Object Level Authorization) Step 1: Perform the directory enumeration using FFuF. Step 2: Find the sensitive path location to grab a lot of users' orders details. Step 3: Now log in as the Alex user and access the order details means accessing unauthorized user details in the application(IDOR).

API - No SQL Injection

Image
  "abc123" != "0"  Hence the statement is turn to TRUE executeable. MongoDB accepts operator objects ( $ne ) inside queries. The Core Reason: MongoDB allows special operator objects such as: $ne (not equal)  $gt , $lt $regex $or $in  Vulnerable Code (because user input is passed directly) // ❌ VULNERABLE app.post("/login", async (req, res) => {     const user = await db.collection("users").findOne({         name: req.body.name,         password: req.body.password     });     if (user) res.send("Logged in!");     else res.send("Invalid credentials"); }); Why this is vulnerable Because MongoDB allows operators like: { "$ne": "0" } { "$gt": "" } { "$regex": ".*" } { "$or": [...] } { "$in": [...] } 1. If the attacker sends JSON instead of a string: {   "name": "jeremy",   "password": { "$ne":...

API - SQL Login Page Bypass

Image
SQL - Login Page Bypass with Logical Operator OR Condition. Vulnerable Query: SELECT * FROM users WHERE username = '$username'   AND password = '$password'; Payload 1 - $password = 'a ' or 1=' 1'   =>   Payload === >   a' or 1='1 Payload 2 - $password = 'a ' or 1=1#'   => Payload ====> a' or 1=1#' SELECT * FROM users WHERE username = 'someone'   AND password = 'a' OR 1=1#'; Mitigation: 1. Use Prepared Statements / Parameterized Queries $username = "alice";   // Using dynamic variable $stmt = $pdo->prepare("SELECT id, password_hash FROM users WHERE username = ?");  //Without concatenate the two values (AND). $stmt->execute([$username]); $row = $stmt->fetch(); Sample Payload Inject: $username = "alice' OR 1=1 --"; Sample Output: SELECT id, password_hash FROM users WHERE username = 'alice\' OR 1=1 --';    //Non-execution Query & It's t...

API - Injection Module

Image
    UNION-Based Attack: Union-based attack should be the same no of columns matched with the database. For this purpose, we have to use a NULL statement to complete all the columns. Using FFuF Tool

API - Brute Force using FFuF

Image
Tool Used: FFuF The screenshots below show us how to perform the brute force in an effective and faster manner to get the results.