int load_plugin(const char *plugin_name) { void *handle; char *error; char path[PATHSIZE]; int (*init_plugin) (void); char **deps; char **plugin_info; plugin_t *p; if (is_loaded(plugin_name)) { printf("Plugin %s already loaded.\n", plugin_name); return 0; } strncpy(path, PLUGINDIR, PATHSIZE); strncat(path, "/plugin_", PATHSIZE); strncat(path, plugin_name, PATHSIZE); strncat(path, ".so", PATHSIZE);What does setting the size field in strncat to PATHSIZE do? It won't prevent the destination string from exceeding the size PATHSIZE. It will prevent the source string being copied to copy at most PATHSIZE characters. In the above code, if the plugin_name is near PATHSIZE, then a buffer overflow will occur. There are more bugs like this in OpenBIOS.
Monday, 18 March 2019
strncat Buffer Overflow in OpenBIOS
It's easy to get strncat wrong. Here is an example from OpenBIOS.
Exploiting the Lorex 2K Indoor Wifi at Pwn2Own Ireland
Introduction In October InfoSect participated in Pwn2Own Ireland 2024 and successfully exploited the Sonos Era 300 smart speaker and Lor...
-
InfoSect has always been committed to fostering diversity and inclusion within the cybersecurity industry, with a special focus on encourag...
-
Summary This is the next part of the C++ memory corruption series*. In this post, we'll look at corrupting the std:string object in L...
-
Syed Faraz Abrar @farazsth98 Summary In this blog post, I will provide some details on how the Chromium developers implemente...