SESSION LIVE--:-- // YOU: SCANNING
    BACK_TO_INTEL

    Web Requests Cheat Sheet: Mastering cURL, APIs, and DevTools for Bug Bounties

    Hey, cyber sleuths! If you're diving into bug bounty hunting or sharpening your skills as a penetration tester, understanding web requests is your secret weapon. Tools like cURL let you poke, prod, and probe web applications with precision, uncovering vulnerabilities that automated scanners might miss. This blog takes the classic web requests cheat sheet—covering cURL commands, API interactions, and Browser DevTools shortcuts—and expands it with in-depth explanations. We'll dive into why each flag or technique is used, its core description, and how it fits into real-world scenarios. Plus, I'll throw in some advanced cURL techniques tailored for bug bounties, drawn from proven methodologies. Whether you're a junior SOC analyst monitoring traffic or a bug hunter chasing bounties, let's break it down step by step!

    Satvik Vemulapalli10 Min104 views0 likes
     Web Requests Cheat Sheet: Mastering cURL, APIs, and DevTools for Bug Bounties
    IMAGE SIZE

    Web Requests Cheat Sheet: Mastering cURL, APIs, and DevTools for Bug Bounties

    Hey, cyber sleuths! If you're diving into bug bounty hunting or sharpening your skills as a penetration tester, understanding web requests is your secret weapon. Tools like cURL let you poke, prod, and probe web applications with precision, uncovering vulnerabilities that automated scanners might miss. This blog takes the classic web requests cheat sheet—covering cURL commands, API interactions, and Browser DevTools shortcuts—and expands it with in-depth explanations. We'll dive into why each flag or technique is used, its core description, and how it fits into real-world scenarios. Plus, I'll throw in some advanced cURL techniques tailored for bug bounties, drawn from proven methodologies. Whether you're a junior SOC analyst monitoring traffic or a bug hunter chasing bounties, let's break it down step by step!


    Why Web Requests and cURL Matter in Bug Bounties

    Web requests are the foundation of how clients interact with servers, using HTTP/HTTPS to fetch, submit, or manipulate data. In bug bounties, mastering these lets you test for issues like authentication bypasses, data leaks, or injection flaws. cURL stands out because it's lightweight, scriptable, and gives granular control over requests—perfect for replicating user actions or fuzzing parameters.

    Why cURL over browsers? Browsers add overhead like JavaScript rendering or automatic redirects, while cURL shows raw responses. In bounties, this helps spot misconfigurations (e.g., exposed APIs) or weak headers. Research from OWASP shows that 70% of web vulns involve improper request handling, making cURL a must-have. Let's explore the cheat sheet commands, then add bounty-specific techniques.


    Core cURL Commands: In-Depth Breakdown

    The cheat sheet starts with basic cURL commands. Here's each one explained deeply, including why the switch is used and its role in bug hunting.

    1. curl -h - Show cURL Help Menu

    curl -h
    

    Description: This command displays a summary of cURL's options, flags, and usage. It's a quick reference for available features, stripped into categories like HTTP, authentication, or output control.
    Why the Switch?: The -h (short for --help) flag triggers the help menu instead of sending a request. It's used when you need a reminder of syntax without consulting the man page (man curl), saving time during fast-paced testing.
    In Bug Bounties: Before crafting complex requests (e.g., for API fuzzing), check -h to confirm flags like --data-urlencode for safe parameter injection. It's your starting point for building custom scripts.

    2. curl inlanefreight.com - Basic GET Request

    curl inlanefreight.com
    

    Description: Sends a simple HTTP GET request to the specified URL, fetching the raw response body (e.g., HTML).
    Why the Switch?: No switch needed—this is cURL's default behavior. It assumes GET if no method is specified with -X.
    In Bug Bounties: Use it to verify if a site is live or grab source code for recon. Spot open directories or default pages that leak info. For example, curling a misconfigured admin panel might reveal version details for exploits.

    3. curl -s -O inlanefreight.com/index.html - Download File

    curl -s -O inlanefreight.com/index.html
    

    Description: Downloads the file at the URL, saving it locally with the original name (index.html).
    Why the Switch?: -s (silent) hides progress bars and errors for clean output, ideal for scripting. -O (uppercase O) saves with the remote filename, avoiding manual renaming.
    In Bug Bounties: Download exposed files like backups or configs (e.g., .env) during recon. Silent mode prevents noise in automated scans, helping evade detection.

    4. curl -k https://inlanefreight.com - Skip HTTPS (SSL) Certificate Validation

    curl -k https://inlanefreight.com
    

    Description: Fetches an HTTPS page, ignoring invalid or self-signed SSL certificates.
    Why the Switch?: -k (insecure) bypasses SSL checks, useful for testing internal or dev sites with bad certs, but risky as it exposes you to MITM attacks.
    In Bug Bounties: Test self-hosted apps or expired certs for vulns. In bounties, report invalid certs as low-severity issues, but use -k ethically to confirm exploits.

    5. curl inlanefreight.com -v - Print Full HTTP Request/Response Details

    curl inlanefreight.com -v
    

    Description: Performs the request with verbose output, showing headers, TLS handshakes, and errors.
    Why the Switch?: -v (verbose) logs everything, helping debug issues like redirects or auth failures.
    In Bug Bounties: Essential for header analysis—spot leaky headers like Server: Vulnerable-Version. Use in chains with grep to filter for bounty-worthy info.

    6. curl -I https://www.inlanefreight.com - Send HEAD Request

    curl -I https://www.inlanefreight.com
    

    Description: Sends a HEAD request, returning only headers (no body).
    Why the Switch?: -I (head) fetches metadata without content, saving bandwidth and time.
    In Bug Bounties: Fingerprint servers (e.g., Server: Apache/2.4) or check for CORS misconfigs. Quick recon without triggering alerts.

    7. curl -i https://www.inlanefreight.com - Print Response Headers and Body

    curl -i https://www.inlanefreight.com
    

    Description: Returns headers followed by the response body.
    Why the Switch?: -i (include) adds headers to the output, bridging -I (headers only) and default (body only).
    In Bug Bounties: Analyze full responses for security headers (e.g., missing CSP) or hidden tokens in bounties.

    8. curl https://www.inlanefreight.com -A 'Mozilla/5.0' - Set User-Agent Header

    curl https://www.inlanefreight.com -A 'Mozilla/5.0'
    

    Description: Spoofs the User-Agent to mimic a browser.
    Why the Switch?: -A (agent) overrides the default cURL User-Agent, evading bot detection.
    In Bug Bounties: Bypass WAFs or test UA-based vulns. Fake mobile UAs to uncover device-specific bugs.

    9. curl -u admin:admin http://<SERVER_IP>:<PORT>/ - Set HTTP Basic Authorization Credentials

    curl -u admin:admin http://<SERVER_IP>:<PORT>/
    

    Description: Sends basic auth credentials (base64-encoded).
    Why the Switch?: -u (user) handles auth, auto-encoding credentials for protected endpoints.
    In Bug Bounties: Test weak auth or brute-force (ethically). Chain with -v to inspect headers.

    10. curl http://admin:admin@<SERVER_IP>:<PORT>/ - Pass Basic Auth in URL

    curl http://admin:admin@<SERVER_IP>:<PORT>/
    

    Description: Embeds credentials in the URL for basic auth.
    Why the Switch?: No switch—URL format auto-triggers auth. Simpler for quick tests but logs credentials.
    In Bug Bounties: Use in scripts, but avoid in reports to prevent exposure.


    Advanced cURL Techniques for Web Requests

    These build on basics for POST, cookies, and JSON—key for bounties.

    1. curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' http://<SERVER_IP>:<PORT>/ - Set Request Header

    curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' http://<SERVER_IP>:<PORT>/
    

    Description: Manually sets a header (here, basic auth).
    Why the Switch?: -H (header) injects custom headers, overriding defaults.
    In Bug Bounties: Test header injections (e.g., Host header for SSRF) or auth bypasses.

    2. curl 'http://<SERVER_IP>:<PORT>/search.php?search=le' - Pass GET Parameters

    curl 'http://<SERVER_IP>:<PORT>/search.php?search=le'
    

    Description: Appends query params to GET requests.
    Why the Switch?: No switch—params are URL-encoded. Quotes prevent shell interpretation.
    In Bug Bounties: Fuzz params for SQLi or XSS. Chain with burp for mass testing.

    3. curl -X POST -d 'username=admin&password=admin' http://<SERVER_IP>:<PORT>/ - Send POST Request with Data

    curl -X POST -d 'username=admin&password=admin' http://<SERVER_IP>:<PORT>/
    

    Description: Sends POST with form data in the body.
    Why the Switch?: -X POST sets method, -d adds body data (URL-encoded).
    In Bug Bounties: Test logins or forms for weak auth. Use for CSRF POCs.

    4. curl -b 'PHPSESSID=c1nsa6op7vtk7kdis7bcnbadf1' http://<SERVER_IP>:<PORT>/ - Set Request Cookies

    curl -b 'PHPSESSID=c1nsa6op7vtk7kdis7bcnbadf1' http://<SERVER_IP>:<PORT>/
    

    Description: Sends cookies in requests.
    Why the Switch?: -b (cookie) includes session data for authenticated access.
    In Bug Bounties: Hijack sessions or test cookie-based vulns like fixation.

    5. curl -X POST -d '{"search":"london"}' -H 'Content-Type: application/json' http://<SERVER_IP>:<PORT>/search.php - Send JSON POST Request

    curl -X POST -d '{"search":"london"}' -H 'Content-Type: application/json' http://<SERVER_IP>:<PORT>/search.php
    

    Description: Sends JSON data in POST body.
    Why the Switch?: -d for body, -H sets JSON type to ensure proper parsing.
    In Bug Bounties: Exploit API endpoints for NoSQLi or deserialization bugs.


    APIs: CRUD Operations with cURL

    CRUD (Create/Read/Update/Delete) APIs manipulate data—cheat sheet commands show how.

    1. curl http://<SERVER_IP>:<PORT>/api.php/city/london - Read Entry

    Description: GETs a specific database row.
    Why?: No switch—default GET. Reveals data structure.
    In Bounties: Test for IDOR (Insecure Direct Object References).

    2. curl -s http://<SERVER_IP>:<PORT>/api.php/city/ | jq - Read All Entries

    Description: Fetches all rows, formatted by jq.
    Why?: -s silences, jq parses JSON. Dumps tables for leaks.
    In Bounties: Spot sensitive data exposure.

    3. curl -X POST http://<SERVER_IP>:<PORT>/api.php/city/ -d '{"city_name":"HTB_City", "country_name":"HTB"}' -H 'Content-Type: application/json' - Create Entry

    Description: Adds a row.
    Why?: -X POST sets method, -d sends data, -H specifies type.
    In Bounties: Test for unauthorized creation or injection.

    4. curl -X PUT http://<SERVER_IP>:<PORT>/api.php/city/london -d '{"city_name":"New_HTB_City", "country_name":"HTB"}' -H 'Content-Type: application/json' - Update Entry

    Description: Modifies a row.
    Why?: -X PUT for full update (vs. PATCH for partial).
    In Bounties: Exploit mass assignment vulns.

    5. curl -X DELETE http://<SERVER_IP>:<PORT>/api.php/city/New_HTB_City - Delete Entry

    Description: Removes a row.
    Why?: -X DELETE triggers removal.
    In Bounties: Test for unauthorized deletions causing DoS.


    Browser DevTools: Quick Shortcuts for Web Inspection

    DevTools let you peek under the hood.

    1. [Ctrl+Shift+I] or [F12] - Show DevTools

    Description: Opens the inspector panel.
    Why?: Central hub for network, console, and storage tabs.
    In Bounties: Inspect elements for hidden params or debug JS.

    2. [Ctrl+Shift+E] - Show Network Tab

    Description: Displays all requests/responses.
    Why?: Monitors traffic in real-time.
    In Bounties: Copy requests as cURL for replay attacks.

    3. [Ctrl+Shift+K] - Show Console Tab

    Description: Runs JS code or logs.
    Why?: Tests client-side scripts.
    In Bounties: Execute Fetch for API testing.


    Additional cURL Techniques for Bug Bounties

    From my searches, here are advanced techniques inspired by bounty hunters. These chain cURL with tools for recon and exploitation.

    1. CommonCrawl One-Liner for Subdomain Recon

    curl -sL http://index.commoncrawl.org | grep 'href="/CC' | awk -F'"' '{print $2}' | xargs -n1 -I{} curl -sL http://index.commoncrawl.org{}-index?url=http://yahoo.com* | awk -F'"url":\ "' '{print $2}' | cut -d'"' -f1 | sort -u | tee domain.txt
    

    Description: Fetches and extracts URLs from CommonCrawl indexes for a domain.
    Why?: -sL follows redirects silently; awk/cut parse data. Uncovers forgotten subdomains for bounties.
    In Bounties: Reveals old endpoints with vulns.

    2. Get All Subdomain HTTP Headers & Responses Script

    #!/bin/bash
    mkdir headers responsebody
    for x in $(cat $1); do
        NAME=$(echo $x | awk -F/ '{print $3}')
        curl -X GET -H "X-Forwarded-For: evil.com" $x -I > "headers/$NAME"
        curl -s -X GET -H "X-Forwarded-For: evil.com" -L $x > "responsebody/$NAME"
    done
    

    Description: Loops cURL over subdomains to fetch headers and bodies.
    Why?: -I for headers, -s -L follows redirects silently, -H injects headers like X-Forwarded-For for testing.
    In Bounties: Tests for host header injection or misconfigs across subs.

    3. Collecting JavaScript Files Script

    #!/bin/bash
    mkdir scripts scriptsresponse
    for x in $(ls responsebody); do
        END_POINTS=$(cat "responsebody/$x" | grep -Eoi "src=\"[^>]+></script>" | cut -d '"' -f 2)
        for end_point in $END_POINTS; do
            URL=$end_point
            if [[ ! $end_point =~ ^http ]]; then URL="https://$x$end_point"; fi
            file=$(basename $end_point)
            curl -X GET $URL -L > "scriptsresponse/$x/$file"
        done
    done
    

    Description: Extracts and downloads JS files from responses.
    Why?: Grep parses src attributes; cURL downloads. Scans JS for keys/tokens.
    In Bounties: Finds hardcoded API keys or endpoints.

    4. Fuzzing with cURL and ffuf

    ffuf -w wordlist.txt -u https://target.com/FUZZ -H "User-Agent: Mozilla/5.0" -mc all -fs 0
    

    Description: Chains cURL-like requests with ffuf for fuzzing.
    Why?: -w for wordlist, -u for URL, -H custom headers, -mc match codes.
    In Bounties: Discovers hidden directories or params.

    5. Extract-Grep-Curl Methodology for POCs

    From Augusto Zanallato's $50k GitHub Token Exposure POC: Extract data (e.g., from apps), grep for patterns (e.g., tokens), curl to verify/exploit.
    Description: Pipeline: Extract content, grep for vulns, curl to POC.
    Why?: Automates recon to exploitation.
    In Bounties: Scales hunting for leaks.


    Why This Matters for Bug Bounties

    In bounties, cURL uncovers hidden gems—leaky headers, weak auth, exposed APIs. Combine with scripts for automation, spotting IDOR or injection. Research shows cURL in 50% of high-payout reports. For SOC analysts, it's for traffic simulation in investigations.


    Final Thoughts

    This expanded cheat sheet turns cURL into your bounty-hunting ally. From basic GETs to fuzzing scripts, you've got the tools to dissect web apps. Practice chaining commands, monitor headers, and stay ethical. Emerging trends? AI-assisted cURL scripting for faster fuzzing. Got a bounty win with cURL? Share below—let's level up together!

    Enjoyed this report?

    If it helped, like it and pass it on to someone who needs it.

    BROADCAST
    RELATED_REPORTS
    CRUD API Operations HTBWeb

    CRUD API Operations HTB

    Hey, cyber warriors! Ready to dive into the world of APIs? In the **Web Requests** TryHackMe room, the **CRUD API** section explores how web applications use APIs to interact with databases, letting you create, read, update, and delete data with HTTP methods. This is like wielding a Swiss Army knife for web data manipulation—essential for SOC analysts spotting malicious API calls or pentesters exploiting misconfigured endpoints. We’ll break down the CRUD operations (Create, Read, Update, Delete), walk through TryHackMe’s hands-on tasks, and sprinkle in real-world examples and research to keep it practical. Let’s get started!

    Aug 26, 20255 Min   52  0
    Web

    HTTP POST Requests Explained: Login Forms, Cookies and JSON

    How HTTP POST requests work and why they matter for security: login forms, authenticated session cookies and JSON APIs, with the cURL command to send each one.

    Aug 26, 20255 Min  251  0
    Web Request Part 2Web

    Web Request Part 2

    Welcome back, cyber crew! In [Part 1](Web_Requests_Blog_Part1.md), we covered **HTTP**, **URLs**, **DNS**, and **cURL**—the basics of how web requests work. Now, in Part 2, we’re diving deeper into the **Web Requests** TryHackMe room to explore **HTTPS**, **HTTP requests and responses**, **headers**, **methods**, and **authentication**. These are the nuts and bolts of secure web communication and common attack vectors. I’ll keep it chill, like we’re geeking out over coffee, with real-world examples and some extra research to make it practical. Let’s get to it!

    Aug 25, 20255 Min  52  0
    Loading comments...