Why does the site get reinfected after suspicious files are removed?
Website backdoors serve as re-entry paths left by attackers. Besides files in directories, common hiding places include scheduled tasks, SSH keys, login scripts, and hidden folders. Long-term maintenance experience shows these hidden channels often remain after visible files are deleted.
Administrators often report: "We had suspicious files removed, yet they reappear days later." This resembles a burglary where tools are taken but the changed lock and spare key go unnoticed. Suspicious files are obvious tools; the real return paths usually sit in rarely checked locations.
This article summarizes nine backdoor locations found in real incidents, explains why routine checks miss them, and provides the correct removal order plus the scope maintenance providers should cover. It targets business owners, IT contacts, and engineers, focusing on locations and inspection methods.
Why scanning or deleting suspicious files alone is insufficient?
Common approaches include running backdoor scanners or removing suspicious PHP files. These steps are necessary yet only address the file layer.
The issue lies in signature matching: it compares known malicious fragments and stays silent on misses. Many backdoors are not malicious files, such as:
- A single line in scheduled tasks that periodically downloads and runs code
- An extra SSH key identical in format to legitimate ones
- An added command in login scripts that executes on every login
- Attacker tools that decrypt database credentials using site config keys without obvious signatures
One case involved binaries disguised as system programs that were only found because their directory permissions were set to 000. A clean scan only means no known signatures exist, not that the host is secure.
Another mistake is treating removal as complete. Without locating the entry point, attackers can return through the same gap.
Nine common backdoor hiding locations
Locations are ordered from closest to website files outward. Early items are visible via FTP; later ones require host-level access.
1. Upload directory: backdoor files disguised as images
Upload directories allow external writes and frequently host backdoors. Disguise techniques include uncommon extensions, mixed case, trailing dots, or double extensions. List non-image files and confirm PHP execution is blocked.
2. Site configuration files: modified settings
Config files alter site behavior. Cases include directory locks that only allow attacker-specified filenames or rules that execute certain extensions as PHP. Every subdirectory may contain such files and must be compared.
3. Host scheduled tasks: system-level commands
Tasks reside in system directories outside website files. Attackers often place timed download-and-execute commands that restore deleted files within minutes. Review every account's schedule for unknown download instructions.
4. SSH keys: extra access credentials
Keys enable passwordless login; changing passwords has no effect. Common methods add new keys or prepend command directives. Each key's origin and settings must be verified individually.
5. Login startup files: execution on login
Startup files run on login. Attackers insert download-and-execute commands. Corresponding binaries must be located during cleanup.
6. Hidden home directories: permission-restricted folders
Dot-prefixed folders are often overlooked. Attackers may set permissions to 000 to hide tools. The method is to locate unopenable directories and examine them.
7. Temporary directories: attacker tools
Temp areas may contain password-decryption or lateral-probing tools without obvious signatures. Check account-isolated temporary locations.
8. Version control history: previously deleted files retained
Once committed, backdoors remain in the repository. Review commit logs and ensure version control folders cannot be read externally.
9. Legacy database tools and backup files
Outdated management interfaces or root-directory backups allow direct data access. Restrict sources or move backups out of the site.
Overview of locations, hidden content, and inspection methods
| Location | Hidden Content | Why Hard to Detect | Inspection Method |
|---|---|---|---|
| Upload directory | Image-disguised files | Names appear normal | List non-images and block execution |
| Config files | Rules allowing specific files or preloading malicious code | Not program files | Compare all subdirectory configs |
| Host schedule | Timed execution commands | System-level storage | Review each account's schedule |
| SSH keys | Extra keys or command prefixes | Normal format | Verify key origins |
| Login scripts | Execution commands and markers | Plain text only | Inspect scripts and trace binaries |
| Hidden folders | Permission-restricted tools | Tools cannot list them | Find permission-000 items |
| Temp directories | Decryption and probing tools | No clear signatures | Check account temp areas |
| Version control | Previously submitted files | Already deleted from site | Review commits and block external access |
| Database tools & backups | Direct login or download access | Not malicious files | Restrict sources and move backups |
Correct removal sequence
Recommended order:
- Preserve evidence: back up suspicious files, schedules, keys, and logs with timestamps
- Identify entry point: trace back from earliest suspicious timestamps via access and login records
- Remove: address all nine locations
- Replace credentials: update every account password and key
- Harden settings: block PHP in uploads, update software, restrict legacy interfaces
- Re-check: verify nothing reappears after removal
Recommended scope for maintenance providers
Request providers confirm coverage of:
- Website and upload directory suspicious files
- All subdirectory config files
- Every account's host schedule
- SSH key verification
- Login startup files
- Permission-restricted hidden and temp directories
- Version control history and external access checks
- Intrusion entry point and timeline
- Changed password and key list
- Re-check date and results
Conclusion
Backdoor removal centers on locating every return path. Remember three points: a clean scan does not equal a clean host; preserve evidence before removal; require providers to detail the covered scope.