DEV Community

Carrie
Carrie

Posted on

2 1 1 1 1

Anti Bot Protection with SafeLine 7.0

Recently, I noticed that SafeLine WAF had released version 7.0, adding a lot of new features. And I decided to give it a try.

Introduction to SafeLine WAF

SafeLine WAF, produced by Chaitin Technology, is a Web Application Firewall that protects web services from hacker attacks. It has been well-known in the security industry for its "intelligent semantic analysis technology" since its early days.

SafeLine is an open source web application firewall (WAF). It is designed to be simple and easy to use. According to the official website, it has been installed on over 250,000 servers and has 12.4K stars on GitHub, making it the world's top-ranked open-source WAF on GitHub.

SafeLine Official Website: https://waf.chaitin.com/

Installation for SafeLine

The installation method is very simple, requiring only one command:

bash -c "$(curl -fsSLk https://waf.chaitin.com/release/latest/setup.sh)"
Enter fullscreen mode Exit fullscreen mode

After installation, the management console opens on port 9443. Directly accessing it and logging in, you can see the SafeLine WAF interface. I like its quite modern interface style.

Next, configure the websites that need protection. I set up a DVWA target behind SafeLine and ran an AWVS scan. It blocked everything it should. (PS: If it couldn’t, it wouldn’t be a WAF.)

The protection features against SQL injection, XSS, and similar attacks are fundamental for any WAF, and Chaitin’s semantic analysis technology already has a significant advantage in this area.

It provides a performance indicator table for the WAF, comparing it to ModSecurity, Coraza, etc. Although the data isn’t perfect, it’s impressive.

Additionally, the official website thoughtfully provides test samples and tools. If you don’t trust the results, you can conduct your own tests.

Anti-Scanning and Anti-Bot

In version 7.0, I’m particularly interested in the anti-bot capabilities. The configuration is quite simple, with several options:

  • What method to use for client verification
  • Whether to perform replay verification on requests
  • Whether to dynamically encrypt HTML files
  • Whether to dynamically obfuscate JS files
  • Whether to automatically watermark images

Once verification is enabled, visiting a site protected by the WAF will first show the following page. It seems SafeLine runs some local verification logic to detect the legitimacy of the browser.

After passing verification, the page refreshes without the blue screen, indicating SafeLine has cached the record (which is great for user experience).

SafeLine’s main anti-bot capabilities include human-machine verification, dynamic protection, and request replay prevention:

Human-Machine Verification

There is traffic from real users on the internet, but more often, it comes from automated programs like crawlers, vulnerability scanners, worms, and exploitation tools. Enabling SafeLine’s human-machine verification allows real users to pass through while blocking malicious bots.

Dynamic Protection

Without changing the content users see on the web pages, it adds dynamic features to the page by dynamically encrypting HTML and JavaScript code. This ensures that these codes appear random and unique each time they are accessed.

Request Replay Prevention

Automated tools often record HTTP requests using packet capture and replay techniques, then modify and resend these requests to perform attacks like ID traversal and unauthorized scanning. SafeLine’s request replay prevention effectively counters such attacks.

Conclusion

This protection method is indeed effective against scanners and bots. Human-machine verification forces clients to rely on browsers, significantly reducing the efficiency of automated requests. Dynamic encryption of HTML makes it impossible for scanners to recognize the actual content of the page, thus unable to identify vulnerability signatures. Finally, request replay prevention ensures that cookies recorded by scanners and bots cannot be used.

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay