Why is this

Started on the old forum in December 2009 · view the original in the archive · old links redirect here

5 replies · 425 views · started 16 years ago · 1 min read

6 participants
shad0w Developer · 119 posts #3

valentin2br wrote: what do you think uses something:)) wait to see Wapmaster who know

I think that protects the scripts againsts hackers ... sql injection, shell etc... It`s hard to put that in lavalair ....

whatmp3.name - search mp3 on mobile

wap2k Developer · 168 posts #4

// Include files and connect to the database.

include("config.php");
include("core.php");
$bcon = connectdb();
if (!$bcon){

This Function Logs a hacking attempt and deletes the user using there logged in uid.

function crk($l){
global $CURUSER;
write_log("Hacking Attempt! User:" . $CURUSER['username'] . " IP:".$_SERVER['REMOTE_ADDR']." - Attempt: ".$l, "delete");
header("Location: /index.php");
exit();
}

This is another bad words list. Theses are common words used in Cross-site scripting (XSS), RFI (Remote File Inclusion) and LFI (Local File Inclusion) Exploits in web applications which enable malicious attackers to inject malicious data into a site sometimes gaining full control using a Shell injection script (c99,r57).

$ban2 = array(
"delete from",
"ibwf_users",
"<script", 
"<object", 
".write", 
".location", 
".cookie", 
".open", 
"vbscript:", 
"<iframe", 
"<layer", 
"<style", 
":expression", 
"<base", 
"id_level", 
"users_level", 
"xbt_", 
"c99.txt", 
"c99shell", 
"r57.txt", 
"r57shell.txt",
"/home/", 
"/var/", 
"/www/", 
"/etc/", 
"/bin", 
"/sbin/", 
"\$_GET", 
"\$_POST", 
"\$_REQUEST", 
"window.open", 
"javascript:", 
"xp_cmdshell",  
".htpasswd", 
".htaccess", 
"<?php", 
"<?", 
"?>", 
"</script>"
);

This PHP $_SERVER variable contains the URI (URL) from the servers point of view (may be something like index.php?sid=2h5h4h76j7g77)

$cepl = $_SERVER['QUERY_STRING'];

If a URI (URL) was returned make it all lowercase and remove harmful characters often used in RFI and LFI exploits.

if (!empty($cepl))
$cepl = strtolower(urldecode(preg_replace('/([\x00-\x08][\x0b-\x0c][\x0e-\x20])/', '', $cepl)));

Bad words list. Used to block Sql injection.

$ban = array();
$ban["union"] = "select";
$ban["update"] = "set";
$ban["drop"] = "table";
$ban["alter"] = "table";
$ban["truncate"] = "table";
$ban["drop"] = "database";
$ban["create"] = "table";
$ban["set password for"] = "@";

Remove those bad words from the url

foreach ($ban as $k => $l)
if (str_replace($k, '', $cepl) != $cepl && str_replace($l,'',cepl) != $cepl)
crk($cepl);
if (str_replace($ban2, '', $cepl) != $cepl) crk($cepl);

Join the $_REQUEST variables together into a string (THESE CONTAIN $_GET, $_REQUEST,$_COOKIES variables like PHP GLOABALS).

$cepl = implode(" ", $_REQUEST);

if (!empty($cepl))   $cepl = strtolower(urldecode(preg_replace('/([\x00-\x08][\x0b-\x0c][\x0e-\x20])/', 
'', $cepl)));

Split the string we created earlier and Search and replace all bad word in $_GET, $_POST,$_COOKIE server variables

foreach ($ban as $k => $l)  if (str_replace($k, '', $cepl) != $cepl && str_replace($l, '', $cepl) != $cepl)  crk($cepl);

If the user has been trying to exploit your site using the cookies delete them.

if (str_replace($ban2, '', $cepl) != $cepl)  crk($cepl);

Join the cookie variables together into a string.

$cepl = implode(" ", $_COOKIE);

If there are any cookies returned make them all lowercase and remove harmful characters often used in RFI and LFI exploits.

if (!empty($cepl))  $cepl = strtolower(urldecode(preg_replace('/([\x00-\x08][\x0b-\x0c][\x0e-\x20])/', '', $cepl)));

Separate the cookies string we created earlier and replace badwords.

foreach ($ban as $k => $l) if(str_replace($k, '', $cepl) != $cepl && str_replace($l, '',$cepl) != $cepl) crk($cepl);

If the user has been trying to exploit your site using the cookies delete them.

if(str_replace($ban2, '', $cepl) !=$cepl)  crk($cepl);

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close