Skip to content
TheChatArchiveThe Chat Archive
GLMGLM-5 / Pony Alpha· unknownHugging Face Frontier Reasoning Traces

Build a hacked content recovery runbook: triage, disavow, clean-up, and revalidation.

  1. User

    Build a hacked content recovery runbook: triage, disavow, clean-up, and revalidation.

  2. GLM Assistant

    The user is asking for a "hacked content recovery runbook." This implies the user's website (or a client's website) has been compromised, and they need a systematic process to:

    1. Triage: Assess the damage and contain it.
    2. Disavow: Handle bad backlinks (though "disavow" is specific to links, in a hack context, it often means removing the hacker's injected links or disavowing spammy links generated by the hack). However, in the context of "hacked content," "disavow" might be a slight misnomer or a specific request regarding SEO penalties. I should clarify or broaden this to "Mitigate SEO Impact" (which includes disavowing links if the hack created them or pointed to the site). Correction: In a "hacked content" scenario (like Japanese keyword hack or Pharma hack), "disavow" usually refers to disavowing the spammy backlinks pointing to the hacked pages to recover SEO standing.
    3. Clean-up: Remove the malicious code/content.
    4. Revalidation: Verify the site is clean and submit for review (Google Search Console, etc.).

    Target Audience: Webmasters, SEOs, DevOps, Site Owners. Tone: Professional, urgent, structured, actionable, authoritative.

    Key Phases:

    • Phase 0: Preparation & Lockdown (Immediate Action) - You can't clean a house while the burglar is still inside.
    • Phase 1: Triage & Assessment - What happened? How bad is it?
    • Phase 2: Clean Up (Technical) - Removing files and DB entries.
    • Phase 3: SEO Disavow & Mitigation - Addressing the "Disavow" request specifically.
    • Phase 4: Hardening - Preventing recurrence.
    • Phase 5: Revalidation & Review - Getting back into Google's good graces.

    Detailed Steps Brainstorming:

    • Phase 0 (Lockdown): Change passwords, put site in maintenance mode (optional but good), turn off user registrations.
    • Phase 1 (Triage): Check Google Search Console (GSC) "Security Issues." Check for spammy keywords in site: search. Identify the type of hack (Pharma, Japanese Keywords, Redirect, Ransomware).
    • Phase 2 (Cleanup): This is the heavy lifting. Back up the infected site (for forensics). Restore from a clean backup if available. If not, manual cleaning (look for modified dates, base64 code, excessive eval statements). Scan the Database (WP_options, etc.).
    • Phase 3 (Disavow): The user specifically asked for this. Why? Usually, hacks generate spammy links to the hacked pages to boost them, or the hacker injects links out to their money sites.
      • Action: Download backlinks from GSC/Moz/Ahrefs. Identify unnatural spikes. Disavow the toxic domains via the Disavow Tool.
    • Phase 4 (Revalidation): Submit the security review in GSC. Monitor index removal.

    Refining the "Disavow" section: The user's prompt order is "triage, disavow, clean-up, revalidation." I should stick to their requested structure but perhaps note that technically, you usually clean before you disavow, or simultaneously. However, if the hack created spammy pages that Google indexed, and those pages have bad links, you definitely need to disavow to ensure the penalty is lifted. Actually, Google says for "Hacked" manual actions, you need to fix the vulnerability AND clean the content. Disavowing is usually for "Unnatural Links" penalties. But, if the hack was a link injection scheme, disavowing is crucial. I will include it as a distinct step as requested.

    Structure of the Output:

    1. Header: Title and intent.
    2. Phase 1: Triage (Identify & Isolate): Diagnostics, scope definition.
    3. Phase 2: Disavow (Link & Reputation Management): Addressing the specific user request regarding disavowing (handling the spammy link profile created by the hack).
    4. Phase 3: Clean-Up (Eradication): The technical removal.
    5. Phase 4: Revalidation (Verification & Submission): GSC review request.
    6. Post-Mortem: Hardening.

    Self-Correction during drafting: Initial thought: Disavow is for Penguin penalties. Correction: When a site is hacked (e.g., Pharma hack), the attacker often builds thousands of spammy links to the injected URL to get it indexed and ranking. When you clean the page (404), those links still exist. While a 404 generally passes no equity, a massive amount of spam links can still flag a site for manual review or algorithmic devaluation in extreme cases. It is best practice to disavow links associated with a hack to clear the slate.

    Formatting: Use code blocks for commands (grep), checklists for actions, and bold text for emphasis.

    Let's build the runbook.

    Drafting Content:

    • Triage: Look for site:yourdomain.com + spammy keywords (viagra, casino). Check site:yourdomain.com for pages you didn't create. Check GSC Security Issues.
    • Disavow: Audit backlinks. If the hack injected outbound links, remove them in code. If the hack attracted spammy inbound links, disavow them.
    • Clean-up: The "Nuclear Option" (restore from backup) vs "Surgical Option" (manual removal). Mention specific commands like grep -r to find base64 injections.
    • Revalidation: The "Request Review" button. It takes time. Do not rush this.

    Final Polish: Ensure the tone is "Runbook" style—concise, command-oriented, step-by-step.

    (Self-Correction on Order): The user asked for "triage, disavow, clean-up, revalidation." I will follow this order but add a "Lockdown" pre-step because it's irresponsible to run a recovery runbook without telling them to lock the doors first.

    Let's assemble.

    • Title: Hacked Content Recovery Runbook (v1.0)
    • Pre-Check: Immediate containment.
    • Step 1: Triage: Identification.
    • Step 2: Disavow: (Interpreting this as 'Link & Index Sanitization').
    • Step 3: Clean-Up: Eradication.
    • Step 4: Revalidation: Submission.

    Make sure to include a warning: Do not request a review until you are 100% sure it is clean, or you will be rejected and go to the back of the line.

    The "Disavow" step is interesting. It usually happens after cleanup or concurrently. I will position it as "mitigating the SEO footprint of the attack."

    Let's write it out.

    • Triage: Use GSC, "site:" operator, check core files (checksums).
    • Disavow: Focus on the "Unnatural Links" generated by the hack.
    • Clean-up: Database cleaning (WP_options, users), File cleaning (diff vs source).
    • Revalidation: 404ing hacked pages, GSC submission.

    Okay, ready to generate response. This runbook outlines the procedures for recovering a website compromised by spam injections, phishing pages, or malware. It follows the NIST framework principles: Identify, Protect, Detect, Respond, Recover.

    Phase 0: Immediate Containment (Pre-Triage)

    Before analyzing logs, stop the bleeding.

    1. Take the Site Offline (Maintenance Mode): If the hack is actively distributing malware to users, take the site down immediately. If it is just "spammy content" (SEO hack), you can leave it up to work on it, but this is riskier.
    2. Reset All Credentials: Assume the attacker has admin access.
      • Change CMS admin passwords.
      • Change FTP/SFTP/SSH passwords.
      • Change database passwords (update wp-config.php or equivalent).
      • Revoke all API keys and OAuth tokens.
    3. Enable WAF / Block IPs: If you identified specific attacking IPs in the logs, block them at the firewall level immediately.

    Phase 1: Triage (Assessment)

    Goal: Understand the scope and vector of the attack.

    1. Identify the Type of Hack:

    • Spam SEO (Japanese/Pharma Keywords): Checks for site:yourdomain.com in Google. Look for strange folders or database entries.
    • Phishing (Social Engineering): Look for folders named paypal, bank, secure, or files like login.php in unrelated directories.
    • Backdoors/WShells: Files allowing remote execution (often obfuscated).

    2. Locate the Vector (How did they get in?):

    • Log Analysis: Check access.log for your CMS login page. Look for repeated POST requests from strange IPs followed by 200 OK status codes.
    • Plugin/Theme Audit: Check if any plugins were recently installed or if there are outdated plugins with known CVEs.
    • User Audit: Check the database users table. Are there new admin accounts with generic email addresses?

    3. Scope the Damage:

    • Run a diff command (if you have a clean backup) to see changed files.
    • Use CLI tools to find recently modified files:
      find . -type f -mtime -7 -ls
      

    Phase 2: Disavow (SEO Quarantine)

    Goal: Sever ties between your domain and the attacker's spammy links.

    1. Identify Spammy URLs:

    • Use Google Search Console (GSC) > Index > Pages (look for crawled but not indexed spam URLs).
    • Use site:yourdomain.com searches on Google/Bing.
    • Look for incoming links in GSC under Links. If you see thousands of links pointing to your site from shady domains, document them.

    2. Clean Internal Linking:

    • If the hack injected links into your legitimate pages (e.g., footer spam links), you must remove the code (see Phase 3).

    3. Submit the Disavow File (Google/Bing):

    • Create a .txt file listing the domains or specific URLs pointing to your site that you cannot remove (because they are on external sites).
    • Google: Search Console > Disavow Links tool.
    • Bing: Bing Webmaster Tools > Configure Your URL.
    • Note: Only do this if the hack created toxic backlinks to your site.

    Phase 3: Clean-Up (Eradication)

    Goal: Remove malicious code and artifacts.

    1. The "Nuclear" Option (Recommended):

    • Do not try to patch a dirty install. Delete all core CMS files and extensions.
    • Download a fresh copy of the CMS core, theme, and plugins from the official sources.
    • Restore your Database from a backup dated before the hack.
      • Warning: If the hack was purely database injection (e.g., WordPress options table), restoring a backup is the only safe route. If you must clean the DB manually, search for base64 encoded strings like eval, gzinflate, or suspicious iframe tags.

    2. Manual Cleaning (If no backup exists):

    • Delete unknown files: Remove any .php files inside /uploads/ or /images/ folders.
    • Remove Malicious Users: Delete unknown admin accounts in the DB.
    • Sanitize Configuration: Ensure wp-config.php (or equivalent) has the correct salts and keys (regenerate them).

    3. Backdoor Removal:

    • Search file contents for obfuscated code.
      grep -R "base64_decode" .
      grep -R "eval(" .
      grep -R "gzinflate" .
      
    • Check for cron jobs set up by the attacker (re-infection vectors).
      • Linux: crontab -l

    Phase 4: Revalidation & Hardening

    Goal: Prove to Google/Search Engines that you are safe.

    1. Request a Security Review (Google):

    • Go to Google Search Console > Security & Manual Actions.
    • If there is a "Hacked Site" penalty, click Request a Review.
    • Crucial: Be honest in the form. Explain exactly what you found and what you fixed. If you missed a backdoor, Google will reject the request, and you go back to Phase 1.

    2. Submit Re-indexing:

    • Once the penalty is lifted (or if there was no manual action), submit your sitemap again in GSC.
    • Use the "URL Inspection" tool to request indexing of your homepage.

    3. Hardening (Prevent Recurrence):

    • Updates: Enforce auto-updates for the CMS and plugins.
    • File Permissions: Ensure folders are 755 and files are 644. No folders should be 777.
    • Disable File Editing: In WordPress, add define('DISALLOW_FILE_EDIT', true); to config.
    • Install a WAF: Cloudflare, Sucuri, or a server-side WAF (ModSecurity).
    • SSL: Ensure HTTPS is forced everywhere.

    Post-Mortem Checklist

    • All passwords changed (Server, DB, Admin).
    • All plugins/themes updated to latest versions.
    • Unused plugins/themes deleted.
    • Backups verified and scheduled.
    • Security Review Request submitted to Google.
    • Traffic logs monitored for 48 hours for anomalies.