Detecting Webshells with Sysmon: A Technical Analysis
Sina Mohebi
Cyber Security Instructor @ NooraNet | Security presale architect @ Positive technologies | OSINT researcher
Introduction: Webshells are malicious scripts or programs that attackers deploy on web servers to gain unauthorized access and control. Detecting these webshells is crucial for maintaining the security of web applications
Understanding Sysmon: Sysmon is a lightweight, command-line utility developed by Microsoft for Windows systems. It provides advanced monitoring capabilities
Here's a real example of how Sysmon can be used to detect a webshell activity:
Let's say you have configured Sysmon on your web server and are monitoring Event ID 1 (Process Creation) and Event ID 3 (Network Connection). One day, you notice a suspicious process being created with a webshell-like name, "cmd.aspx".
Process Create: RuleName: - UtcTime: 2022-01-10 15:30:45.1234567 ProcessGuid: {12345678-1234-1234-1234-123456789abc} ProcessId: 1234 Image: C:\inetpub\wwwroot\cmd.aspx CommandLine: C:\Windows\System32\cmd.exe /c echo "Hello, webshell!" CurrentDirectory: C:\inetpub\wwwroot\ User: NT AUTHORITY\SYSTEM
Upon further investigation, you find that this process establishes an outbound connection to a suspicious IP address.
Sysmon Event ID 3 log entry:
领英推荐
Network Connect:
RuleName: -
UtcTime: 2022-01-10 15:31:00.9876543
ProcessGuid: {12345678-1234-1234-1234-123456789abc}
ProcessId: 1234
Image: C:\Windows\System32\cmd.exe
User: NT AUTHORITY\SYSTEM
Protocol: TCP
Initiated: true
SourceIp: 192.168.2.100
SourcePort: 12345
DestinationIp: 1.2.3.4
DestinationPort: 8080
In this example, the webshell "cmd.aspx" is created by a legitimate Windows process "cmd.exe" and executed with elevated privileges (NT AUTHORITY\SYSTEM). It establishes an outbound network connection to an unknown IP address on an unusual port (1.2.3.4:8080). These activities raise suspicion and indicate a potential webshell presence on the server.
By regularly reviewing and analyzing Sysmon logs, paying attention to relevant event IDs, and using tools like SIEM (Security Information and Event Management) solutions, you can detect and respond to webshell activities promptly, mitigating potential security risks.
Remember, this is just one example, and the characteristics of webshells can vary. It is crucial to stay updated on the latest webshell threat indicators and adjust your monitoring and detection techniques accordingly.
Conclusion: Deploying Sysmon as part of your web server security strategy can significantly enhance your capability to detect and mitigate webshell threats. By leveraging Sysmon's comprehensive event logging features and implementing proper monitoring and analysis techniques
Please note that while Sysmon is a powerful tool for monitoring system activities, its configuration and analysis require technical expertise. It is recommended to consult security professionals or refer to official documentation for specific implementation details suitable for your environment.
provide by me with best regards
Sina Mohebi
Find more post in my Blog