A compromised Drupal site rarely announces itself. Most of the time you notice something small: an account you do not recognise, a page that redirects somewhere odd, or a warning in search results. This guide covers the signs to look for, how to confirm them, and what to do first.
Common signs a Drupal site has been compromised
No single sign proves a break-in, but several together are a strong signal. Check for these:
- Unexpected administrator accounts. New users with the administrator role, or an existing editor account that suddenly has extra permissions.
- Changed content. Pages, blocks or menu links that nobody on your team edited, especially links to unrelated products or sites.
- Unwanted redirects. Visitors, often only those arriving from search or on mobile, land on a different site. Redirects that appear only for some visitors are a common way to hide a problem from the site owner.
- Spam pages. Pages in another language or about unrelated topics that you never published, sometimes visible only in search results.
- Injected scripts. Unfamiliar JavaScript in page templates, custom blocks or text fields, or script tags loading from domains you do not use.
- Search or browser warnings. A security warning in Google Search Console, a browser interstitial, or search results showing titles you did not write.
- Unexplained load or mail. A sudden rise in server load, outbound email you did not send, or files you do not recognise on the server.
Some of these have harmless causes. A marketing tag added by a colleague can look like an injected script, so confirm before you assume the worst.
How to confirm what you are seeing
Start with the places Drupal itself records activity. Work from the least invasive checks to the more technical ones.
Review users and roles
Open the People page in the administration area and filter by role. Look for accounts you cannot match to a real person, recently created accounts, and users whose email addresses do not fit your organisation. If you have Drush, drush user:information shows details for a single account.
Read the logs
If the Database Logging module is enabled, the Recent log messages report shows logins, content changes and errors. Look for repeated failed logins, logins at odd hours, and access-denied entries for pages that do not exist. Many sites send logs to the web server or syslog instead, so check what your setup actually uses. Web server access logs are often the best record of unusual requests, though how long they are kept depends on your hosting.
Compare your configuration with what you deployed
If you use configuration management, drush config:status compares the live site with your exported configuration. Differences you did not make, such as altered text formats, new roles or changed permissions, deserve a closer look.
Check the code against known-good copies
A site managed with Composer should match your version control and the lock file. Compare the code on the server with your repository, and look for files that are not part of core or any module you installed. Pay particular attention to PHP files in upload directories, since those folders should hold media rather than code. Also check the files directory, settings.php and any custom modules or themes.
Inspect the rendered page
View the page source as an anonymous visitor and search for script tags, iframes and hidden links. Check the same page from a phone and arriving from a search result, since some attacks only show for those visitors. Also review custom blocks, the body fields of important pages, and any text format that allows full HTML, because that is where injected markup often sits.
You can also confirm whether your software was exposed. Compare your installed core and contributed module versions with the advisories listed on the Drupal Security Team pages, and run composer audit if your project uses Composer. Running a version that is past end of life, such as Drupal 7 (which reached end of life on 5 January 2025), raises the likelihood that a known weakness was used.
First steps once you suspect a compromise
Act in a sensible order. Cleaning first and investigating later can destroy the evidence you need.
- Take a full backup of the current state. Files and database, stored somewhere separate. This is your evidence, not your recovery point.
- Contain the site. Put it into maintenance mode, or restrict access at the web server or CDN, if visitors may be harmed. Ask your host what they can do at network level.
- Change credentials. Reset passwords for all privileged Drupal accounts, hosting and SSH or SFTP logins, the database user and any API keys stored on the site. Block accounts you cannot account for with drush user:block rather than deleting them, so the records stay available.
- Rotate the hash salt and secrets. If the attacker could read settings.php, assume everything in it is exposed.
- Find the way in. Check which module or core version was outdated, which account was used, and which log entries show the first unusual request.
- Clean or restore. Restoring from a backup taken before the problem began, then applying all updates, is usually safer than hunting through files. Rebuild caches afterwards with drush cache:rebuild.
If you cannot tell how far the problem reaches, a rebuild from version control and a clean Composer install on fresh hosting is the most reliable option. Import only the content and database data you have checked.
After the cleanup
Updating alone does not finish the job. Verify that the original weakness is closed, otherwise the same entry point will be used again.
- Apply all core and contributed module updates through Composer, and remove modules and themes you do not use.
- Review roles and remove permissions that are broader than needed. Give editors the least access they need, and use strong passwords with two-factor authentication where your setup supports it.
- Make sure file permissions stop the web server from writing to code directories.
- Consider a Content Security Policy, which can limit where scripts load from. The MDN guide to Content Security Policy explains how it works, and the OWASP Top Ten lists the common web application risks worth reviewing.
- Subscribe to Drupal security announcements so advisories reach you directly, and follow a set routine for responding to them.
- Ask Google to review the site through Search Console if it was flagged, once you are sure the site is clean.
Keep a written note of what you found, what you changed and when. It helps with any later investigation and shows what to check next time.
Frequently asked questions
Can I tell a compromise from a plugin or module conflict?
Usually, yes. A conflict tends to cause errors, broken layouts or failed updates, and it shows up in the logs as PHP errors. A compromise tends to add things: new users, files, links, scripts or redirects that nobody on your team created.
Is it safe to just delete the suspicious files?
Not on its own. Attackers often leave several entry points, such as a second file, an extra account or a changed setting. Deleting the visible one can leave the others in place. Take a backup first, find how access was gained, and restore from a known-good state where you can.
Should I delete unknown admin users?
Block them first and keep the records so you can see when they were created and what they did. Delete them only once you have finished investigating and know the account is not needed.