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!
fd_install makes a file descriptor available in userland. Once the code is in userland, it is important NOT to use this file descriptor anymore! This is because the user could free the resource themselves. fd_install(fd, file); would be called. Then, some time later, the same file descriptor is used to do something else to the file. However, in this small time window, the file descriptor could be freed with a call to close(fd), resulting in a use after free. /etc/shadow. It is so wild that this memory corruption bug is extremely trivial to exploit by using the program itself for the primitive. xxxMenuWindowProc and others of the GUI API, there is an issue with the callback setup However, this pattern is complicated, especially when functions may have side effects on some objects. What if the object type changes between the original call and the callback? Type confusion!xxxClientAllocWindowClassExtraBytes to trigger the NtUserConsoleControl method. NtUserConsoleControl method is ran within the callback, the type has changed! However, upon further usage of the object in its current context, there is no check for a type change. web.xml file there is a filter that redirects all traffic. This filter is used for checking CSRF tokens, sessions and many other things. One of the filters is stateParserGenerator.processState, which is used to process the state cookie. Within the state, there is a very dangerous field: forwardPath. forwardPath field, an attacker can trick the server into sending data to another location directly. This redirect bypasses other filters in the chain and goes directly to other servers but does not allow calls to REST API. This is referred to as an Arbitrary Request Forward. In the article, they link to a similar bug they find in the past. .jar (as a zip) file that wold get loaded on reboot. /directory/values.yaml parses like a URL but is a legitimate file path. SMB2_SET_INFO. Besides a few select attributes, all attributes can be set. org.netatalk.Metadata. Since this attribute is not in the denylist listed above, an attacker can arbitrary set this attribute. The Netatalk protocol assumes that the Metadata information is benign, which results in catastrophic results. fruit_pread function reads the metadata of a file. When attempting to read from a buffer, an attacker controls the value of ADEID_FINDERI, which is used as an offset into a buffer. Although there is a bounds check to make sure the original index is within the bounds of the buffer, the value being read in is fixed at 32 bytes. As a result, if the index is put at the last possible byte on the buffer, we get an out of bounds read of 31 bytes. fruit_pwrite writes metadata to a file. The same bug above also affects the write path as well. This allows for a memcpy with attacker controlled data to write 31 bytes of data onto the heap. It is interesting that both the read and write versions of this code path suffer from the same vulnerability. memcpy. The variant has the same problem but when handling dates. Since the entries are much smaller, this leads to only a 3 byte OOB read and OOB write. AFPINFO_EA_NETATALK file attribute is now a denylisted attribute to write. Overall, great primitives to lead to code execution in an obscure part of the Apple Ecosystem. mod_lua, which allows for Lua scripts to be written within the configuration file. Content-Types. One of these is multipart/form-data which sends data in multiple parts with each one containing a Content-Disposition header with some other formatting as well. r:parsebody() which parses the body of a POST request. When calculating the element data in the request, it subtracts the CRLF amount then 8 bytes more for the two CRLFs prior to the data. This size check ends once the -- string is found. However, what happens if this is improperly formatted? Any time there is a subtraction on a size, we should always think integer underflow!size+1 is done, which will overflow into an allocation of size 0 if our original subtraction bug resulted in -1. memcpy to copy the elements data into a buffer. Since the buffer is no where near this size (because of the overflow), this result sin a large buffer overflow. Although they claim this leads to code execution, I feel like this would crash the server since it is a wildcopy with no stopping factors. mod_lua, which allows for Lua scripts to be written within the configuration file. Content-Types. One of these is multipart/form-data which sends data in multiple parts with each one containing a Content-Disposition header with some other formatting as well. r:parsebody() which parses the body of a POST request. When calculating the element data in the request, it subtracts the CRLF amount then 8 bytes more for the two CRLFs prior to the data. This size check ends once the -- string is found. However, what happens if this is improperly formatted? Any time there is a subtraction on a size, we should always think integer underflow!size+1 is done, which will overflow into an allocation of size 0 if our original subtraction bug resulted in -1. memcpy to copy the elements data into a buffer. Since the buffer is no where near this size (because of the overflow), this result sin a large buffer overflow. Although they claim this leads to code execution, I feel like this would crash the server since it is a wildcopy with no stopping factors. VULN-####. This ID is used for the bug report. The IDs are easily guessable, as they are sequential. VULN-####. This ID is used for the bug report. The IDs are easily guessable, as they are sequential. file parameter to access the information with the Authorization of this user. Then, a link is given back to the application to make another request to get the actual file. Since the file parameter is provided to the user, we can not only include the file but other parameters associated with this file. Would this be useful? alt=media on the request to get an element from Google Drive. By placing this parameter, the contents of the file are returned instead of a JSON blob to make the next request. Now, if we can control this file on Google Drive we can control the JSON blob being returned for the next request. This could be used for a deadly SSRF attack.