- Probably again about the blockchain, only in profile?
- And here they did not guess! This time - nothing about the blockchain, nor about Emercoin ! In the end, we have the right to do anything besides the main project!
BanMoron is a small program (the source is smaller than the text of this article), written in C, and designed to effectively counter attempts to hack a WEB-server by using standard vulnerabilities of WEB-systems like Wordpress , PhpMyAdmin and the like.
The following countermeasure modules are currently implemented:
When designing the program, a modular approach was used, which allows you to easily add both new rules templates and countermeasure modules to it.
The program itself is lightweight, the binary takes up only 6 kilobytes (probably everyone has already forgotten about such program sizes), and requires only one shared libc library. Thus, when using it, the performance of the WEB server is not observed in comparison with the HTML page 404.
To improve performance, when comparing the REQUEST_URI string with rule patterns, Rabin-Karp algorithm is used, which allows to compare the string with a set of patterns in one pass, O (N) . Universal hashing makes it almost impossible to create a specially selected REQUEST_URI string that reduces the efficiency of the hash function.
Below are answers to common questions:
- Why is the name of the program - BanMoron?
- Because, as the name implies, the main purpose of the program is to keep all idiots away from working servers, so God forbid that they do not break anything.
- Why do you call hackers assholes?
- Because these “hackers” are assholes. They take a ready-made script that someone once wrote, and they don’t even bother to at least diversify it, there’s not enough mind for that. And the structure of the requests shows that the script is used. It begs a direct analogy with the street "activists" who somewhere find reinforcement, and then beat the glass on the first floor. The intellectual level of both classes is about the same.
- And why your program is better fail2ban ?
- Fail2ban takes a different approach. He is constantly running a process (daemon) that monitors logs, and it finds an activity template for him, and then bans the corresponding IP. For a fail2ban reaction, it must detect activity, that is, process multiple requests.
Considering that Apache buffers writing to the log, and reading from the log is far from instantaneous, fail2ban has a response delay of a few seconds. In addition, several 404 events must pass before fail2ban can detect activity and react. At the present time, the developers of the exploits also do not sit idly by, and versions are already appearing that make many parallel requests to the victim - probably, just to have time to implement the exploit before the fail2ban reacts. In addition, fail2ban is a script in an interpreted language, that is, the Python interpreter is constantly kept in memory, which also does not add to it either speed or resource saving. BanMoron runs only at the moment when something needs to be done, and does not take over system resources all the time. And bans hacker on his first request. Efficiency on top!
- Why is your program written in C?
- There are several reasons for this:
- Why is some pf used as a firewall?
“Because the program was developed on FreeBSD, and there the default firewall is exactly pf, which suits us completely . If you want the program to work with iptables or another firewall of yours - write the appropriate modules (handler, and examples of configs), make a pull request on Github, and we will accept your contribution to the common cause. Humanity will be grateful to you.
- Where and under what conditions can I get the BanMoron program?
- You can download it from Emercoin 's GitHub repository and use it for free, since this program is OpenSource and is distributed under the BSD license.
Source: https://habr.com/ru/post/335300/
All Articles