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!
OptionContract pays out the assets in the vault to the user via the exercise function. exercise is reached, the function loops through a given list of vaults. When it pays the user the assets, this is done via the transerFrom ERC20 function call. The contract validates that the user has sent enough money for the assets via a checking msg.value. msg.value, which is a global variable in the context of Solidity. The contract only validates that msg.value is enough for the single item being validated in the vault; not for the multiple items being taken.
legacy_parse_param function of the Linux kernel, there is an integer underflow in a verification for a bounds check. The verification can be found at here.PAGE_SIZE - 2 - size where SIZE is a user controlled value. In this if statement, the size can be larger than PAGE_SIZE which leads to an integer underflow. CAP_SYS_ADMIN permission is required to exploit this bug, the permissions could be given in a namespace, allowing to call this vulnerable function. ipc_port_copy_send, they noticed interesting return cases that may not be checked. IP_NULL, IP_DEAD, a dead port and a live port. If you sent a dead port in, then the code needs to validate that the port does not return an error condition of IP_DEAD. Since the reference count is not incremented on the callback, the error handling is extremely important. ipc_right_copyin_two! What happens when there is a desync in reference counting? A use after free, since there is a pointer to an object being used which could be freed at any point. com.apple.guarantine attribute. file URI scheme, other file URIs can be accessed. When using this with a Web Archive Safari hangs. osax files or "Scripting Additions". The XML-based parser contained an AppleScript application that could contain HTML. It turns out that this HTML renderer and JavaScript application did not follow the Same Origin Policy (SOP). Now, stealing files is trivial to do, since Gatekeeper will happily open these files for us. icloud-sharing URI, they noticed a lack of domain validation when opening the file in a new tab. Since Safari lacks the URL to open a new tab but does not validate it, this allows an attacker to open arbitrary tabs. When in an iFrame, this should not be possible, leading to a sandbox escape of some sort. pkexec (sudo-like binary) main function processes command line arguments and searches for the program to be executed in the directories provided by the $PATH environment variable. When parsing this information, it makes the assumption that argv is not empty. argv is empty, it starts a FOR loop with an iterator starting at 1 with no validation for argv being empty. This leads to an out of bounds read and out of bounds write on argv[1]. execve calls a new program, the kernel copies the arguments and ENV strings to the end of the new programs stack. Each element in an array contains a pointer to a string for either the ARGV array and ENVP, with the ending containing a NULL. argv[1] is the used, then it is the same as envp[0]. It first does this by reading from argv[1], which is really envp[0]. It takes this value (which is controlled by us) to find the program based upon the path. argv[1]. When calling a SETUID binary, many ENV variables are thrown out in order to not allow for trivial privilege escalation. Since this is really envp[1], this gives us an interesting primitive: the ability to add environmental variables back into the process! This is a non-memory corruption primitive, which means it is consistent, but powerful primitive. Data-only attacks are becoming more and more popular. pkexec clears its ENV only a few lines later. Is this even possible to exploit then? It turns out, there is a way to get an ENV variable used early enough in the program via the error handling!pkexec can print error messages to stderr via the call to g_printerr. It normally prints messages in the UTF-8 charset. To convert messages from one charset to another, iconv_open executes a shared library. However, the environmental variable GCONV_PATH can be used to load this in by force the above function being called. GCONV_PATH environmental variable, a shared library is loaded in as root. This is a complete user to root privilege escalation within most distros of Linux. Damn, that is impactful!memcpy, this allows for the secret information to be recovered. strings on the memory dump, a pin appears to unlock the device! At this point, they can recover the key from the device to get the money. sanitize_title() governs how the title to slug transformation is done. When this is done, it converts all characters into ASCII, numbers, underscores and dashes. This sounds restricting but looking at the source code unearths some hidden functionality: the sanitization preserves URL-encoded octets, and, indeed, slugs can contain URL-encoded characters. What can a URL encoded string do for anything though? post.php, the slug will eventually be URL decoded. If the slug does contain any URL-encoded characters, it gets encoded once again. Here is where the problem occurs: utf8_uri_encode only encodes Unicode characters. Crazily enough, utf8_uri_encode('<script>alert(1)</script>', 200) will output <script>alert(1)</script>. So, the URL encoding does not work as expected on the way back!__truncate_post_slug(). The only time this gets called is when Wordpress is saving a post that has the same slug already. Since the post slug should be safe, but can now have arbitrary input, the character expectations have been violated. Pretty quickly the authors found an easy place that XSS was triggered on the page.