Resources

People often ask me "How did you learn how to hack?" The answer: by reading. This page is a collection of the blog posts and other articles that I have accumulated over the years of my journey. Enjoy!

D-Link Router CVE-2021-27342 Vulnerability Writeup - 491

Whtaguy    Reference →Posted 4 Years Ago
  • The author is a student at Stanford who is likely living on their own. Because they needed some internet, they bought a new router for the internet but took the opportunity to hack on it.
  • The Telnet service running on the device has brute force protection for somebody trying to brute force a login. This is implemented by delaying the response with a call to sleep (3 seconds) prior to sending an access denied back.
  • The issue is that the correct password only takes 0.05 seconds regardless of how many tries it took. This means that the 3 second wait period does not need to be considered! We only need to wait 0.05 seconds in order to know if it's the proper password or not.

5 things I learned while developing a billing system- 490

Arnon Shimoni    Reference →Posted 4 Years Ago
  • The author of this article joined a FinTech company called Pleo in order to help build out their billing infrastructure. Obviously, billing MUST be done properly and is complicated to do. This article is some notes on weird issues they ran into during the billing creation.
  • Money is not always decimal. What this means is that different countries are charged based upon their currency. The US dollar can have decimals in it ($1.50); but, in Japan, the JPY cannot. In order to handle this, the author used as integers for storage then added the decimal points in later.
  • Another interesting thing is that invoices cannot be cancelled or voided once created in the EU for tracking reasons. Instead, a full credit amount has to be made in order to reverse the invoice.
  • Who would have guessed this one: Not All Billing Systems are Compliant. This causes issues when implementing logic for handling payment platforms. An example is that the VAT number in the EU must be checked before every sale, which Stripe does not do.
  • What happens when a user changes plans? For instance, if a user wants to upgrade a service level in the middle of their free trial. How can this be done without making a messy invoice? Depending on the service, there are an endless amount of ways to change up plans.
  • Customers aren’t companies. They’re people. And different people have different needs. There are a lot of small edge cases that need to be considered. For instance, "Some companies wanted to pay up-front at the end of 2020 for 2021, because they had a leftover budget which couldn’t be used in 2021."
  • From a hackers perspective, I read about the complicated things that developers complain about and see them as good attack vectors. Additionally, understanding more about the system makes it easier to break as well.

Frag Attacks- 489

vanhoefm    Reference →Posted 4 Years Ago
  • WiFi is a large part of every day life. This is a common way that computers of all kinds have internet access. The Wifi protocol being secure is the only thing that isolates the devices in a network from being inaccessible to attackers.
  • By carefully injecting frames unencrypted frames into a WiFi network, it can be used maliciously to break the security of the network. For instance, it could be used in order to trick the client into using a malicious DNS server or bypass NAT/firewall protections.
  • The plaintext injection vulnerability described above can be triggered remotely when an attacker sends a malicious TCP packet as a response to some request from the user. This request can be used to trick WiFi into believing the request is actually a part of a WiFi frame instead of a normal TCP connection. The plaintext injection is a class of vulnerabilities that allow the WiFi to accept broadcast fragments even when sent unencrypted
  • The first vulnerability is in the frame aggregation functionality. In order to increase the throughput of the application, WiFi has the ability to put multiple frames into a larger super frame. In order to do this, there is a header in each frame that contains a flag on whether or not this is a single or aggregated frame.
  • The vulnerability is that the is_aggregated frame flag is NOT authenticated. Hence, a malicious actor can trick the WiFi to processing the transported data in an unintended way. In particular, it can be abused to inject arbitrary frames and the combining of single frames into an aggregated frame. This vulnerability is not an issue with the specification but a common issue with implementation.
  • The second issue is a design flaw in the fragmentation feature of WiFi. When fragmenting a large frame into smaller frames, the data should be encrypted with the same key. However, receivers are not required to check this! So, an attacker could theoretically exfiltrate data this way (even though the author does not explain how).
  • The third issue is a common issue with caching. The fragments are cached whenever they are used. However, an attacker could send a fragmented packet, which may be used by the user later. Again, an attacker could theoretically exfiltrate data this way (even though the author does not explain how).
  • These protocol confusion attacks have been taking off recently. In particular, the re-discovery of HTTP Smuggling and the revamping of the NAT Slipstreaming. This attack also reminded me how important HTTPS can be as a defense-in-depth measure for all sorts of crazy attacks.
  • These findings are extremely impactful and complex in nature. Even though the protocols look secure, there are always ways to poke holes into random backbones of the internet.
  • TODO... add more documentation on how the fragmentation attack works.

Microsoft Azure Privilege Escalation and Leak of Private Data- 488

Paul Litvak - Intezer    Reference →Posted 4 Years Ago
  • Azure VMs are virtual machines running on Microsoft hardware; this is similar to EC2 instances at AWS. This is the essence of cloud computing.
  • Azure VM allows developers and admins to integrate custom plugins in order to add additional components to the VM, such as diagnostics, network watcher and others. These extensions are loaded via the Guest Agent. In order to update itself, the Guest Agent polls the Fabric Controller in order to deploy extensions.
  • The agent communicates with the controller by accessing a local IP address at 168.63.129.16. In order to communicate securely, asymmetric encryption are used. To get the keys to communicate, a Certificate endpoint is used in order to get the keys (cert in the configuration file).
  • By crafting your own key and certificate, the endpoint would simply send the keys over! So, this lack of validation of the user making the call is clear problem, as this leaks some serious information. With these keys, it was possible to decrypt the Azure VM extension configuration files, which sometimes held important secrets.
  • However, the bug above did not work as a non-root user because of IP tables setup to prevent that exact issue! In order to bypass the security mechanism, a different IP was used. The IP 164.254.164.254 was not blocked by the IP tables but resolved to the proper address. That was a really simple bypass!
  • Overall, these were two simple bugs: lack of proper authentication and a poorly implemented denylist. Reversing is sometimes the hard part while the bugs are the easy part.

TBONE – A zero-click exploit for Tesla MCUs- 487

Ralf-Philipp Weinmann & Benedikt Schmotzle    Reference →Posted 4 Years Ago
  • Tesla is a high class and amazingly technical car brand. Finding vulnerabilities in Tesla could potentially lead to stolen property and control over the driving of the car.
  • All Tesla's comes with a hardcoded WiFi SSID that can be connected to. Other researchers had discovered a hardcoded password, which allows anybody to join this WiFi network. This is a vulnerability by itself but just allows the research to be possible.
  • While reversing the Tesla, they found an open source library called Connman that was being used. This application is a lightweight DHCP server and client with a DNS forwarder. Because the parsing in this small module looked poor, they wrote an AFL harness and found several bugs in it quickly.
  • Within the forwarding functionality they got a crash in the uncompress function for backreferencing previous strings of characters to get the new one. This function contains a fixed size memcpy that does NOT check the actual size of the buffer. By creating a very small buffer, this resulted in a stack based buffer overflow.
  • But what about stack canaries!? The exploitation came to a halt because the binary contained stack canaries. There are three options for bypassing the stack canaries: brute force it, leak it or jump over it. It turned out that option 3 (jump over it) was the way to go.
  • The parsing in this function goes in a loop over a set of strings. When it finds a string it will use the string length (calculated by strlen) to iterate the next string pointer. By overflowing directly in front of the canary, the program can be tricked to continually iterate past the expected buffer to jump over the stack canary!
  • By jumping over the stack canary, the return address can be overwritten! This was a super awesome trick that was particular to this situation but worked quite well. Now, we have code execution... but what about ASLR?
  • To break ASLR, a leak was required. This was done by targeting the DHCP implementation .By sending a DHCP packet with no option data, a path was found that assumed this was filled out. Eventually, when this information was sent back, it contained uninitialized memory, resulting in a leak of library addresses and stack addresses.
  • To make this bug more powerful, the length of the domain that is being offered changes the stack address being viewed! By adding this padding, different parts of the stack can be read in order to leak the necessary locations.
  • The full exploit uses the two bugs above to create a ROP chain. This ROP chain marks part of the stack as executable with mprotect then executes some small shellcode. This shellcode loads the second stage shellcode into a heap buffer then executes.
  • The exploit uses a drone. This is because an attacker needs to be near the car in order to attack it. Damn, using a drone to control a Tesla is pretty amazing!
  • The author includes a few pointers at the end:
    • Automotive research is possible without the actual hardware, use emulation!
    • Stack overflows are still a problem despite the mitigations.
    • Understand the bugs you fuzzed. Otherwise, you will miss some amazing gems.
    • Infotainment Systems have become similar to desktop systems.

Linux Kernel /proc/pid/syscall information disclosure vulnerability- 486

Talos    Reference →Posted 4 Years Ago
  • The Linux kernel uses a pseudo-filesystem called proc which allows for interfacing with OS. The storage format on the OS is normally /proc/<pid>/. The different sub-directories share information about the running process, such as registers, memory mappings and other things.
  • The vulnerability exists in the /proc//syscall location. This location outputs the register state of a given process. When loading in the registers from the userspace process, they are placed into an array of size __u64 per item.
  • However, this is where the bug comes in. On 32-bit systems, the array in the print function are effected to be 32 bit per item. In the printf, the llx format specifier is used, which stands for long long numeric value outputted in hex.
  • The difference between the ACTUAL size of the elements and the EXPECTED size causes 24 bytes of kernel memory to be leaked from the stack. Using this, an attacker could break KASLR or other randomization primitives.
  • Considering this bug could be seen by simply viewing the procfs, this probably was not hard to find! In fact, a careful observer on a 32-bit system may have encountered this bug and not realized what was going on. When testing, be observant of odd behavior; rabbit holes are your friend :)

Unauthorized access to companies environment on Facebook Workplace- 485

Marcos Ferreira    Reference →Posted 4 Years Ago
  • Workplace is a self-managed Facebook for an enterprise environment. Having access to this is a privilege based upon the requirements set by the administrator.
  • When creating an account, the server was not correctly verifying the email used on registration if the self-invite feature was turned on. For example, only employees with @domain.com should be able to self-register. This is a horrible bug that allows for anybody to join the organization.
  • An attacker needed to know the community_id in order to launch this attack. However, the author of this post found a way to link an id to a company, making this a little more impactful.
  • This is unbelievable that this simple bug existed in Facebook Workplace. Does Facebook do internal pentests? I really hope they do! Bugs like this seem to be all over the place.

Privilege Escalation Via a Use After Free Vulnerability In win32k - 484

JeongOh Kyea - ZDI    Reference →Posted 4 Years Ago
  • The Direct Composition Windows API enables graphical effects such as image conversion and animations. In Windows 10 a group of system calls were batched into one action. Since this, several vulnerabilities have been found in this component.
  • Some of the code in the direct composition API has a circular dependency of pointers; one object references another and vice versa. When one of the objects is freed, it is important to remove the reference so that a dangling pointer does not exist. In the base case, this is done properly.
  • There is an assumed 1 to 1 relationship between these shared objects though. So, if the object is referenced by two different TrackerBinding objects, the original objects pointer is forgotten about. When the other object is freed, it creates a dangling pointer on a TrackerList object. This was CVE-2020-1381.
  • The patch for this vulnerability involved validating that TrackerList was not being referenced by another TrackerBinding. However, there is a small edge case that can bypass this fix. Natalie at P0 says that 25% of zero days do not receive a proper patch, which makes the case for looking for bypasses in recent patches to find vulns.
  • By updating the entry_id to 0 Windows sees the entry as unnecessary. This calls a function that will remove the binding but not the entry for ONE of the sides! So, when the check attempts to validate if the TrackerList is currently in use by another TrackerBinding it will fail. Thus, we can trigger the vulnerability in the same way as before.

ASUS GT-AC2900 Authentication Bypass- 483

Chris Bellows    Reference →Posted 4 Years Ago
  • In a very specific scenario, the authentication for this Asus router could be bypassed. All of these things had to be done:
    • The submitted asus_token starts with a Null (0x0)
    • The request User-Agent matches an internal service UA (asusrouter--)
    • The device has not been configured with an ifttt_token (default state)
  • The reason for passing in Null is because the validation of the ifttt_token returns NULL if the functionality is not in use. If the ifttt_token is the same as the asus_token this returns Null.
  • The author does not explain the asusrouter-- user agent. However, it is common for a header or UA to be used to denote if an internal service is being used. In this case, it is not a security issue but rather something to hit the service at all.
  • Interesting bypass that would ONLY be found by manually reviewing source code. I will likely add \0 to my input fuzzer list after reading this article.

The False Oracle — Azure Functions Padding Oracle Issue- 482

polarply    Reference →Posted 4 Years Ago
  • Azure functions is a way to run code in the context of Microsoft's Azure cloud platform. This is a nice feature to have because it allows quick code functions to run upon some trigger. This is similar to AWS Lambda functions.
  • This is remote code execution by design! So, restricting the environment abilities in a multi-tenant world is important. Otherwise, other users can see or alter the ENVs around them.
  • By inserting a remote shell in an Azure function, the author noticed an odd environment variable: SCM_RUN_FROM_PACKAGE. The code downloaded for the Azure function package had the r+w flag on the SAS token. By altering this package, an attacker could secretly plant a backdoor on the code package for the functions using this box.
  • Within an encrypted configuration blob were more SAS tokens. One of the SAS tokens was not scoped properly, which allowed the author to pull arbitrary configurations from other users. Although, these were encrypted.
  • The x-ms-site-restricted-token header used for authorization was extremely verbose on its error messages. Because of this verbosity the attacker was attempting to launch a padding oracle attack against this endpoint.
  • A padding oracle attack abuses the outputted error messages from the padding in order to byte by byte deduce the key. This is an extremely powerful vulnerability if it is discovered. This is not an issue with the algorithm itself; it is an issue with how the algorithm is being used.
  • Sadly, this attack did not work because the padding algorithm did not work properly. Encryption may not always be 100% necessary, but it made this cross-account configuration issue way less impactful. Adding encryption for a defense-in-depth measure can be a good idea.
  • Overall, interesting findings on Azure not restricting SAS tokens properly. This is likely seen in other places within Azure and other cloud platforms as well.