<?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 Tan Kee Hock on Medium]]></title>
        <description><![CDATA[Stories by Tan Kee Hock on Medium]]></description>
        <link>https://medium.com/@keehock.tan?source=rss-5f8dda219b06------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*g2fDoXBwOBRwU9xLdcWxeg.jpeg</url>
            <title>Stories by Tan Kee Hock on Medium</title>
            <link>https://medium.com/@keehock.tan?source=rss-5f8dda219b06------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 12:03:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@keehock.tan/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[Let’s try to crack some AWS credentials]]></title>
            <link>https://medium.com/csg-govtech/lets-try-to-crack-some-aws-credentials-e2fb5359ef3b?source=rss-5f8dda219b06------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2fb5359ef3b</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[govtech]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[sharing]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Tan Kee Hock]]></dc:creator>
            <pubDate>Thu, 03 Jun 2021 02:57:33 GMT</pubDate>
            <atom:updated>2021-07-09T04:13:16.399Z</atom:updated>
            <content:encoded><![CDATA[<p><em>In this article, we will do a deep dive into the security credentials of Amazon Web Services (AWS) and examine the feasibility of cracking them.</em></p><p>Programmatic access allows AWS users to interact with AWS resources through a custom application or a third-party tool. An example of how developers can use AWS’ programmatic access is through the AWS Command Line Interface (CLI), a tool that enables developers to manage multiple AWS services from the command line and automate them through scripts.</p><p>To use programmatic access, you will require the AWS security credentials that typically consist of the AWS Access Key ID, AWS Secret Access Key and, at times, AWS Session Token (only used for temporary security credentials).</p><h3>Components of AWS security credentials</h3><p>Security credentials interest cybersecurity professionals, and we naturally want to investigate their robustness. We begin by examining the structure of these AWS security credentials (using Regular Expressions):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*5wNV0NymhzmS4wNKLx7FMg.png" /><figcaption>Check it out on <a href="https://regexr.com/5sbjm">regexr</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*LRWaHpOYPKQcpGrKa2ecqw.png" /><figcaption>Check it out on <a href="https://regexr.com/5sbkb">regexr</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*lTjKszpjCiKfo_2g5ZV_-A.png" /></figure><p><em>Taking reference from </em><a href="https://summitroute.com/blog/2018/06/20/aws_security_credential_formats/"><em>Summit Route</em></a><em>.</em></p><p>By simply examining the structure of the security credentials, we know that it is computationally expensive to launch brute force attacks on these credentials. In addition, authentication with AWS Security Token Service (STS) Endpoints is required to validate the authenticity of the security credentials. This implies significant network costs (including the time required to send HTTP/HTTPS requests to and from the STS Endpoints).</p><p>This article examines if brute force attacks using computational resources from Cloud Service Providers like AWS itself, can compromise these security credentials.</p><h3>Background</h3><p>It may be difficult to crack AWS security credentials from a blank state by using brute force attacks, given the huge character set. Potential risks are often due to compromised or leaked AWS security credentials, or publicly exploitable web applications (Server-Side Request Forgery) that result in credentials theft — not many security risks are linked to the security of these credentials.</p><p>Nonetheless, there is not much information available that sheds light on the extent of resources needed to conduct such attacks on AWS security credentials. Hence, we will experiment and base our attack on a fictional scenario from “The Broken User” Capture The Flag (CTF) challenge.</p><h4><strong>“The Broken User” Capture The Flag Challenge</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*IVlGFd9QB65rUGJKBKE7-g.png" /><figcaption><a href="https://tvd.dev/defcon28-cloud-village-ctf-writeup.html">Source</a></figcaption></figure><p>The scenario assumes that one has an incomplete set of AWS Security Credentials, particularly the AWS Access Key. The rest of the article details the experiment where we performed brute force attacks to discover the missing character(s) in the AWS Access Key. To ease the experiment setup, we use “The Broken User” CTF challenge as the backstory, where the last set of characters of the AWS Access Key is missing.</p><p>Sample AWS Access Key format where <em>X </em>denotes the missing characters:</p><p>AKIARJFBAG3EGHFG<strong><em>XXXX</em></strong></p><p><em>There are 4 missing characters in the above AWS Access Key.</em></p><p>We computed the number of combinations for each missing character, where ‘combination’ refers to the sequence of characters in the AWS Access Key (with reference to the CTF challenge).</p><p><strong>Character Space</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*_awQkMjxfxtuC3QSSFD8vg.png" /><figcaption>Overview of the combinations for each (N) missing characters</figcaption></figure><p>No doubt, we can simply run a script and wait for the results to be revealed. However, as enthusiastic engineers, we would like to understand the mechanics behind brute force attacks on AWS security credentials (in this case, the AWS Access Key) and how we can meaningfully solve this challenge! As such, the best way to learn is to experiment!</p><h3>Experiment Design</h3><h4>Objective</h4><p>The experiment aims to investigate the <strong>feasibility of conducting brute force attacks on AWS </strong>credentials (focusing on AWS Access<strong> </strong>Key with reference to the CTF challenge); and the optimisation considerations, if necessary, such as evaluating the use of AWS Security Token Service (STS) Virtual Private Cloud (VPC) Endpoint at the macro configuration (AWS resources) level. In this experiment, feasibility is defined as the “ability to guess the missing character(s) within an acceptable time period and cost”.</p><p>From our initial research, we identified that key parameters such as regional endpoints, HTTP instead of HTTPS, etc. could improve the efficiency of the brute force attack but could not determine the same for STS VPC Endpoint.</p><p>Thus, we had to:</p><ol><li>Investigate the impact of the STS VPC Endpoint configuration</li><li>Uncover other observable parameters (at AWS level configurations)</li></ol><p>Lastly, with our reasonably optimised setup incorporating the findings above, we attempted to investigate how long it will take to conduct a brute force attack on four to six missing characters in the AWS Access Key within 30 instances (<em>a sample size of 30 is meaningful in most statistical analyses</em>).</p><p><em>Let </em><strong><em>N</em></strong><em> be the number of missing characters for the brute force attack on the AWS Access Key. Let </em><strong><em>cracking</em></strong><em> </em><strong><em>speed</em></strong><em> be the Number of Access Keys tested (rounded down to nearest whole number) per second.</em></p><p><em>The learnings and codes from this experiment can be similarly applied to other types of attacks using AWS infrastructures, such as enumeration of AWS IAM Role ARNs, brute force attacks on AWS S3 buckets, or other forms of attacks that require significant computational work. What we have developed is simply a template and the attack design; it is up to the security researcher to apply and observe how various attacks are made more efficient with such designs.</em></p><h4>Configuration</h4><p>Terraform is used to deploy the relevant resources, including the provision of the required IAM role. The repository can be found <a href="https://github.com/tankeehock/brute-forcing-on-aws">here</a>. An overview of the computing resources deployed using the Terraform script is shown here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*BtJmW21kzbdOrrU7Zy0urA.png" /><figcaption><em>A sample overview of 30 EC2 instances being deployed.</em></figcaption></figure><p>The Terraform script deployed EC2 instance(s) (as specified) in a custom VPC with a custom security group attached. Terraform enabled changes to be made easily in the configuration of the experiment. The Terraform script will upload a custom application to S3 to be downloaded and executed (via user data) by the EC2 instance(s). Various configurations can be found in “configurations.tfvars” in the repository.</p><p><strong>EC2 Instance Configuration</strong></p><p>In this experiment, the EC2 instance (t2.micro) used the Amazon Linux 2 AMI (HVM), with SSD Volume Type (ami-0d5eff06f840b45e9) within the us-east-1a availability zone of the us-east-1 (N. Virginia) region. The custom security group is configured to allow SSH (typically used for troubleshooting) connections only. The EC2 instance is assigned an IAM role with the necessary permissions configured.</p><p><strong>Custom Application</strong> <em>(referred to as the “cracker”)</em></p><p>The <a href="https://github.com/violenttestpen/aws-key">custom application</a>, designed and built by my colleague <a href="https://www.linkedin.com/in/winstonhmk/">Winston Ho</a>, is written in Golang. Subsequently, I added an SMS notification feature (using AWS SNS) and a combination allocation logic to this reasonably optimised application.</p><p>(Kudos to Winston, who did most of the heavy lifting for this application! Do let us know if there are areas of improvement — we did the best as amateur software engineers)</p><p>The following outlines our key considerations when designing this application:</p><ol><li>Use of goroutines and channels</li><li>Use of HTTP whenever possible to reduce the overhead from HTTPS</li><li>Target regional STS Endpoint</li><li>Effectively determine which combinations to work on — In consideration of coordination with other EC2 instances to increase overall performance (i.e. time taken to find the Access Key)</li><li>Randomise the allocated combinationsDoes not require any other dependencies to execute the <em>cracker</em> — This eases the deployment process</li><li>Memory and CPU are efficient — We are likely using small EC2 instances with limited memory and CPU</li></ol><p>The SMS notification feature enabled us to work on other tasks while waiting for the EC2 instances to perform the brute force attacks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*thvLfgVnivstvXan29MYqQ.png" /><figcaption>The Sender ID (“cracker-poc”) can be configured in AWS SNS.</figcaption></figure><p><em>Do note that the Terraform script provided does not configure the SNS SMS preferences. It uses the default setting which is limited to 20 SMSes only. To conduct this experiment, we requested AWS for an increase in the SMS limit, to which they responded promptly (within 24 hours).</em></p><p><strong>Experiment Assumptions and What Is Not Covered</strong></p><p>To avoid unnecessary scope creep and dilute the objective of the experiment, the experiment did not cover micro-level optimisation, such as the type of EC2 instance used, the number of instances of the <em>cracker </em>within the EC2 instance, the number of workers within the <em>cracker</em>, the exponential backoff logic, and more.</p><h3>Experiment Results</h3><h4><strong>Investigating the impact of the STS VPC Endpoint configuration</strong></h4><h4><strong>Using a Single EC2 Instance</strong></h4><p><strong>Test Case 1: All possible combinations (worst case scenario)</strong></p><p><em>Objective: To estimate the time taken for brute force attacks on varying length of missing characters in the AWS Access Key</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*E2lUVJ9rnNX37DSnIVd7nw.png" /></figure><p>While the VPC STS Endpoint did not show positive results at this stage, the small sample size of 1 was insufficient to conclude the usefulness of the VPC STS Endpoint in brute force attacks.</p><p><strong>Test Case 2*: Randomised combinations</strong></p><p><em>*The difference between Test Case 1 and Test case 2 is that the cracker stops upon discovery of the correct AWS Access Key.</em></p><p><em>Objective: To investigate the effectiveness of randomised combinations for brute force attacks on varying length of missing characters in the AWS Access Key</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*_R51MvcRSfN3R8v2noJTYQ.png" /></figure><p>Randomising the allocated combinations significantly improved the efficiency of brute force attacks (as compared to Test Case 1).</p><h4>Using Multiple EC2 Instances</h4><p><strong>Test Case 3: All possible combinations (worst case scenario) with five instances</strong></p><p><em>Objective: To investigate the time taken for brute force attacks for five missing characters when coordinated among five EC2 instances</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*tHcFxLyBlxJM_A2z6w45vw.png" /></figure><p>There was no clear indication of better or poorer performance with the use of STS VPC Endpoint. Statistical analysis is required (which brings about Test Case 4).</p><p>In addition, the cracking speed dropped significantly with a larger combination space which suggests that rate-limiting / throttling controls (“throttling” in short) were in place. Each node should not cross a certain cracking speed. However, it is not within the scope of the experiment to determine when will throttling controls kick in.</p><p><strong>Test Case 4: All possible combinations (worst case scenario) with 30 instances</strong></p><p><em>Objective: To investigate if the use of VPC STS Endpoint improves the efficiency of the operations via statistical tests</em></p><p><em>To ensure a fairer statistical analysis, the total number of AWS Access Keys tested per node is kept constant, which means that the last node will not perform brute force attacks on the outstanding Access Key(s).</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*LjVGN82Jr4Z-2LMKRnbgew.png" /></figure><p>With VPC STS Endpoint</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*4u4vKDjMdlKdifOmucqxOQ.png" /><figcaption><em>Summary of data collected from 30 instances and the estimated cracking speed</em></figcaption></figure><p>Without VPC STS Endpoint</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*qV3V4eZcjwebEVXRaJUFqw.png" /><figcaption><em>Summary of data collected from 30 instances and the estimated cracking speed</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*vDU8V3ikrwQCGZvaYXEK9A.png" /></figure><p>The VPC STS Endpoint caused improvements in the cracking performance, as shown by the statistical analysis.</p><blockquote>Additional observation — When performing brute force attacks against STS endpoints from the EC2 instance, we observed that cracking speed increases significantly when the infrastructure is deployed in the “us-east-1” region as compared to “ap-southeast-1”.</blockquote><h4>Investigating the time needed for brute-force attacks to decipher four to six characters in the AWS Access Key with 30 instances</h4><p>Based on our findings, VPC STS endpoints improved the cracking performance and will be used in this test. The test was also conducted without the fair-distribution flag to ensure all combinations were attempted. Thus, the last node is likely to be allocated with a few more Access Keys for brute force attacks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*qc56bhRmsb6lLbdJUs3znA.png" /><figcaption><em>When the number of missing characters increased to six, significantly greater resources (both money and time) are needed to complete the experiment. Micro-level optimisation will be required to allow the experiment to be done at a more reasonable cost.</em></figcaption></figure><p><strong>Brute force attacks targeting six missing characters failed to complete</strong></p><p>Unfortunately, when the experiment was conducted with 30 EC2 instances to decipher six missing characters, the network traffic (egress and ingress) and CPU utilisation from the EC2 instances dropped significantly after 10 minutes. Let us examine the charts on one of the EC2 instances:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*IqxrVMNeVhVZDH1faMh3Rg.png" /><figcaption>Network — Ingress</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*y5XVe2ESrjzPR7Pyrzm_uw.png" /><figcaption>Network — Egress</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*y_RkKQm2hLialsuNijQQ-Q.png" /><figcaption>CPU Utilisation</figcaption></figure><p>From the three charts above, the drop in metrics occurred around the same time. A closer look at the incoming network traffic revealed an approximate 87% drop in network traffic entering the EC2 instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*Qrj0pHzT8NUwG5ivLAOrjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*xDNcmVmJCI6qZ6QMZDE87g.png" /></figure><p>In fact, the EC2 instances ran for days without any sign of completion. Thus, we decided to terminate the experiment for this test case. The brute force attacks may have failed to complete due to throttling, but more investigation is required to account for the drop in the three metrics.</p><p>Here are some AWS-specific documents on throttling related topics:</p><p>● <a href="https://docs.aws.amazon.com/STS/latest/APIReference/CommonErrors.html">AWS Documentation — STS API Reference, Common Errors</a></p><p>● <a href="https://forums.aws.amazon.com/message.jspa?messageID=817557">Discussion on STS API Request Limits in AWS Forum</a></p><p>● <a href="https://docs.aws.amazon.com/general/latest/gr/api-retries.html">AWS Documentation — Error Retries and Exponential Backoff</a></p><p><em>However, do note that developing controls or logic such as exponential backoff to manage throttling complicates the design of the experiment and will not be covered in this article.</em></p><p>We noticed that the average cracking speed per node, based on the combined cracking speed for 30 nodes when N=4, was significantly lower than what was observed in Test Case 1 (when N=4). This seems to suggest the maximum request made to STS endpoints is around 1 million within a short period of time. Any more requests are likely to trigger the throttling controls. Another possible improvement would be to implement exponential backoff logic in the brute force attack to manage the throttling effects.</p><h4>Estimated resources needed for brute force attacks to decipher six missing characters and above</h4><p>The earlier findings provided an approximated cracking speed which we used to estimate the time needed to conduct brute force attacks to decipher missing characters of greater length. The estimation is tabulated below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*jbEqnamKnvyIJn_LCghA_A.png" /><figcaption><em>Assumption: Throttling controls will not get stricter than what was observed</em></figcaption></figure><p>As observed in the table, the amount of computational resources needed to continue the experiment increases exponentially (32 times more per missing character). Once we have reached 10 missing characters, we would have cracked only half of the total potential combinations of the AWS Access Key!</p><h3>Conclusion</h3><p>I believe we have completed the CTF challenge by now. In fact, we probably over-engineered the solution. However, we brought the research further by experimenting on a larger number of missing characters and figuring out additional variables to make brute force attacks more bearable.</p><p>We observed that performing brute force attacks for up to five missing characters in the AWS Access Key can be done within an acceptable time frame (and within our limited budget). As the number of missing characters in the AWS Access Key increased from five to six, the attack was significantly harder to complete. The main bottleneck was likely due to the throttling controls on the STS endpoint. In our experiment, we did not purposefully evaluate the throttling allowance. We observed that an allocation of around 1 million combinations per node was close to triggering the throttling control. Anything more will likely cause the overall performance of the brute force attack to drop.</p><p>Hence, it would be fair to conclude that AWS security credentials are a challenge to crack, especially when you are starting from a blank slate. The security considerations are well-thought and it is <strong>not feasible to conduct brute force attacks on AWS credentials.</strong></p><p>In practice, it is rare for one to be required to crack the security credentials in incomplete states (e.g. incomplete data extraction via forensics techniques). Nonetheless, the learnings from this experiment allowed us to solidify design considerations when using AWS to build tools for cybersecurity-related objectives. The codes and work here can be adapted and applied to other concepts, such as S3 bucket brute force attacks. In real-world scenarios, the repackaging of these codes will be incredibly useful. Hence, do take this as a starter template! Perhaps, someone will build upon our findings by researching the ideal “cracking” speed or figuring out how to work around the throttling controls bottleneck.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2fb5359ef3b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/csg-govtech/lets-try-to-crack-some-aws-credentials-e2fb5359ef3b">Let’s try to crack some AWS credentials</a> was originally published in <a href="https://medium.com/csg-govtech">CSG @ GovTech Singapore</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s Up With The Craze Surrounding Capture-The-Flag (CTF) Competitions?]]></title>
            <link>https://medium.com/csg-govtech/whats-up-with-the-craze-surrounding-capture-the-flag-ctf-competitions-fb68c57fa803?source=rss-5f8dda219b06------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb68c57fa803</guid>
            <category><![CDATA[stack-the-flags]]></category>
            <category><![CDATA[csg]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[govtech]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Tan Kee Hock]]></dc:creator>
            <pubDate>Tue, 27 Oct 2020 08:57:10 GMT</pubDate>
            <atom:updated>2020-10-28T05:19:15.666Z</atom:updated>
            <content:encoded><![CDATA[<h4>You might have heard the term Capture-the-Flag (CTF) while interacting with your fellow peers in cybersecurity. For folks in the cybersecurity industry, the mantra when talking about CTFs tends to be “sleep, hack, repeat”. If you have no idea what a CTF is or have trouble understanding why we go “crazy” for an activity that consumes our waking hours, then this is the article for you. By the end of this post, I hope you better understand what a CTF is and will even be enticed to join one!</h4><p><em>For my fellow cybersecurity practitioners and enthusiasts, do bear with me as I induct everyone else into the world of CTFs. </em><strong><em>I have a pleasant surprise for everyone at the end of this article. 😉</em></strong></p><h3>What is a CTF competition?</h3><p>Outside the world of cybersecurity, CTF is a game where opposing teams will try to capture a literal flag — either a common flag or your opponent’s — and return it to their base. So, extrapolate this concept, give it a digital spin, and you can begin to imagine what a cybersecurity CTF looks like! Instead of capturing a physical flag, participants are tasked with capturing a digital flag. A digital flag comes in many forms — such as a simple sequence of characters hidden within systems. In order to capture the flag, participants will have to rely on their knowledge of system vulnerabilities and exploit them in order to get the system to divulge its secrets.</p><p>For example, a CTF organiser may hide the flag within a database. In order to retrieve the flag, participants have to identify vulnerabilities in the web application that communicates with the database. The participants will then have to exploit the vulnerability in order to exfiltrate the flag!</p><p>The above is just one example; there are a thousand and one ways to set up these challenges as CTF competitions often cover more than one cybersecurity domain. There is also an increasing trend of challenges relating to niche topics such as autonomous vehicle hacking and even lock picking!</p><h3>What are the different types of CTFs?</h3><p>CTF competitions may be conducted in various formats. Two of the more common formats are “Jeopardy Style CTF” and “Attack and Defense CTF”.</p><p><strong>Jeopardy Style CTF</strong></p><p>The Jeopardy Style CTF format is perhaps the most popular CTF format out there. Participants are presented with various cyber challenges from different domains such as Reverse Engineering, Binary Exploitation, Open Source Intelligence, etc. In some cases, challenges can even be theoretical questions. In most cases, however, participants often have to perform the actual “hacking” within the provisioned environment.</p><p>It is common for challenges to be linked to one another. For instance, participants are only presented with Challenge B after they have solved Challenge A. Subsequent challenges tend to increase in difficulty.</p><p>Participants score points by submitting the captured flag to the scoring platform upon successful completion of a challenge. Naturally, the more complicated the challenge, the more points scored by the participants after solving it. The participants with the most points scored within the time limit will be declared the winner!</p><p><strong>Attack and Defense CTF</strong></p><p>Now let’s look at an Attack and Defense CTF and how it differs with a Jeopardy Style CTF. For one, participating teams have their own network with systems running vulnerable services to defend, while working to compromise the other teams’ systems. In short — to defend one’s own system(s), the team has to patch their services as soon as possible; to attack, the team needs to develop exploits to attack the other teams’ vulnerable system(s).</p><p>Points are awarded to teams if they stave off opposing teams’ attacks or if they are able to bring down opposing teams’ systems. Additional tasks may be introduced during the competition to offer teams a chance to gain additional points — this is of course dependent on the competition. Similar to Jeopardy-style, the winner is the team that scores the most points within the time limit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*EG5by25wak2FxkYEhL0MbA.png" /><figcaption>Hacker cat in action!</figcaption></figure><p>If you’re curious to learn about other CTF formats like King of the Hill and Linear style CTF, you can find out more from <a href="https://ctf.zone/ctfinfo.html">this link</a>.</p><h3>Why join CTFs?</h3><p>There are many reasons why people devote their time to cycles of sleep and hacking as they partake in CTF competitions. One main reason is to learn. CTFs are a very good way for a person to gauge their understanding of a domain and how they fare against fellow hackers within the community. It is a common practice for participants to blog about their experiences after solving the challenges. This way, members of the cybersecurity community can learn from one another. It is even more common for your hacker friends to be avid followers of blogs of their favourite hackers. Talk about being fanboys!</p><p><em>You can read about my team’s experience participating in the </em><a href="https://holidayhackchallenge.com/2019/"><em>2019 SANS Holiday Hack Challenge</em></a><em> </em><a href="https://medium.com/csg-govtech/sans-holiday-hack-challenge-2019-postmortem-part-1-976b52122931"><em>here</em></a><em> and </em><a href="https://medium.com/csg-govtech/sans-holiday-hack-challenge-2019-postmortem-part-1-976b52122931"><em>here</em></a><em>.</em></p><p>Another reason why people join CTFs is to establish themselves within the cybersecurity community. Some are attracted by the prize money! For example, the <a href="https://www.hackasat.com/">Space Security Challenge 2020: Hack-A-Sat</a> CTF organised by the United States’ <a href="https://www.afrl.af.mil/">Air Force Research Laboratory</a> offered a grand prize of USD$50,000 (SGS$67,828)! <a href="https://capturetheflag.withgoogle.com/">Google’s CTF</a> prize is also attractive, with the top bounty for their Qualification Stage set at USD$13,337 (SGD$18,092)!</p><p>Personally, I would encourage budding cybersecurity enthusiasts to participate in CTFs for the learning experience. The bounty, while unquestionably attractive, is just a bonus. To sustain your interest in cybersecurity, it’s best to participate in CTFs with the mindset to learn. This helps to cultivate good learning habits and ensure that one’s passion is not extinguished simply due to the lack of material gain. Sustaining one’s interest in cybersecurity is ultimately the most important thing; only by staying long in this field can one attain the knowledge and competencies to become a formidable hacker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*rLhJpJ3b2mW0gJfRWB42Dg.png" /><figcaption>The right mindset!</figcaption></figure><p>Increasingly, experience in CTF competitions is being used as a proxy indicator of technical competency. As such, do not be surprised should you come across CTF-related requirements in cybersecurity job descriptions. Some the leading technology firms already include CTF experience as part of their preferred qualifications for candidates when hiring cybersecurity professionals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*ejsrQRABSPMwI6QUECjR4g.png" /><figcaption><a href="https://www.amazon.jobs/en/jobs/1164503/penetration-testing-engineer"><em>Here’s an example of an opening for Penetration testing Engineer where one’s Capture The Flag experience comes into use!</em></a></figcaption></figure><h3>How do I prepare for CTFs?</h3><p>The key is to just keep “hacking”! In fact, there are plenty of resources available online to learn more about “hacking”. Some platforms even offer free access to their environment where you can practice “hacking”!</p><p>Let me share some of the free resources that we cybersecurity practitioners frequent:</p><p>· Hack The Box — <a href="https://hackthebox.eu/">https://hackthebox.eu</a></p><p>· Try Hack Me — <a href="https://tryhackme.com/">https://tryhackme.com</a></p><p>· VulnHub — <a href="https://vulnhub.com/">https://vulnhub.com</a></p><p>In my own cybersecurity journey, I have seen friends start off with no prior education in cybersecurity and emerge as some of the best hackers I know! These readily available resources made by the cybersecurity community support such transitions. Even if you are new, that does not mean that you cannot learn your way to becoming a “pro”. The key is to just get started!</p><p>These platforms provide a target for you to practice “hacking”. Some of these targets are Open Source contributions made by the cybersecurity community, with articles guiding you to solve these “boxes” by the community as well. With strong communal support, you can easily “hack” and learn on your own.</p><p>Alternatively, you can simply enter a CTF competition. This is a good step towards continuous improvement! Check out <a href="https://ctftime.org/">CTFtime</a> — they have a huge index on global CTF competitions. As most CTF competitions are free to join, just sign up and get your feet wet! All you need is a laptop and you are set. Just remember — when choosing a CTF competition, be mindful of which demographic the competition is intended for. Some CTF competitions are <a href="https://picoctf.org/">organised specially for students</a>, while others are <a href="https://oooverflow.io/">targeted at cybersecurity professionals</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*W89sbkRRq9fkdURIgXbsPw.png" /><figcaption><em>Screenshot from </em><a href="https://ctftime.org/"><em>CTFtime </em></a><em>information on CTF competitions worldwide.</em></figcaption></figure><p>There is no golden rule to win a CTF competition. This is because there are many different domains to compete in. That in itself is the very thrill of a CTF! An interesting point to highlight — winning teams in CTF competition are usually well-balanced, comprising members who excel in a certain area. Each team member tends to be very passionate about their area of expertise. From reading CTF writeups to technical blogs by cybersecurity companies, members of CTF-winning teams often retain a keen awareness of the latest cybersecurity developments in their area of expertise.</p><p>It is through venturing into the unknown that we learn and grow as cybersecurity practitioners. The journey, not the destination, makes it worthwhile! Rarely does one succeed on their first attempt. CTF winners have experienced repeated failures in such events before landing their first win. The only real “trick” is to be persistent. As one accumulates experience, each CTF attempt becomes “less painful” over time.</p><h3>Now for the surprise… Introducing: STACK the Flags!</h3><p>Now as promised before, it’s time for the surprise!</p><p>I’m delighted to announce that GovTech’s Cyber Security Group (CSG) is organising their first-ever Jeopardy Style CTF in the first week of December 2020! This will take place just after <a href="https://www.stack.gov.sg/">STACK 2020</a> — the largest government-led developers’ event in Singapore. As indicated by the name, we’re inviting you to STACK as many flags as you can! All you need is a laptop with a working internet connection. There is no reason to be worried if you don’t have any experience with CTF competitions, this CTF is intended for both experienced and lesser-experienced cyber enthusiasts to have a great time “hacking”.</p><p>My team was inspired to organise a CTF because 2020 has frankly been a hard year with the COVID pandemic giving everyone a tough time. So, my team came together and thought: what could we do to cap off a challenging, socially-distanced year that will be meaningful for the cybersecurity community? As most of us enjoy participating in CTF competitions, this was an unmissable opportunity for us to bring the cybersecurity community together for 48 hours of hacking fun over the first weekend of December.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GUegb2vcQ9fa1pTpwVuorQ.png" /><figcaption>Get ready to STACK the Flags!</figcaption></figure><p>Excited yet? Check out the official STACK the Flags 2020 CTF website for more information:<a href="https://ctf.tech.gov.sg/"> https://ctf.tech.gov.sg/</a></p><p>We will be releasing more information and sign-up details on the competition very soon.</p><p>See you then! <em>#hackyeah</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb68c57fa803" width="1" height="1" alt=""><hr><p><a href="https://medium.com/csg-govtech/whats-up-with-the-craze-surrounding-capture-the-flag-ctf-competitions-fb68c57fa803">What’s Up With The Craze Surrounding Capture-The-Flag (CTF) Competitions?</a> was originally published in <a href="https://medium.com/csg-govtech">CSG @ GovTech Singapore</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SANS Holiday Hack Challenge 2019 Postmortem — Part 2]]></title>
            <link>https://medium.com/csg-govtech/sans-holiday-hack-challenge-2019-postmortem-part-2-1ef746d0ea8?source=rss-5f8dda219b06------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ef746d0ea8</guid>
            <category><![CDATA[govtech]]></category>
            <category><![CDATA[sharing]]></category>
            <category><![CDATA[csg]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Tan Kee Hock]]></dc:creator>
            <pubDate>Fri, 17 Apr 2020 14:04:34 GMT</pubDate>
            <atom:updated>2020-05-12T07:02:09.206Z</atom:updated>
            <content:encoded><![CDATA[<h3>SANS Holiday Hack Challenge 2019 Postmortem — Part 2</h3><p>We hope you enjoyed Part 1 of this two part series that covered how the team used an <a href="https://medium.com/csg-govtech/sans-holiday-hack-challenge-2019-postmortem-part-1-976b52122931">SQL injection to uncover a mystery</a>! If you haven’t already, read the article for interesting learning points such as how the “UpdateXML” function can be used to perform unauthorised information disclosure.</p><p>In Part 2, we’d like to share more about a web terminal challenge called the “Holiday Hack Trail”. In this game, your aim is to move your character over a certain distance before Christmas Day! The game contains some common vulnerabilities seen in today’s web applications. If you think you have a flair for white-hat hacking, <a href="https://trail.elfu.org/">give it a go</a> before reading on!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*t6Z5llz3Xg1S8V4wMg3P-w.png" /><figcaption>The Holiday Hack Trail — <em>Try it without referring to this post. No cheating! 😊</em></figcaption></figure><h3>Know Thy Enemy</h3><h4><strong>Cyber Tip #1</strong>: A cybersecurity specialist must <strong>gain a thorough understanding of the matter at hand</strong> before starting the exercise.</h4><p>Let’s examine how the game works:</p><p>First, select the difficulty level: “EASY”, “MEDIUM” or “HARD”. The higher the difficulty, the less money and time that you have to complete the quest. Let’s not be too ambitious and start with the “EASY” mode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*6lKwq4lig0zfRFXPDk3ExQ.png" /><figcaption>Step 1 — Select Difficulty</figcaption></figure><p>Next, you can purchase some equipment to help you in your quest, and click “BUY” to proceed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*XRgMkOvkZNqjycfS0katDQ.png" /><figcaption>Step 2 — Purchase Supplies</figcaption></figure><p>Let’s Play!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*fjQUqBP-JVXvpXXI_ps4OQ.gif" /><figcaption>Step 3: Play the game</figcaption></figure><p>The game begins. To complete the quest, your reindeer must drag the sleigh over an 8000-unit distance. Clicking on the “GO” button moves the sleigh by a small random distance. Playing the game this way will take a few thousand clicks on the “GO” button. This takes too long!</p><p>There must be a way to “GAME” the system!</p><h3>Hack, this is way faster!</h3><p>Now, let’s see how we can complete the game in this seemly impossible setting!</p><p>Reload the game in “EASY” mode. When you reach the game screen, pay attention to the in-game URL bar. The parameters (e.g. distance, money) in the in-game URL bar look familiar — these same variables appear in the game. Clicking on the “GO” button increases the value of the “distance” parameter by a random number. The in-game “Distance Remaining” field, which started at 8000 units, sees a reduction by the same value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/439/1*8UcwHbc9rBVdfPgP6zLOOg.png" /><figcaption>Pay attention to the parameters in the in-game URL</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*xAE-5ST8ybAggJg8T48MSA.png" /><figcaption>The value corresponds with each other!</figcaption></figure><p>This implies that the “distance” parameter in the in-game URL bar stores the value of the distance travelled by the character! Some quick thinking leads us to manipulate the “distance” parameter in the in-game URL bar to trick the game into recognising that the character has travelled an arbitrary amount of distance.</p><p>Since the character will cover a distance of more than 10 units (based on our observations) when we click “GO”, we then change the “distance” parameter to 7990, which indicates that the character has travelled 7990 units. By choosing a value close to 8000, we can ensure that the character is able to cross the finishing line in one turn when we click “GO”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*VZaKiYiKXuepfZxPUKvKqA.gif" /><figcaption>Simply edit the parameter and click “GO”</figcaption></figure><p>Voila! We cleared the “EASY” level simply by manipulating the “distance” parameter.</p><p>This scenario mimics a common issue we see in today’s web applications. To deliver dynamic and user-rich experience, some web application’s response or behaviour may be modified based on user-supplied inputs. Sometimes, these inputs are consumed directly by the web application, without being validated. As a result, unexpected values may cause the web applications to behave in ways they are not supposed to.</p><p>In this case, the “distance” parameter found in the in-game URL bar defines the in-game value of the distance travelled by your character. We can therefore change the distance travelled with our input and complete the game in just one turn.</p><p>There are risks that can arise from the lack of proper validations of user inputs, e.g. Cross Site Scripting (XSS) attacks, SQL Injections, Server-Side Request Forgery (SSRF), to name a few.</p><p><strong>Cyber Tip #2</strong>: Developers <strong>should</strong> <strong>not trust user inputs</strong> to the application and must <strong>always validate the inputs</strong> to ensure that the incoming data conforms to the application’s requirements.</p><h3>Too easy? Try something tougher!</h3><p>Next, let’s attempt the “MEDIUM” difficulty level. This time, the in-game URL bar no longer contains the vulnerable parameter that we manipulated in the “EASY” level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*dgf1WafAIHvxwIIgytETCg.png" /></figure><p>How about the HTTP requests? Could the exploit vector lies in one of the HTTP requests? To examine the HTTP requests fired when navigating the game, we configured the browser to redirect all HTTP traffic through a popular security tool, BurpSuite (I am using the <a href="https://portswigger.net/burp/communitydownload">community edition</a> for this demonstration), before they go out to the internet. We want to examine the HTTP requests fired since the start of the game, and spot suspicious parameters that can potentially be misused to rig the game.</p><p>A couple of HTTP GET and POST requests were fired when loading the game, selecting the difficulty and buying equipment. In fact, the HTTP POST request to the “/trail/” URL looks fishy…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*meppzY3Ih5oE17Lo18tPUw.png" /></figure><p>Expanding the HTTP POST request to “/trail/”, we see the “distance” parameter again. From the “EASY” mode, we now know that the “distance” parameter defines the distance covered by the character and we can complete the game immediately by modifying the value of the “distance” parameter. Now, how do we do that when the HTTP POST request is fired immediately by the game without our knowledge?</p><p>This is where BurpSuite’s “Intercept” feature comes into play. It allows us to intercept the request sent by the application, modify it and forward it to the target. At the equipment purchase screen, we turn on the “Intercept” feature of BurpSuite, change the value of the “distance” parameter to “7990” and forward the traffic out. The in-game value of the “distance travelled” is now set to the value “7990” and clicking on the “BUY” button will complete the game.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*TqKsHM1Weai91OO8_dBzlA.gif" /><figcaption>Intercepting the HTTP POST request and modifying it</figcaption></figure><p>TADA! We’ve completed “MEDIUM” mode in a few clicks!</p><p>Here, we exploit the vulnerable “distance” parameter again. The challenge is spotting the HTTP request that contains this parameter. Attack-proxy tools help us better identify these parameters and modify them to test for vulnerabilities. Similar to the “EASY” mode, the vulnerability is the acceptance of an unverified user input to the value of the “distance” parameter, which defines the in-game value of “distance remaining”.</p><p>It’s common for web applications to fire requests to a backend server to retrieve values or perform certain tasks. With more web applications adopting an API-driven architecture, the front-end application is responsible solely for rich user experience, leaving the backend server to perform the processing. To ensure a seamless user experience, there’s constant interaction between the front-end web application and the backend application.</p><p>While browsers come with “developer” features for visibility of the network traffic from the web application, they do not contain features available in tools like BurpSuite to facilitate the testing. Security professionals (like us!) use these Attack-Proxy tools, like BurpSuite, to assist in testing of these parameters.</p><h3>Difficulty Level: Hard. Challenge Accepted!</h3><p>This is “MEDIUM” mode, with a twist. A similar set of parameters are sent to the same endpoint (“/trail/”), except that the request comes with an additional “hash” parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*OwUVrWByp76xB9YL7EXIjQ.png" /><figcaption>New “hash” parameter</figcaption></figure><p>This prevents us from using the same technique in “MEDIUM” mode, as it returns a “badHash” error message. The server is detecting tampering attempts with the use of the new “hash” parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*1BU2y9HYeOUOh6vd_KvMxw.png" /><figcaption>“badHash” message</figcaption></figure><p>How do we “crack” the “hash” parameter to bypass the system’s anti-tampering mechanism?</p><p>First, use a use a tool (like <a href="https://github.com/blackploit/hash-identifier">BlackPloit’s “hash-dentifier”</a>) to ascertain the type of hash algorithm. You can also check out this <a href="https://www.tunnelsup.com/hash-analyzer/">website</a> that does the same thing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*VjtNHuPHaly7fUo5RovV1g.png" /><figcaption>Output from hash-identifier</figcaption></figure><p>MD5 hash is obsolete by today’s cryptographic standards. In fact, you can easily find the corresponding plaintext value of an MD5 hash online. Sites like <a href="https://hashes.org/">hashes.org</a> allows the community to perform MD5 hash lookups to search for the corresponding plaintext value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*j0xyZvPbswT_KVpDJjgYVQ.png" /><figcaption>Plaintext found</figcaption></figure><p>Our simple search tells us that the MD5 hash has a plaintext value of “1626”. What does this value mean? After spending much time studying the POST request parameters, we observe that the values of certain parameters add up to “1626”. To put that theory to test, we will proceed to modify the parameter value to identify the parameters that affect the hash computation. If the website returns a “badHash” error, the modified parameter is used in its anti-tampering checks.</p><p>Let’s test this out with the “distance” parameter. Modifying its value caused the web application to return a “badHash” error, hence the “distance” parameter is used in the calculation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*9w9VzygGF_s4V2g7Ja22rg.gif" /><figcaption>“distance” parameter is used in the MD5 calculation</figcaption></figure><p>From this, we infer that when the server receives the request, it computes the hash value based on the sum of these parameters. When the newly computed hash value differs from the original in the HTTP POST request, the server detects a tampering attempt and returns a “badHash” error message. We’ve figured out the server’s anti-tampering mechanism!</p><p>Further testing showed that these parameters are used in the calculation of the MD5 hash:</p><p>1. curmonth (9)</p><p>2. curday (1)</p><p>3. money (1500)</p><p>4. distance (0)</p><p>5. ammo (10)</p><p>6. food (100)</p><p>7. runners (2)</p><p>8. reindeer (2)</p><p>9. meds (2)</p><p>You need only identify one vulnerable parameter (“distance”) to complete the exploit, not all. Since we already know that “distance” defines the distance travelled in the game, we can simply modify its value and update the hash value accordingly. Let’s exploit!</p><p>Modify the “distance” parameter to “7990” (the magic number explained earlier), then use an open source tool, e.g. md5sum (a common utility found in most Linux distributions), to generate a new MD5 hash based on the new total value of “9619” (7990 + 1626 = 9616).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*ibmkPi1WstD80ym0JkTIlw.png" /><figcaption>Calculating the new MD5 hash value</figcaption></figure><p>Upon changing the distance parameter and modifying the hash value, we bypass the system’s anti-tampering mechanism. The in-game value can now be modified:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*ZZemQ8zmuvkQQYFSDkpzCg.gif" /><figcaption>Intercepting and modify both the “distance” and “hash” parameters</figcaption></figure><p>We won the game!</p><p>Despite the anti-tampering mechanism in place, we manage to work around it! The underlying vulnerability was the use of a user-supplied input for the anti-tampering checks. To improve this anti-tampering safeguard, the “hash” parameter should not be exposed.</p><p>In this case, there is no need for the web application to send the hash value back to the server since the server already knows the default starting values and hash computation can be done entirely on the server’s end. The server is able to detect any deviation from the expected and return a response accordingly. In fact, there is no need to expose the “distance” parameter at all.</p><h3>(Download these) Learning Points</h3><p>We touched on techniques to manipulate the HTTP GET and POST parameters, which are common injection points that malicious actors exploit when attacking web applications. We’ve also seen how manipulation of parameters sent to the server has allowed us to “game” the system, all because the server trusted the user inputs without proper validation.</p><p>The key takeaway is — from a developer’s perspective — it’s never a good idea to trust user inputs. Developers should always validate user inputs and never let the user control important parameters!</p><p>Participating in Capture-The-Flag competitions like these are not only fun, but allows us to explore new techniques / tools and build a stronger foundation in cybersecurity. Find out more about the challenge and <a href="https://kringlecon2019.redjaga.cf/">our submission</a>.</p><p>We hope this article has helped to spur the inner “hacker” in you! Taking the first step into “hacking” is difficult, but it’s also what defines us.</p><p>So “hack on”! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ef746d0ea8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/csg-govtech/sans-holiday-hack-challenge-2019-postmortem-part-2-1ef746d0ea8">SANS Holiday Hack Challenge 2019 Postmortem — Part 2</a> was originally published in <a href="https://medium.com/csg-govtech">CSG @ GovTech Singapore</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>