Skip to content

Theme Change Detection

Alert ID: theme_changes MITRE ATT&CK: T1072 – Software Deployment Tools


LevelCondition
LowExisting theme update
MediumTheme deletion
HighNew theme installation or active-theme change

  • Nulled or pirated themes: often include hidden backdoors and malware.
  • Active-theme change: can alter site functionality or weaken security.
  • Malicious code in functions.php: automatic execution when the theme loads.
  • Defacement: full alteration of the site’s appearance.
  • Data exfiltration: themes that expose sensitive information to external domains.

  • Theme change: switch_theme hook.
  • Installation: upgrader_process_complete with type=theme.
  • Update: upgrader_process_complete with action=update.
  • Deletion: deleted_theme hook.
  • Parent theme check: detection of changes in child themes.

TypePattern / ExampleDescription
file_pattern@ini_set('display_errors', 0);Code often seen in nulled themes
file_pattern$GLOBALS['_876'] = base64_decodeMalicious obfuscated code
networkwp_remote_get('http://suspicious-domain.com')Communication with external domains
file_patterntheme_temp_setup function hookSuspicious hook in functions.php

  • Planned design changes or maintenance.
  • Theme testing in staging environments.
  • Legitimate automatic updates.
  • Creation or modification of child themes.

  1. Verify theme legitimacy: official source, license, and version.

  2. Analyze code for external calls:

    Terminal window
    grep -r "http://" wp-content/themes/[theme-name]
  3. Search for obfuscation or suspicious execution:

    Terminal window
    grep -r "base64_decode\|eval\|gzinflate" wp-content/themes/[theme-name]
  4. Compare with the original theme version and validate checksums where available.


=== “Immediate”

!!! danger ""
- Revert to the previous theme if suspicious behavior is detected.
- Scan the theme with security or antimalware tools.
- Validate the integrity of all active-theme files.
- Create a full backup before any modification.

=== “Preventive”

!!! tip ""
- Install themes only from trusted and verified sources.
- Avoid nulled or pirated themes.
- Test all changes in staging before production.
- Monitor changes to `functions.php` and theme files.
- Use child themes for safe, traceable customizations.

  • Theme Security Guidelines – WordPress.org
  • ThemeForest Malicious Code Check