Bulletproof’s range of cyber security, data protection and compliance services are your best defence against threats to your business. With nearly a decade of providing trusted security services, we’re continuing our mission of solving the greatest cyber security & compliance challenges through innovation and simplicity. Explore our range of services and find out how Bulletproof can help your business.
Helping people solve their security challenges is what we do, so we’re always keen to hear from you.
Find out more about penetration testing – what it is, when you need it, and why it’s a core component of any business. Discover how pen test helps with compliance, powers best practices, and helps your organisation win new business.
Get peace of mind that your data protection is being managed by trusted, certified consultants. All Bulletproof data protection services are delivered by our highly trained, experienced and qualified staff.
Go beyond compliance with information security services that are designed to give real operational benefits to your business. All delivered by seasoned, certified Bulletproof security consultants.
No matter what your cyber or compliance challenges, Bulletproof is here to help. We like to work with you as a trusted partner to solve problems, not sell services. No pressure tactics and no false promises.
At Bulletproof we love to solve problems with simplicity & innovation. It’s our mission to make compliance & cyber security services accessible to all. We take pride in building and nurturing teams of exceptional talent, so we’re confident that our cyber security & compliance services are the best way to stay one step ahead of the hackers and protect your business.
Helping people solve their security challenges is what we do, so we’re always keen to hear from you, no matter what you have to say.
Keiran Mather
Bulletproof red team demonstrate a novel approach to evade static analysis in Linux malware.
Read More
Recently, Bulletproof’s pen testers participated in the Hack the Box Business CTF 2022 competition. This was a global InfoSec contest that pitted cyber security teams against one another in a series of hacking challenges, based on real-world vulnerabilities.
There were 8 categories which included challenges of varying skill levels for teams to apply their hacking expertise to ‘capture the flag’. To complete each challenge, teams had to find a way to exploit a weakness, or a series of vulnerabilities, in order to capture the flag.
In this blog, we focus on PhishTale – a challenge based on finding and exploiting vulnerabilities in a web application. We explain what the challenge entailed and how our team successfully solved this task. So, without further ado, let's begin!
Prior to each challenge, players receive a description of the task. This may include a subtle suggestion to guide teams, such as the use of the HTTP/2 protocol to exploit a vulnerability.
The difficulty level for this challenge was set as Moderate. However, only 24 out of 656 companies managed to successfully capture the flag, including our team.
Here’s what we had to do:
Recently we identified a host matching a threat actor's TLS certificate facing the public internet. It contains an open-source phishing kit builder, so we have the source of the application at hand. We need you to get access to their server so that we can uncover their campaigns.
Note: The host uses an HTTP/2 protocol with a self-signed certificate, so you must visit the host with the https:// protocol and accept the self-signed certificate to access.
The description of the challenge mentioned that the host uses the HTTP/2 protocol. This was an indication that one of the vulnerabilities we had to exploit would require the utilisation of the HTTP/2 protocol. Teams were also given the files to accompany the PhishTale challenge, which made it easier to analyse and debug.
To begin with, certain files had been provided to each team in order to run the challenge locally on their machines, to investigate the task further.
By running the provided shell script, we were able to build the docker image and run the application.
After running the application, we were greeted with the login page.
Access to the application was gained by providing the almighty admin:admin credentials. The credentials were hardcoded in the application's files (/challenge/.env).
If they were not, they could've been brute forced using various tools. However, in this case we found the credentials by following a trial-and-error approach.
Once we gained access to the application, we noticed that it was a phishing framework that could be used to create phishing campaigns.
The application also had export functionality. However, this could only be used via localhost.
However, it could also be verified by looking at the /config/default.vcl file, which is a configuration file for Varnish. Varnish Cache is essentially a reverse proxy for caching HTTP.
By analysing the provided Dockerfile, we noticed that the Varnish version used by the application was outdated and affected by a request smuggling vulnerability (CVE-2021-36740). Based on publicly available information, when HTTP/2 is enabled, an attacker could bypass Varnish Configuration Language (VCL) access controls by sending a large Content-Length header as part of an HTTP POST request. This made sense as the challenge description contains a note regarding the utilisation of HTTP/2.
The payload, shown in the screenshot below, was then used to verify the existence of the request smuggling vulnerability.
By monitoring the web server logs, we observed that our request was smuggled.
During the exploitation phase, we needed to craft a payload in order to bypass the Access Control Lists (ACL) that were enforced by Varnish. Then, we needed to use the application’s export functionality to generate and export a phishing campaign.
Please note that the value of the PHPSESSID session cookie should be valid for the request to be processed by the application.
The final payload is shown below:
By analysing the web server logs, we could see that our request was smuggled, and the application responded with a 302 redirect.
The next step was to find the location of the generated phishing template. This was achieved by analysing the files provided, as shown below:
After identifying the location of the phishing template as /static/exports/phishtale.zip, we proceeded with downloading the file.
After investigating the downloaded files, we observed that the values we passed as part of the query string parameters during the request smuggling attack were included in the generated template.
By looking at the TemplateGenerator.php file, we could see that the parameter values are passed to Twig – an open-source template language for PHP. >
The following payload was submitted to verify whether the application is vulnerable to Server-Side Template Injection (SSTI).
An SSTI occurs when an attacker uses native template syntax, to inject a malicious payload into a template. SSTI vulnerabilities can expose web applications to a variety of cyber attacks, including Remote Code Execution (RCE). >
The generated template was re-downloaded, and we noticed that the template expression was evaluated by the application.
We then attempted to gain Remote Code Execution, which is how an attacker could remotely execute malicious code on a computer, by using the following payload:
However, by observing the web server logs, we noticed that this was unsuccessful since Twig was running in a sandbox and ‘filter’ was not permitted.
However, upon closer inspection, we observed from the composer.json file that the Twig version used by the application was slightly outdated (for example, 3.3.7), and affected by the vulnerability CVE-2022-23614.
The following payload was then used to execute arbitrary commands on the system hosting the application:
Finally! We got RCE!
The following screenshots show the final payload we used to successfully capture the flag:
That concludes the PhishTale challenge from the 2022 Hack the Box Business CTF competition, that was all about discovering and exploiting weaknesses in a web application.
We thoroughly enjoyed solving this challenge as it presented us with a real-world scenario that we would often encounter when exploiting vulnerabilities in web applications. Kudos to the author of the PhishTale challenge!
Stay tuned for more technical overviews of the challenges we faced during the Hack the Box Business CTF 2022 competition.
As a Penetration Testing Manager, Jason is the go-to guy for blogs about ethical hacking, vulnerabilities and what businesses can do about them. When he's not writing blogs, Jason is busy driving innovation through developing new ethical hacking services.
Learn how our innovative cyber services can make solving your security challenges both simple and cost-effective. Schedule a free consultation with a Bulletproof security expert today.
If you are interested in our services, get a free, no obligation quote today by filling out the form below.
I'd like to receive Bulletproof communications about relevant services and events
For more information about how we collect, process and retain your personal data, please see our privacy policy.