Bypassing Extension Blacklists
What you'll learn: How attackers circumvent simplistic extension-based file upload filters using case manipulation, alternative extensions, and platform-specific behaviors.
The Problem with Blacklists
When applications try to block dangerous file uploads, they often maintain a blacklist of "forbidden" extensions like .php, .asp, or .jsp. However, blacklists are inherently incomplete—there are always variations attackers can exploit that developers didn't anticipate.
Common Bypass Techniques
Case Variation Attacks
Many blacklist implementations perform case-sensitive checks. If the filter blocks .php but your server treats file.PhP or .pHp identically (Windows and Apache with certain configs do), you've bypassed the protection. Upload shell.pHP and it may execute as PHP code.
Alternative Extensions
Most server technologies support multiple executable extensions. If .php is blacklisted, try:
.php3,.php4,.php5,.phtml(older PHP handlers).asp,.aspx,.cer,.asa(IIS/ASP variations).jsp,.jspx(Java).pl,.cgi(Perl/CGI scripts)
Platform-Specific Quirks
- Windows: Trailing spaces and dots are ignored (
shell.php.becomesshell.php) - Apache: May parse extensions right-to-left until finding a recognized handler (
shell.php.jpgmight execute as PHP if.jpgisn't explicitly configured) - IIS: Alternate data streams like
shell.asp::$DATAcan bypass filters
Why It Works
Blacklists assume developers know every possible variation and executable extension. The reality: there are dozens of edge cases across platforms, and missing just one opens the door to remote code execution.
Key Takeaway:
Extension blacklists fail because attackers exploit case insensitivity, alternative extensions, and platform-specific file handling quirks—making whitelisting (allowing only known-safe extensions) the superior defense strategy.