13 - Web Server Operations
13 - Web Server Operations
Browsers
Mobile Apps
Internet
Webserver, OS, and network misconfigurations
Bugs in the OS, web apps, logic software, and database engine
Insufficient host hardening
Improper authentication
Improper permissions for files/directories
Unchanged default accounts, settings and sample files
Unnecessary services
Vulnerable web apps that put the host at risk
Conflicts with security due to business ease-of-use
Tampering/theft of data
Defacement of websites
Compromised user accounts
Root access to other apps/servers
Secondary attacks from the website
13.2 HACKING
Testing Web Servers
WEB SERVERS
Attacking a web server involves the same basic steps as any other
system hacking:
1. Footprinting
2. Scanning
3. Enumeration
4. Exploitation
Consider mirroring the website to make an offline copy that you can
probe at your convenience
Realize that a local copy of the website might not include access to
business logic or database functionality
OSINT information gathering:
Internet searches
Whois
Acquire robots.txt to see directories/files that are hidden from web crawlers
Tools:
Wget
BlackWidow
HTTrack
WebCopier Pro
Web Ripper
SurfOffline
Banner grab
Port and vulnerability scan
Test HTTP methods
Check for GET, HEAD, POST, OPTIONS, DELETE, PUT, CONNECT, TRACE
Risky methods are DELETE, PUT, CONNECT, TRACE and should be disabled
nmap --script http-methods <target>
List email addresses
nmap --script http-google-email
Enumerate common web apps
nmap --script http-enum -p80
Nmap
Acunetix Web Vulnerability Scanner
HP WebInspect
Nessus
Nikto
Metasploit
Use nmap scripts to discover information and vulnerabilities
Discover virtual hosts on the IP address you are trying to footprint; * is replaced by
online db such as IP2Hosts
nmap --script hostmap-* <host>
SERVER ATTACKS
• Password Cracking • TLS Downgrade / MITM
• DNS Server Hijacking • Directory Traversal
• Misconfiguration Attacks • Shellshock
• Web Cache Poisoning • Heartbleed
• Web Page Defacement • POODLE
• DoS/DDoS • DROWN
Website passwords are often exempt from normal lockout policies
Password cracking techniques include:
Bruteforce attack
Dictionary attack
Password Guessing
Ancillary services such as SMTP and FTP can also put a web server at risk
These are often extended features of the website
They need their own hardening and proper configuration
POODLE Steps:
Attacker inserts themselves as MITM between
client and server
Forces a downgrade of TLS to SSLv3
Then if the cipher suite uses RC4 or Block cipher
in CBC mode:
Attacker can retrieve partial bytes of encrypted text
and later on can get full plain text
Decrypting RSA with Obsolete and Weakened eNcryption
Exists due to the inclusion of 40-bit encryption in SSLv2
Vulnerability requirements:
The server must allow both SSLv2 and TLS connections
The server’s private key must be used on any other server that facilitates SSLv2
connections
Attack steps:
The attacker must capture both the initial RSA handshake and the encrypted TLS traffic
The attacker repeatedly modifies the handshake, sending thousands of these messages to
an SSLv2-capable server
Each response from the server to the attacker yields partial key material
It takes about 1000 handshakes to capture a recoverable key
Once the session key is recovered, the captured TLS traffic can then be decrypted.
Baba Hakka sez: “Use
Amazon EC2 to speed up
yer attack!”
13.4
WEBSERVER Common Attack Tools
ATTACK TOOLS
Brutus, THC Hydra, Medusa
Brute force network-based password crackers
Metasploit
Open source hacker framework with many exploits and payloads
You can search for “apache”, “iis”, “nginx”, “poodle”, “shellshock”, etc.
Installed by default in Kali Linux
Can also be downloaded and installed in other Linux distributions
Metasploit Pro (commercial version) can be installed on Windows
• SearchSploit
• A command line search and download tool for Exploit-DB
• Installed by default in Kali Linux
• Exploits are written in C, Python, Perl, Ruby, etc.
• Contains many exploits that are not in Metasploit
• Update your local copy of the database: searchsploit -u
• WFETCH
• Microsoft tool to customize and send HTTP requests
HULK
Attacks web servers by generating unique and obfuscated volumes of traffic
Bypasses caching engines, directly hitting the server's resource pool
13.5
HACKING WEB General Webserver Defense
MEASURES
Set file system permissions on all directories and content
Require HSTS on the webserver
Keep all related services and components patched and up-to-date
Harden the operating system and network infrastructure
Remove unnecessary services and features, and change defaults
Move other network services to other hosts
ISAPI filters provide Web servers such as IIS the ability to preprocess or postprocess information
sent between client and server. They are used for such tasks as custom authentication, encryption,
and compression schemes or for updating logging statistics on the Web server
Keep NGINX and PHP updated to avoid these well-known NGINX vulnerabilities:
SPDY heap buffer overflow
Allows the attacker to execute arbitrary code through a crafted request
SPDY = Google protocol to accelerate web content delivery
Root Privilege Escalation Vulnerability
Can lead to the creation of log directories with insecure permissions
Remote Integer Overflow Vulnerability
A Boundary Condition Error type that grants access to sensitive information
NGINX Controller vulnerability
Allows creation of unprivileged user accounts
PHP 7 Remote Code Execution Vulnerability
Can lead to information disclosure or unauthorized modification.
1. You just discovered several unknown files in the root directory of your Linux FTP
server:
A tarball, two shell script files, and a binary file named “nc”
2. The FTP server’s access logs show that the anonymous user account:
logged in to the server
uploaded the files
extracted the contents of the tarball
ran the script using a function provided by the FTP server’s software
3. The “ps” command shows that the “nc” file is running as process
4. The netstat command shows the “nc” process is listening on a network port
5. What kind of vulnerability must be present to make this remote attack possible?
6. File system did not have proper permissions
7. The anonymous user must have had write permissions to the FTP directory
8. Perform a review of all permissions to the FTP directory.
13.6 HACKING
WEB SERVERS Review
REVIEW
INTRO TO
Use a multi-layered approach when attacking or defending a web server
ETHICAL
Webservers are vulnerable to attacks against:
The operating system
The web service
HACKING
Web apps
Other vulnerable network services running on the same server
REVIEW
Supporting network services like DNS
Client applications