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!
memmove; an attacker has some control over the source, destination and full control over the size of the copy. The binary has most modern protections (NX, PIE and ASLR - 2). This means that this cannot be a one shot exploit - an information leak followed by code execution will be required. memmove() source to be outside of the stack buffer to leak data that was being copied to a file. By reading the file, they got their information leak with specific offsets. mmapped at a high address next to the other libraries. Of interest, the library ld-2.28.so was always 0xC000 bytes after the beginning of the file. So, how to get code execution?memmove is a more optimized version memcpy but has specific requirements on alignment. If this alignment is not met, then a function pointer called _dl_rtld_lock_recursive would be hit. By overwriting this variable in the loader with a badly aligned memmove, the authors controlled a function pointer with a single parameter going into it. Using the leak from before, they could call system and know where their data was at for the payload. @PostMapping("/myroute")) it will attempt to transform the object into a Plain Old Java Object (POJO). AccessLogValue to write to an arbitrary file with content. %APPDATA%\pritunl\profiles\[profile_ID].ovpn. While doing this, it attempts to sanitize malicious characters from the file then writes it to %PROGRAMDATA%\Pritunl\[profile_ID].ovpn. %PROGRAMDATA%\Pritunl\[profile_ID].ovpn with the default security permissions. As a result, an attacker can add malicious directives into the configuration file. Once openvpn is executed, it runs it with the security-script 1 flag, preventing external commands from being executed. Good work on the defense!ipconfig is ran without an absolute path. This means that if we add ipconfig.bat to the execution path, it will execute this first! Neat trick for a relative path. swapAndStartBridgeTokensViaCBridge is called. Eventually, this hits the library function LibSwap.swap() with additional validation checks to ensure no shenanigans are being performed. swap() makes a low level function call to call(). In order to make this call, both the variables callTo and callData are fully controlled by the user making the swap. system on this. They seem to have static analysis in place for the smart contracts, as they added // solhint-disable-next-line avoid-low-level-calls as a comment to prevent it from looking at this bad call. Lolz. system in order to steal all of the money. To do this, the attackers created their own contract could be executed to drain user accounts. Since they were in the context of the main contract, they could perform actions on tokens of users that had trusted this contract with infinite approval. Mass Assignment vulnerability. This occurs as a failure to check incoming parameters on a request that will then update an object. In this case, the API call was an public key update form, which they likely changed the account this was attached to by using the Mass Assignment bug. NSFunctionExpression; there is no complicated ROP chain or anything else. This call does two things: cover its tracks and trigger a logic bug within NSPredicate. Covering the tracks is interesting but it is all about cleaning the things up, which I'll skip. NSPredicates. This is used for iterating over collections, such as arrays, to perform functionality. While using predicates, expressions can be used as well. This expression in a small query language, which is similar to SQL in some ways. In OS X 10.5 in 2007, the ability to use the FUNCTION keyword to invoke arbitrary methods was added. protocol for the NSXPC to designate what happens when it is invoked or used. An attack surface analysis from 2019 shows that "subclasses of classes with any level of inheritance are also allowed, as is always the case with NSKeyedUnarchiver deserialization." This means that any object which declares a particular type for a field will accept any subclass of that type, opening up the attack surface. NSObject*, which would include NSPredicate. Although this looks like a game over (code execution from the expressions), there is a specific mitigation in place for this. When an NSPredicate is deserialized, a flag is set to disable the evalulation of the predicate. Good job Apple!Sections, the code sets the allowEvaulation flag to true. This means that the predicate is trusted and will be ran, but they never evaluate the predicate. As a result, the predicate gives us code execution within the context of CommCenter. IMTranscoderAgent sandbox, they run several expressions. The final expression is to make a request to a URL to download an AES encrypted expression to evaluate this as well. This secondary payload was whatever the attackers wanted at this point, all without any memory corruption. NSExpression to prevent easy code execution with a similar bug. Secondly, they added restrictions onto the PTSection and PTRow objects for parsing NSPredicates. So, good job Apple for hardening this area against future attacks. initWithCoder implementations could be attacked, with more code execution gadgets being found. NSXPC seems like a powerful attack surface across boundaries, even though it was designed with this exactly in mind. TrustedInstaller , which cannot be overwritten by system. So, what is useful to delete then? .msi extensions.rollback functionality for when an installation goes poorly. Namely, if a file is deleted with a newer version and the installation fails, then a copy is saved just in case the changes need to be reverted. In order to do this, the installer service creates a folder named C:\Config.Msi. In this folder are .rbs (rollback scripts) and older versions of some files. C:\MyFolder would have a file called C:\MyFolder::$INDEX_ALLOCATION. If the metadata file is deleted, then it essentially deletes the entire folder. By specifying the metadata file to some of the Windows commands, this can happen. oplock callbacks in order to delete the C:\Config.msi folder. RequestThumbNail. When an embedded PDF is added to a page, the thumbnail of the PDF can be accessed via a postMessage. Specifically, a call like embed.postMessage({type: "getThumbnail", page: 2});DCHECK, but this is only is test builds and NOT production builds. ClientHello and a ServerHello message. After this, they exchange cipher suites. However, if the client decides to use a cipher suite that the server does not support then the exchange will fail. According to the documentation of nanoSSL, this should result in the termination of the connection.