Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
SQL injection patch :)
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2023-01-16 12:23:05

//Get User Details And Permissions
$res = SQL_Query_exec("SELECT * FROM users INNER JOIN groups ON users.class=groups.group_id WHERE id='".sqlesc($_COOKIE['uid'])."' AND users.enabled='yes' AND users.status = 'confirmed'");
$row = mysqli_fetch_assoc($res);
2023-01-16 16:28:39
What you should do is prepare the statement so this isn’t possible, currently it is still insecure and is calling a super global (cookie no less) with no filtering.

This looks like a cookie injection vulnerability, possibly by accident. Maybe your still learning, that is possible.

Also, why are you directing the where clause (if) field to a cookie value? You should use the provided global $CURUSER[]: username, id, email, etc
2023-01-19 22:30:07
function detect_sqlinjection($query)  {
       $query = preg_replace("#(\\\'|\\\")#si", "", $query);
       $query = preg_replace("#'(.*?)'#si", "", $query);
       if (preg_match("#(UNION|INTO\sOUTFILE|INTO\sDUMPFILE|LOAD_FILE\s\((.*?)\)|BENCHMARK\s\((.*?)\)|\<\?php(.*?)\?\>|USER\s\((.*?)\)|DATABASE\s\((.*?)\)|\#|\-\-|\\\\*(.*?)\*\\\)#si", $query))
die("SQL Injection DETECTED! HA-HA!");
}

Last edited by coco on 2023-01-19 22:32:21
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 2
  • Members: 0
  • Guests online: 2
  • Comments: 3
  • Messages: 1,728