+44 (0)203 88 020 88

Menu

Search

Cyber Security News & Articles

 

Cyber Security
News & Articles

Trusted Cyber Security Experts
25+ Years Industry Experience
Ethical, Professional & Pragmatic

What are Web shell attacks?

Web shell attacks have doubled over the last 6 months according to Microsoft’s Detection And Response Team.  But, what are Web Shell Attacks and how can you defend against them?

In a recent blog post, Microsoft’s DART detailed the rise in Web Shell Attacks that have been uncovered in Windows Defender telemetry- growing from an average 77,000 detections per month to over 140,000 in January 2021.

What is a Web Shell?

Most Web Servers execute server-side code which is processed (interpreted) at runtime when the URL that points to that code is requested by a client’s web browser.  This includes PHP, JSP and ASP based webservers, for example. Rather than there being a monolithic software application that responds to every client request, there is usually one code file that is ‘executed’ in response to each different URL requested by the client.

For example: When the client’s browser requests a URL, such as: www.mysite.com/myapp/welcome the webserver interprets/executes the code in the file ‘welcome’ and returns the response generated by the code to the client browser.  In other words, each time a URL is requested from the webserver you could consider the browsers request as simply an instruction to ‘execute this file on the server.’

A web shell attack happens when a malicious user is able to inject their own file into the web server’s directory so they can later instruct the webserver to execute that file simply by requesting it from their web browser.

How do Web Shells get installed on servers?

Web Shells get installed in servers by exploiting vulnerabilities in the web server software or vulnerable plug-ins added to the web server.   Since the web server is visible on the internet, it can be located using scanning services such as shodan.io in order to quickly locate servers exposed by newly reported vulnerabilities.  Microsoft’s report includes a typical example of a vulnerability disclosed and patched in TMUI software from F5 Networks and within 5 days malicious users were observed uploading web shell exploits to unpatched servers.

The speed with which the malicious user community is able to respond to vulnerabilities is a challenge for Security Managers who may be constrained to work to monthly patch cycles with large networks to maintain and many systems to patch each month.  Patching needs to prioritise web server vulnerabilities that could be leveraged to insert files into the web server’s directory for later exploitation.  Typically, the rush to install a web shell into vulnerable servers is aiming only to secure a persistent beachhead on the server – the attackers may have no other current plans to attack the organisation.  Once the persistent access has been established by the installation of the web shell, the attackers may not return for some time or simply sell the access to another criminal for a fee.

Plug-ins are a particular concern as they appear often to be less secure than the core web server. For example, most WordPress related vulnerabilities disclosed recently are actually problems with plug-ins rather than the core WordPress platform:

How to mitigate the risk of a Web Shell?

There are several steps you can take in order to mitigate the risk of a web shell being installed on one of your servers and to detect one if it is installed already.

Prompt patching of webserver and plugin vulnerabilities

Malicious users need an initial attack vector into your network in order to be able to install the Web Shell.  Prompt patching of web servers and any plug-ins will help close the window of opportunity for vulnerabilities to be exploited.  Regular vulnerability scanning of internet facing systems will help identify vulnerabilities even before patches are available allowing for mitigating steps to be taken until the patch is installed.

Reduce the use of plug-ins

Reducing the attack surface of the web server by eliminating un-used or unnecessary plugins will reduce the number of vulnerabilities that could impact the security of the network.

File Integrity Monitoring

A Web Shell is a file that must necessarily reside in the live code directory of the web server.  By implementing File Integrity Monitoring, the arrival of unexpected files into that directory can be identified in real time – allowing security staff to remove the web shell promptly.

Malware scanning / endpoint protection software

If File Integrity Monitoring was not always in place, how can you tell if a Web Shell is already installed onto a web server?  Modern web applications can be comprised of hundreds or even thousands of files.  Scanning by malware detection software may be able to detect the web shell file on the web server. However, since the code of the web shell script is usually very similar to legitimate code within a modern web application this approach is unlikely to be 100% reliable.

According to Microsoft:

Another challenge in detecting web shells is uncovering intent. A harmless-seeming script can be malicious depending on intent. But when attackers can upload arbitrary input files in the web directory, then they can upload a full-featured web shell that allows arbitrary code execution—which some very simple web shells do.

As a result of these challenges, it is the behaviour of the Web Shell while it is executing that can be used to detect it by using Intrusion Detection techniques. For example, Microsoft’s Defender for Endpoint will spot the IIS web server instance (w3wp.exe) running suspicious commands or processes (such as: cmd or powershell) and flag these as indicators of compromise.

Republish the Application from source

A manual reconciliation of every file in the application directory against your source code repository may be necessary to identify any unexpected files.  As a last resort, you may have to wipe the application directory and republish the application  from the development environment. However, that development environment should also be checked carefully to ensure the Web Shell has not also be inserted into the source code repository in order to ensure its persistence (as happened in the SolarWinds hack).

Network segmentation prevents lateral movement

If a web server is compromised, then keeping it on a segregated network segment will prevent the attackers from being able to move laterally across the rest of the network.

Server configuration review and hardening

Perform a thorough Server Configuration Review to ensure vulnerabilities and misconfigurations in both the operating system and web appliction server are identified and remediated.

 

Web Shell attacks are a vector that appears to be gaining popularity with organised crime and nation state actors who desire persistent access to their target’s networks.  Only through careful and consistent security practices can you mitigate the risk of being a victim of a web shell attack and spot it quickly if one does happen.

 

 

Subscribe to our monthly newsletter today

If you’d like to stay up-to-date with the latest cyber security news and articles from our technical team, you can sign up to our monthly newsletter. 

We hate spam as much as you do, so we promise not to bombard you with emails. We’ll send you a single, curated email each month that contains all of our cyber security news and articles for that month.

Why Choose SecureTeam?

CREST
CCS
ISO9001
ISO27001
CE-PLUS

Customer Testimonials

“We were very impressed with the service, I will say, the vulnerability found was one our previous organisation had not picked up, which does make you wonder if anything else was missed.”

Aim Ltd Chief Technology Officer (CTO)

"Within a very tight timescale, SecureTeam managed to deliver a highly professional service efficiently. The team helped the process with regular updates and escalation where necessary. Would highly recommend"

IoT Solutions Group Limited Chief Technology Officer (CTO) & Founder

“First class service as ever. We learn something new each year! Thank you to all your team.”

Royal Haskoning DHV Service Delivery Manager

“We’ve worked with SecureTeam for a few years to conduct our testing. The team make it easy to deal with them; they are attentive and explain detailed reports in a jargon-free way that allows the less technical people to understand. I wouldn’t work with anyone else for our cyber security.”

Capital Asset Management Head of Operations

“SecureTeam provided Derbyshire's Education Data Hub with an approachable and professional service to ensure our schools were able to successfully certify for Cyber Essentials. The team provided a smooth end-to-end service and were always on hand to offer advice when necessary.”

Derbyshire County Council Team Manager Education Data Hub

“A very efficient, professional, and friendly delivery of our testing and the results. You delivered exactly what we asked for in the timeframe we needed it, while maintaining quality and integrity. A great job, done well.”

AMX Solutions IT Project Officer

“We were very pleased with the work and report provided. It was easy to translate the provided details into some actionable tasks on our end so that was great. We always appreciate the ongoing support.”

Innovez Ltd Support Officer

Get in touch today

If you’d like to see how SecureTeam can take your cybersecurity posture to the next level, we’d love to hear from you, learn about your requirements and then send you a free quotation for our services.

Our customers love our fast-turnaround, “no-nonsense” quotations – not to mention that we hate high-pressure sales tactics as much as you do.

We know that every organisation is unique, so our detailed scoping process ensures that we provide you with an accurate quotation for our services, which we trust you’ll find highly competitive.

Get in touch with us today and a member of our team will be in touch to provide you with a quotation. 

0

No products in the basket.

No products in the basket.