NGINX Server Hack: How Attackers Redirect User Traffic (2026)

Imagine your website suddenly sending visitors not to your carefully crafted pages, but to a hacker's unknown destination! That's precisely what's happening in a sophisticated cyber campaign where attackers are compromising NGINX servers to hijack and reroute user traffic. It's a stealthy operation that's leaving many administrators in the dark.

NGINX, for those unfamiliar, is the unsung hero behind much of the internet's smooth operation. It's an open-source powerhouse used for managing web traffic, acting as a crucial intermediary between users and servers. Think of it as a traffic controller, directing everything from simple website visits to complex load balancing, caching, and reverse proxying. Its efficiency is why it's so widely adopted.

But here's where it gets alarming: Researchers at DataDog Security Labs have uncovered a malicious campaign specifically targeting NGINX installations. What's particularly concerning is that it's also ensnaring Baota hosting management panels, which are prevalent on websites with Asian top-level domains (like .in, .id, .pe, .bd, and .th) and even on sensitive government (.gov) and educational (.edu) sites. This broad reach makes the potential impact significant.

How are they doing it? Attackers are cleverly modifying existing NGINX configuration files. They inject malicious 'location' blocks, which are essentially hidden instructions that capture incoming requests. These requests are then rerouted, with the attackers rewriting them to include the full original URL and forwarding the traffic via the ‘proxy_pass’ directive to domains they control. This directive is normally a legitimate tool for load balancing, allowing NGINX to distribute traffic for better performance. Its abuse here is particularly insidious because it often doesn't trigger any security alerts, making it incredibly hard to detect.

To further mask their activities, the attackers meticulously preserve crucial request headers like ‘Host,’ ‘X-Real-IP,’ ‘User-Agent,’ and ‘Referer.’ This makes the hijacked traffic appear perfectly legitimate, as if it originated from the intended source.

The attack unfolds through a scripted multi-stage toolkit, a carefully orchestrated five-step process:

  • Stage 1 – zx.sh: This is the initial orchestrator. It's responsible for downloading and executing all subsequent stages. It even has a clever fallback: if standard tools like curl or wget aren't available, it can send raw HTTP requests over TCP.
  • Stage 2 – bt.sh: This script specifically targets NGINX configurations managed by the Baota panel. It intelligently selects injection templates based on the server’s name and safely overwrites configurations, then reloads NGINX without causing any service interruptions.
  • Stage 3 – 4zdh.sh: This stage is all about thoroughness. It searches for common NGINX configuration locations (like sites-enabled, conf.d, and sites-available). It uses sophisticated parsing tools to prevent configuration corruption, checks for previous injections using hashing, and validates all changes with nginx -t before reloading.
  • Stage 4 – zdh.sh: This script takes a more focused approach, primarily targeting /etc/nginx/sites-enabled with a special emphasis on .in and .id domains. It also performs configuration testing and reloads, with a forceful restart (pkill) as a last resort.
  • Stage 5 – ok.sh: The final stage is about intelligence gathering. It scans all compromised NGINX configurations to build a comprehensive map of hijacked domains, the injection templates used, and the attacker’s proxy targets. This valuable intel is then sent back to a command-and-control server.

And this is the part most people miss: These attacks are incredibly difficult to detect because they don't exploit a software flaw in NGINX itself. Instead, the malicious instructions are hidden within the server’s configuration files, which are seldom scrutinized by administrators. Furthermore, since user traffic often still reaches its intended destination, albeit via the attacker’s infrastructure, the rerouting is unlikely to be noticed unless very specific monitoring is in place.

This raises a critical question: With such stealthy methods, how can organizations truly safeguard their web traffic? Are current security practices sufficient to detect these configuration-based attacks? What steps do you think are most crucial for administrators to take to prevent such compromises? Let us know your thoughts in the comments below – we'd love to hear your perspectives!

NGINX Server Hack: How Attackers Redirect User Traffic (2026)
Top Articles
Latest Posts
Recommended Articles
Article information

Author: Pres. Lawanda Wiegand

Last Updated:

Views: 6464

Rating: 4 / 5 (51 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Pres. Lawanda Wiegand

Birthday: 1993-01-10

Address: Suite 391 6963 Ullrich Shore, Bellefort, WI 01350-7893

Phone: +6806610432415

Job: Dynamic Manufacturing Assistant

Hobby: amateur radio, Taekwondo, Wood carving, Parkour, Skateboarding, Running, Rafting

Introduction: My name is Pres. Lawanda Wiegand, I am a inquisitive, helpful, glamorous, cheerful, open, clever, innocent person who loves writing and wants to share my knowledge and understanding with you.