Transcript
00:00:00WordPress has seen a string of vulnerabilities recently with the latest so severe
00:00:04they let's hackers gain complete control of the admin panel we're talking sql injection running
00:00:09shell commands pretty bad and maybe you don't care about WordPress but it still runs over 44%
00:00:14of the world's websites so many of the websites that you interact with and give your data to
00:00:19could likely be running WordPress and this vulnerable version so it basically works like
00:00:25this so I've got installed locally a standard stock version of WordPress and I can run this
00:00:29first script to see if the vulnerability is available and you can see we get the response
00:00:34HTTP 207 which means yes it is in fact vulnerable and that means we can now run the second check
00:00:41which is the enter the interactive shell so this sql injects the site creates a brand new admin user
00:00:47and then uploads a malicious plugin that allows me to now interact with any file on this website
00:00:52so let's dive into the issue and see exactly how it works
00:00:58so this repo that I'm looking at shows you exactly how to SQL inject vulnerable WordPress sites that's
00:01:06any site between 6.90 and 6.94 or 7.00 and 7.01 the whole attack starts by calling an unauthenticated
00:01:14endpoint batch v1 which allows you to batch up other requests that themselves are validated and permission
00:01:20checked the batch handler has two parallel arrays which are supposed to stay in sync validation and matches
00:01:26but a bug meant that when the function wp pass URL files due to an invalid path only validation was updated
00:01:33so now the same index used to look at both arrays provided mismatched results the POC takes advantage of this
00:01:41it sends a batch containing just one request a post to the v2 post endpoint which itself carries a request body
00:01:48since the parent's request was correctly validated as a post request any request in the request body end up bypassing the method allow list
00:01:56letting you send get requests then inside that inner batch is a get request to a post that does not exist which triggers the
00:02:02earlier desync causing WordPress to dispatch the same request under a function called get items where a field author
00:02:10exclude maps to author not in which the vulnerable build interpolates into SQL as a string basically because all of this is running
00:02:18the SQL is not escaped the PSC uses a series of requests that ultimately allows a post request to v2 users to create
00:02:25a new admin account the repo actually goes through all of these steps in detail the first five are pre-auth so take advantage of the bug but step six is just normal WordPress behavior for
00:02:35authenticated users which is to upload a malicious package okay so as mentioned earlier this is just the standard stock version of WordPress the vulnerability is not accessed through some sort of malicious plugin
00:02:46you can just install standard WordPress we run this check script first which basically validates if the
00:02:52vulnerability can be run then we can run this read command for example which tells us things like the
00:02:57database user and the database name we can now also run SQL against the website so we can find out things like
00:03:03which version the database is actually running and none of that is actually the bad stuff this is the really bad
00:03:07one where we actually create an admin account that has access to be able to upload a malicious plugin in this
00:03:15case it's called web shell this allows us to access the shell of the website meaning we can now have access to
00:03:22any file on this website and this attack happens in the way that we explained earlier on in the video so
00:03:27after the admin is created the plugin is then uploaded and then finally that user is deleted so the existence
00:03:34of the plugin and what's happened is now more discreet to also demonstrate how bad this is i've created a separate script
00:03:38which will create an admin and then keep it on the system
00:03:40so here i've got a username and a password i'm back on the website ever head over to the wp login route i can enter that
00:03:47username and password click login and now i have full access to the admin panel now if any of this is confusing then don't worry
00:03:54it took me a long time to work out as well the claim is that the resulting exploit chain was so absurdly
00:04:00complex that it would have taken a human security researcher weeks if not months to discover and
00:04:05piece together on its own no security researcher could have found and completed this exploit chain
00:04:10in 10 hours without ai and this is pretty scary because bad actors could effectively have bots scanning
00:04:17repos checking urls just waiting for vulnerabilities to appear and exploiting it in record time using ai
00:04:23one user on reddit said that their site was compromised just two days after it was discovered
00:04:27and since they only upgrade on weekends an attacker was able to create a new admin and login for those
00:04:33vulnerable the exploit was fixed in version 7.0.2 so you can upgrade to that but that is a pretty mad one
00:04:40you can find the repo and the article in the comments that i've used to run the poc and why not
00:04:46subscribe to better stack to stay up to date with all of the tech news i hope you enjoy that one guys and
00:04:50of course as always i'll see you in the next one