For the Metasploit module we used in the previous section, exploit/multi/http/wp_crop_rce, we need to have the username and password set for the module to work. But what if there's a reCAPTCHA in place at the time of authentication? The module will surely fail because there's no workaround for the module to get the session cookie:
- Let's modify the module so that it works with the COOKIE datastore as well:
![](https://static.packt-cdn.com/products/9781789953527/graphics/assets/ca7611b4-1b44-4b37-bf25-d9e214b9c3f8.png)
We can see the updated module options in the following screenshot:
![](https://static.packt-cdn.com/products/9781789953527/graphics/assets/9d1b52a6-91b5-4726-a056-ebd8c6ff167a.png)
- Let's define a function for the COOKIE datastore:
![](https://static.packt-cdn.com/products/9781789953527/graphics/assets/88b328c9-81f5-457f-bd52-48f1e13990c2.png)
- We also need to validate the cookie based on the response code. So, let's define a validate_cookie() function; this will validate the cookie with a 200 HTTP response code:
![](https://static.packt-cdn.com/products/9781789953527/graphics/assets/e980a39e-1194-4140-8b9f-85ed97c37b86.png)
- Now, in the exploit() function, let's include a fail-safe fail_with() method to ensure...