Score:0

How to disable access to a file inside a directory nginx

cn flag

Hello I'm trying to prevent access to the file /wp-admin/load-scripts.php in the nginx config I'm currently working with

 location ~ \/wp-admin\/load-(scripts|styles).php {
        deny all;
        }

and it's still allowing access to the file

Paul avatar
cn flag
Does `location ~ /wp-admin/load-(scripts|styles)\.php { deny all; }` work?
cn flag
Nope, I've tried it and can confirm it dose not work :/
cn flag
Just for reference this is what I'm trying to prevent https://wpcerber.com/how-to-protect-wordpress-against-cve-2018-6389/
Paul avatar
cn flag
I usually go the other way and `allow` what I need and `deny all`, but this requires testing all of the installed configured templates and plugins. In one config I do have specific location blocked, but for that I have `\.php$`. I can't remember now why I used the `$`.
cn flag
Right but i don't need /load-scripts.php
Annahri avatar
in flag
Does `location ~ /wp-admin/load-(scripts|styles)\.php$ { return 404; }` work?
Paul avatar
cn flag
Please post the `server` block.
cn flag
i successfully got the configuration working but unfortunately the exploit still persists.
cn flag
Thank you Paul and Annahri for the help
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.