When a site gets hacked, people usually blame the server or the CMS. In practice, one of the most common reasons foreign code appears in website files lies elsewhere: on the site owner's or developer's own computer. Malware there collects saved FTP passwords and sends them to attackers, whose scripts then log straight into the site and modify files. The server did nothing wrong; it was given the correct username and password.
How malware steals FTP passwords
This kind of malware is called an infostealer. It usually arrives with cracked software, game cheats, fake updates or email attachments. Once running, it grabs browser passwords, cookies, messenger sessions and FTP client settings, zips them up and ships them off within seconds. FileZilla, for example, keeps saved sites in these files on Windows, and without a master password the passwords are merely base64-encoded, not encrypted:
%APPDATA%\FileZilla\sitemanager.xml
%APPDATA%\FileZilla\recentservers.xml
Base64 is not encryption; anyone can decode it with one command, so the infostealer instantly has the server address, username and password. The same applies to many other FTP programs and to passwords saved in browsers.
Server-side protection cannot block this kind of attack in advance. From the host's point of view it is an ordinary, legitimate login: correct username, correct password, normal FTP commands. Until the source is found and the computer is cleaned, any cleanup on the server is only temporary.
Example: a furniture company in Andijan
A manager at a furniture maker in Andijan updates the catalogue from a work PC using FileZilla. He installs a "free" graphics editor found online. A week later customers report antivirus warnings, and Google shows a danger label next to the site. Every .js file has a foreign script appended, and the FTP log shows logins with the correct password from foreign IPs. Changing the hosting password does not help: two days later the site is infected again, because the new password was typed and saved on the same infected PC.
Signs the leak came from a computer
Files changed when no CMS update or plugin install happened, many files modified within minutes, and successful FTP logins from unfamiliar IPs all point to a stolen password. Over SSH you can look for recent changes and common malicious patterns:
find ~/public_html -type f \( -name "*.php" -o -name "*.js" \) -mtime -7 -ls
grep -rlE "eval\(base64_decode|gzinflate\(|str_rot13\(" ~/public_html --include=*.php
Not every hit is malicious, since some plugins use these functions legitimately, so review each file. Your hosting panel or support team can tell you where the FTP access logs are kept.
The right order: computer first, then passwords
- Scan every computer used to manage the site with a reliable antivirus; reinstall the OS in serious cases.
- From a clean device, change the hosting cabinet, FTP, database, CMS admin and email passwords.
- Restore files from a clean backup or clean them by hand, and remove unknown FTP users.
- Log out saved browser sessions, because stolen cookies can allow access without a password.
sayt.uz customers can update their cabinet password and hosting access details in the cabinet, and support can help identify which accounts exist.
Protecting passwords from now on
Do not save passwords in your FTP client, or protect them with a master password (in FileZilla this is under the Interface settings). Use SFTP instead of FTP and put a passphrase on your SSH key. Never install cracked software on a machine that manages websites; it is one of the main ways infostealers spread. Give each person a separate FTP account limited to the folder they need, restrict FTP to your office IP if the host allows it, and keep regular backups so the worst case is a few minutes of restoring.