Skip to content

Instantly share code, notes, and snippets.

@danreb
Created October 16, 2014 06:22
Show Gist options
  • Save danreb/d6c85637ead57fcda287 to your computer and use it in GitHub Desktop.
Save danreb/d6c85637ead57fcda287 to your computer and use it in GitHub Desktop.
Do a find and replace to apply the patch for SA-CORE-2014-005 - Drupal core - SQL injection
#!/bin/bash
find . -type f -name "database.inc" -exec sed -i 's/foreach ($data as $i => $value) {/foreach (array_values($data) as $i => $value) {/g' {} \;
@danreb
Copy link
Author

danreb commented Oct 16, 2014

HOW TO USE?

  • Create a shell script file in your Linux server e.g "sql-injection-patcher.sh" and copy the code above.

    touch sql-injection-patcher.sh

  • Add execute permission to script using CHMOD command

    chmod +x sql-injection-patcher.sh

  • Execute the script

    sh sql-injection-patcher.sh

    ENJOY!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment