Waraxe IT Security Portal
Login or Register
June 16, 2025
Menu
Home
Logout
Discussions
Forums
Members List
IRC chat
Tools
Base64 coder
MD5 hash
CRC32 checksum
ROT13 coder
SHA-1 hash
URL-decoder
Sql Char Encoder
Affiliates
y3dips ITsec
Md5 Cracker
User Manuals
AlbumNow
Content
Content
Sections
FAQ
Top
Info
Feedback
Recommend Us
Search
Journal
Your Account
User Info
Welcome, Anonymous
Nickname
Password
(Register)

Membership:
Latest: MichaelSnaRe
New Today: 0
New Yesterday: 0
Overall: 9144

People Online:
Visitors: 54
Members: 0
Total: 54
Full disclosure
SEC Consult SA-20250604-0 :: Local Privilege Escalation and Default Credentials in INDAMED - MEDICAL OFFICE (Medical practice management) Demo version
Full Disclosure: CVE-2025-31200 & CVE-2025-31201 – 0-Click iMessage Chain ? Secure Enclave Key Theft, Wormable RCE, Crypto Theft
Defense in depth -- the Microsoft way (part 89): user grouppolicies don't deserve tamper protection
CVE-2025-45542: Time-Based Blind SQL Injection in CloudClassroom PHP Project v1.0
ERPNext v15.53.1 Stored XSS in bio Field Allows Arbitrary Script Execution in Profile Page
ERPNext v15.53.1 Stored XSS in user_image Field Allows Script Execution via Injected Image Path
Local information disclosure in apport and systemd-coredump
Stored XSS via File Upload - adaptcmsv3.0.3
IDOR "Change Password" Functionality - adaptcmsv3.0.3
Stored XSS "Send Message" Functionality - adaptcmsv3.0.3
Authenticated File Upload to RCE - adaptcmsv3.0.3
Stored XSS in "Description" Functionality - cubecartv6.5.9
Multiple Vulnerabilities in SAP GuiXT Scripting
CVE-2024-47081: Netrc credential leak in PSF requests library
Exploit CVE-2019-9978: Remote Code Execution in Social Warfare WordPress Plugin (<= 3.5.2)
Log in Register Forum FAQ Memberlist Search
IT Security and Insecurity Portal

www.waraxe.us Forum Index -> Sql injection -> Injectable?
Post new topicReply to topic View previous topic :: View next topic
Injectable?
PostPosted: Fri Jan 13, 2006 7:25 am Reply with quote
e-rased
Beginner
Beginner
Joined: Jan 13, 2006
Posts: 2




There's a popular mod-addon out for IBStore(Invision Power Board mod) called Transactions Mod...I looked the source over and some of the sql query values aren't checked or sanitized...Can anyone look it over and tell me what you could do with it? I imagine union would be of use but I'm new to exploits...

Code:

<?php



$idx = new trans;

class trans
{
var $output = "";
var $page_title = "";
var $nav = array();
var $html = "";


function trans()
{
global $ibforums, $forums, $DB, $std, $print, $skin_universal;

$ibforums->lang = $std->load_words($ibforums->lang, 'lang_trans', $ibforums->lang_id );
$this->html = $std->load_template('skin_trans');
$this->base_url = $ibforums->base_url;


//// $this->output = $this->html->test();


////Here we build the transactions page.
////right here i'm checking to see if the $_GET[] vars are defined. if they aren't, i define them.

if ( ! isset( $ibforums->input['method'] ) )
{
$ibforums->input['method'] = "global";
$method = "global";
}
else
{
$method = $ibforums->input['method'];
}

if ( ! isset( $ibforums->input['current'] ) )
{
$ibforums->input['current'] = "0";
$current = 0;
}
else
{
$current = $ibforums->input['current'];
}
///We're done checking our get vars.
///Here i'm going to switch() on the case of $method

switch($method){

case "global";
$sql_count = "SELECT * from ipb_store_logs";

////get the number of rows
$total_rows = mysql_num_rows($therows= mysql_query($sql_count));

////get the total amount of pages, round up
$totalpages = floor($total_rows/50);

////total items
$totalled_items = $totalpages * 50;
////the current page number
$curpage = ceil(($current) / 50);


$the_tmp .= "<br />";
$the_tmp .= "<form action=\"index.php?act=trans&method=search\" method=\"GET\">Search for a user's transactions:
<input type=\"hidden\" value=\"trans\" name=\"act\">
<input type=\"hidden\" value=\"search\" name=\"method\">
<input type=\"text\" name=\"user\" value=\"$user\"><input type=\"submit\" value=\"Search\"></form>";
$the_tmp .= "<center>";
$the_tmp .= "<br />";


///Before pages
$thetmpshow = $curpage + 1;
$the_tmp .= "<b>Current: $thetmpshow</b><br />";
$the_tmp .= "<a href=\"index.php?act=trans&current=0\"><<[</a> ";
$page_min = $curpage - 11;
if($page_min<0){
$page_min = 0;
$page_num = 1;
}
elseif($page_min>0){
$page_min = $page_min - 1;
if($page_min==0){
$page_num = 1;
}
else{
$page_num = $page_min+1;
}
}
$itmp = ($page_min*50);

while($itmp<($curpage*50) AND $page_num>$page_min) {
$the_tmp .= "<a href=\"index.php?act=trans&current=$itmp\"> $page_num</a> ";
$itmp = $itmp + 50;
$page_num = $page_num + 1;
}

$the_tmp .= "<b>$thetmpshow</b> ";

///after pages

$page_max = $curpage + 11;

if($page_max>$totalpages){
$page_max = $totalpages;
}
$page_num = $curpage + 1;
$items_max = $pages_max * 50;
$itmp = $page_num * 50;
if($curpage<$totalpages){
while($page_num < $page_max) {
$page_num = $page_num + 1;
$the_tmp .= "<a href=\"index.php?act=trans&current=$itmp\">$page_num</a> ";
$itmp = $itmp + 50;
}
}
$the_tmp .= "<a href=\"check.php?current=$totalled_items\">]>></a>";
$the_tmp .= "</center>";

$the_tmp .= "<br />";


$query = "SELECT * FROM ipb_store_logs ORDER by lid DESC LIMIT $current, 50";

$pigfuck = mysql_query($query);



$the_tmp .= "<br><br>";

$the_tmp .= "<div align=\"right\"></div>";
$the_tmp .= "<table border=\"1\" width=\"100%\" Cellpaddinng=\"2\">";
$the_tmp .= "<th width=\"5%\" nowrap>ID</th>";
$the_tmp .= "<th width=\"50%\" nowrap>Message</th>";
$the_tmp .= "<th width=\"10%\" nowrap>Username</th>";
$the_tmp .= "<th width=\"10%\" nowrap>Action</th>";
$the_tmp .= "<th width=\"25%\">Time</th>";


while($query_data = mysql_fetch_array($pigfuck)) {
$lid = $query_data["lid"];
$lmessage = $query_data["lmessage"];
$luserid = $query_data["luserid"];
$ltype = $query_data["ltype"];
$ltime = $query_data["ltime"];


$midgettoss = date('r',$ltime);
$midgettoss = str_replace(',','',$midgettoss);
$midgettoss = explode("-", $midgettoss);


if($ltype == "donate_m"){
$ltype = "Donated";
}

if($ltype == "bought_item"){
$ltype = "Purchase";
}

if($ltype == "titleeffect"){
$ltype = "Title";
}

//Edit

$dirt = "SELECT name FROM ipb_members WHERE id = '$luserid'";

$whore = mysql_query($dirt);

$try = mysql_fetch_array($whore);
$tip = $try["name"];
if($tip==""){
$tip = "Unkown user?!";
}


$the_tmp .= "<TR>\n";
$the_tmp .= "<TD width=\"5%\" align=\"center\">$lid</td>\n";
$the_tmp .= "<TD width=\"50%\" align=\"center\">$lmessage</td>\n";
$the_tmp .="<TD width=\"10%\" align=\"center\"><a href=\"index.php?showuser=$luserid\">$tip</a></td>\n";
$the_tmp .= "<TD width=\"10%\" align=\"center\">$ltype</td>\n";
$the_tmp .= "<TD width=\"25%\" align=\"center\">$midgettoss[0]</td>\n";
$the_tmp .= "</tr>\n";
}
$the_tmp .= "</table>";


$the_tmp .= "<br /> <br />";
$the_tmp .= "<center>";
$the_tmp .="<a href=\"index.php?act=trans&current=0\"><<[</a> ";
///Before pages

$page_min = $curpage - 11;
if($page_min<0){
$page_min = 0;
$page_num = 1;
}
elseif($page_min>0){
$page_min = $page_min - 1;
if($page_min==0){
$page_num = 1;
}
else{
$page_num = $page_min + 1;
}
}
$itmp = ($page_min*50);

while($itmp<($curpage*50) AND $page_num>$page_min) {
$the_tmp .= "<a href=\"index.php?act=trans&current=$itmp\"> $page_num</a> ";
$itmp = $itmp + 50;
$page_num = $page_num + 1;
}

$the_tmp .= "<b>$thetmpshow</b> ";

///after pages

$page_max = $curpage + 11;

if($page_max>$totalpages){
$page_max = $totalpages;
}
$page_num = $curpage + 1;
$items_max = $pages_max * 50;
$itmp = $page_num * 50;
if($curpage<$totalpages){
while($page_num < $page_max) {
$page_num = $page_num + 1;
$the_tmp .= "<a href=\"index.php?act=trans&current=$itmp\">$page_num</a> ";
$itmp = $itmp + 50;
}
}

$the_tmp .= "<a href=\"check.php?current=$totalled_items\">]>></a>";

$the_tmp .= "</center>";
break;
/////YAY !!!!1!~1`1!1 We're done with the global case!

default:
}
echo "</center>";
$this->output = $the_tmp;
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $ibforums->lang['page_title'], 'JS' => 0, NAV => array( $ibforums->lang['page_title'] ) ) );
}
}
?>


$current is never checked, and it directly queries the database without any 'sanitisation'...any ideas?
View user's profile Send private message
PostPosted: Sat Jan 14, 2006 1:53 pm Reply with quote
Pi3cH
Regular user
Regular user
Joined: Dec 15, 2005
Posts: 7




could give me live example?

the $curpage limited at this line of code:
$curpage = ceil(($current) / 50);
View user's profile Send private message
PostPosted: Sat Jan 14, 2006 8:33 pm Reply with quote
e-rased
Beginner
Beginner
Joined: Jan 13, 2006
Posts: 2




$query = "SELECT * FROM ipb_store_logs ORDER by lid DESC LIMIT $current, 50";

$curpage is just a var for rendering the before/after links...current isn't touched
View user's profile Send private message
PostPosted: Tue Jan 17, 2006 2:24 pm Reply with quote
Pi3cH
Regular user
Regular user
Joined: Dec 15, 2005
Posts: 7




oh! i dont see the left part of =,

could you give live example?
View user's profile Send private message
Injectable?
www.waraxe.us Forum Index -> Sql injection
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT
Page 1 of 1

Post new topicReply to topic


Powered by phpBB © 2001-2008 phpBB Group



PCWizardHub - Helping you fix, build, and optimize your PC life
All logos and trademarks in this site are property of their respective owner. The comments and posts are property of their posters, all the rest (c) 2004-2024 Janek Vind "waraxe"
Page Generation: 0.036 Seconds