Giter Site home page Giter Site logo

jpkleemans / brute-force-login-protection Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 8.0 75 KB

Protects your WordPress website against brute force login attacks using .htaccess

Home Page: https://wordpress.org/plugins/brute-force-login-protection/

License: GNU General Public License v2.0

PHP 100.00%

brute-force-login-protection's Introduction

Hello there ๐Ÿ‘‹

My name is Jan-Paul. A Zwollenaar with a great enthusiasm for building awesome web applications.
You might know me as author of Vite SVG loader, Laravel Attribute Events or some of the other web development packages I've written.

brute-force-login-protection's People

Contributors

jpkleemans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

brute-force-login-protection's Issues

Feature Request: Nginx

Please add support for nginx.
You could block the attacking bot via php if .htaccess is not supported...

.htaccess - FilesMatch was not closed

Bug:

Saving the plugin settings creates an invalid .htaccess file, resulting in a 500 server error for all future requests to the domain.

Steps to Reproduce:

  1. Use a WordPress install that hasn't had the Brute Force Login Protection (BFLP) plugin installed.
  2. Install the BFLP plugin
  3. Use the WordPress plugin interface to activate BFLP
  4. Observe that the .htaccesss has the following lines added:
# BEGIN Brute Force Login Protection
<FilesMatch "">
order deny,allow
</FilesMatch>
# END Brute Force Login Protection
  1. in WordPress, go to Settings -> Brute Force Login Protection, and change the max number of login attempts (ex: to 12). Click Save.

Expected Behaviour:

The settings are updated correctly, and the plugin and site continues to function, with a max number of logins set to 12.

Actual Behaviour:

  1. See a Server Error 500 page.

  2. Observe that the Apache error log states:
    [alert] [client 192.168.56.1] /var/www/.htaccess: /var/www/.htaccess:47: <FilesMatch> was not closed., referer: http://ubuntu.dev/wordpress/wp-admin/options-general.php?page=brute-force-login-protection&settings-updated=true

  3. Observe in .htaccess:

    # BEGIN Brute Force Login Protection
    <FilesMatch ".*\.(php|html?|css|js|jpe?g|png|gif)$">
        order deny,allow
    <FilesMatch "">
    </FilesMatch>
    # END Brute Force Login Protection
    
  4. All further http requests result in a 500 server error.

Debugging I've performed:

  1. Observed that within Htaccess->setFilesMatch, the results of getLines(false, true) contains a single line:

    <FilesMatch "">
    
  2. Observed that when the .htaccess is updated after the first time, during the getHeader() call, $this-&gt;filesMatch equals '.*.(php|html?|css|js|jpe?g|png|gif)$' (the default)

  3. Observed that when the plugin is activited, and htaccess->uncommentLines(); is called, htaccess->filesMatch is still empty.

Conclusion drawn:

The first time the .htaccess file is amended to add the BFLP rules, htaccess->setFilesMatch() has not been called, and so the FilesMatch directive is given an empty pattern, which causes subsequent updates to fail.

Suggested Fix:

  1. In the activate() method, add a call to $this->setProtectedFiles();

I could create a pull request if you like, but it's only a one-line fix:

/**
* Called When the plugin is activated
* 
* @return boolean
*/
public function activate()
{
    $this->setHtaccessPath();
    /* add the following line: */
    $this->setProtectedFiles();
    $this->htaccess-&gt;uncommentLines();
}

Request/How to ? Block IP for a period of time

Hi, this is maybe more like a request if possible.
I think adding a feature to choose how long IP are being blocked would be interesting instead of blocking them for ever. This can cause a very big htaccess file filled with many IP or a issue for someone legit trying to visit the website after some months.
Thanks!

I couldn't understood why blocked IP's are almost identical to mine

Hi,

I've around 500 wordpress sites and while searching for solution for brute force attacks I've found your plugin and decided to try.

What I don't understand is it looks like all the blocked IP's are my own IP's.

On each wordpress site, on the "white list" section my IP looks different and it show IP's like:
aaa.bbb.ccc.103
aaa.bbb.ccc.104
etc.

These are shown as my own IP's on the "white list" section of the plugin.

The problem is: when I look to the blocked IP's, they look very similar to mine, in the format of:

aaa.bbb.ccc.186
aaa.bbb.ccc.194

Note: And I realized today that I've been blocked on a few of my sites. So what's the problem here? Is my own server tries to login to my own sites? Or what can be the reason for that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.