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!
memcpy or memset. This led the author to a call that had broken logic on the size of the buffer. IPT_SO_SET_REPLACE is called in compatibility mode and needs to convert the data from 32bit to 64bit in order to be processed by the native functions. Converting data is complicated and tends to be error prone! xt_compat_target_from_user the call to memset is called with an offset that is not accounted for during the allocation. This leads us to an out of bounds write with a few bytes. The size of the overwrite is not directly controllable by the user; but, choosing different structs carefully allows to make the overwrite as big as 0x4C bytes long. msg_msg struct to gain a use after free (UAF). This is a good object to spray as well because they are controllable and easy to create. msg_msg object contains a linked list to the next message in the list at the beginning of the object. The goal of the spraying is to create an insane amount of these messages, overwrite one of the pointer with our vulnerability to point to another one of the messages. Eventually, we will have two pointers pointing to the same message. This is all done by 00ing out a small of the pointer! struct msg_msg header. By replacing the msg_msg->m_ts value with something large from the socket code, we can leak a substantial amount of information struct with an OOB read. next pointer in the block above is what we are trying to read. By reading this, we can gather where we are located on the heap. With this heap leak, the double linked list (next and prev from before), can now be re-created. With the pointer fixed, we can free this again when the sk_buff struct is allocated over the top to create a more powerful UAF. sk_buff buff is better for the uAF because we can use it to free any kind of object in the heap slab. This gives us an even better use after free primitive. They choose the pipe_buffer object because it contains function pointers. A struct within this structure also contains pointers to the .data sections, which is needed for bypassing the code randomization. Reading this is trivial with the current setup. pipe_buffer object in order to start the chain. commit_creds(prepare_kernel_cred(NULL)) to install kernel credentials and switch_task_namespaces(find_task_by_vpid(1), init_nsproxy) to switch namespaces of process 1 to the init process. Now, back in userland, we have root permissions to change process namespaces for Kubernetes. wget and does a download. Wisely, they sanitized their input from malicious shell characters to prevent command injection. --post-file=FILE, arbitrary files can be read; using --output-document=FILE let's us write arbitrary files to the server. But, this is only LPE at this point. .log. While using snprintf with the proper size will prevent buffer overflows, the truncation can be abused to write with an arbitrary file ending! Damn, that is so clever. autoupdate command works by downloading the user-managed Git repository and copying the files from it. When downloading the NPM version of the repository (for updating globally), it downloads a tgz compressed file. With library unzipping, there is the potential for directory traversal (../)!npm functionality. When playing around with the git repo functionality, the author of post noticed that symbolic links were NOT being handled. By using the symbolic links, an arbitrary file read primitive could be gained. They used this to read Github automation secrets and many other things on the server. b35fcdc1ea1221e6dd126e172a0131c5a with username admin. web.config has many different permissions that are dnied for being unsafe and are not allowed. text4 = HttpUtility.HtmlDecode(text4);. If the verification step does not match the run time exactly, it may be possible to bypass the security controls. runat="server" is used. However, by HTML encoding this attribute, we can bypass the verification step entirely. This works because the verification does NOT HTML decode but the runtime does. System.Web.UI.WebControls.Xml to exfiltrate the machineKey from the web.config. SPBasePermissions.ManageLists permission in order to do. eval in ASP.net for some reason. The idea was to interpret the value of the arguments from the file as literal code. redirect_uri and client_id values to match those of the self-hosted instance. Because this was technically an OAuth provider, the service blindly accepted the request back. As a result, you can login as any user on the Gitpod. longUrl for the link shortener, it only validated the link ID in the URL with a literal string check. If this ID was owned by you, it was fine to edit. ../ but still have the auth check happen on our ID. This resulted in the ability to change the redirect location of any link on the site! With the ability to change URL shortners, we can do some serious damage. binwalk failed. By running an entropy analysis on the files, it was easy to see that the firmware was encrypted. popen, system or exec*. This limited the search to 28 files. By going from sink to source, they were able to identify a command injection bug in one of the CGI calls. /uapi-cgi/admin. /uapi-cgi/ are all symlinks. Hence, there is a rewriting rule within the lighthttpd configuration that rewrites directories depending actual directory it needs to go to. Depending on the location being accessed, auth may or may not be applied./non-existent/../uapi-cgi/certmngr.cgi. Damn, regexes are hard to do just right!