一、介绍
先简单了解一下fofa的语法都有哪些,分别是什么(以下省略了专业版搜索功能语句)
逻辑连接符
= 匹配,=""时,可查询不存在字段或者值为空的情况。
== 完全匹配,==""时,可查询存在且值为空的情况。
&& 与
|| 或者
!= 不匹配,!=""时,可查询值为空的情况。
*= 模糊匹配,使用*或者?进行搜索,比如banner*="mys??" (个人版及以上可用)。
() 确认查询优先级,括号内容优先级最高。
title="beijing" 从标题中搜索“北京”
header="elastic" 从http头中搜索“elastic”
-
body="网络空间测绘" 从html正文中搜索“网络空间测绘”
-
fid="sSXXGNUO2FefBTcCLIT/2Q==" 查找相同的网站指纹
domain="qq.com" 搜索根域名带有qq.com的网站
-
icp="京ICP证030173号" 查找备案号为“京ICP证030173号”的网站
js_name="js/jquery.js" 查找网站正文中包含js/jquery.js的资产
js_md5="82ac3f14327a8b7ba49baa208d4eaa15" 查找js源码与之匹配的资产
-
cname="ap21.inst.siteforce.com" 查找cname为"ap21.inst.siteforce.com"的网站
-
cname_domain="siteforce.com" 查找cname包含“siteforce.com”的网站
-
cloud_name="Aliyundun" 通过云服务名称搜索资产
-
product="NGINX" 搜索此产品的资产
category="服务" 搜索此产品分类的资产
icon_hash="-247388890" 搜索使用此 icon 的资产
host=".gov.cn" 从url中搜索”.gov.cn”搜索要用host作为名称
port="6379" 查找对应“6379”端口的资产
-
ip="1.1.1.1" 从ip中搜索包含“1.1.1.1”的网站搜索要用ip作为名称
ip="220.181.111.1/24" 查询IP为“220.181.111.1”的C网段资产
-
status_code="402" 查询服务器状态为“402”的资产
protocol="quic" 查询quic协议资产
country="CN" 搜索指定国家(编码)的资产
-
region="Xinjiang Uyghur Autonomous Region" 搜索指定行政区的资产
-
city="Ürümqi" 搜索指定城市的资产
-
cert="baidu" 搜索证书(https或者imaps等)中带有baidu的资产
-
cert.subject="Oracle Corporation" 搜索证书持有者是Oracle Corporation的资产
-
cert.issuer="DigiCert" 搜索证书颁发者为DigiCert Inc的资产
-
cert.is_valid=true 验证证书是否有效,true有效,false无效
cert.is_match=true 证书和域名是否匹配;true匹配、false不匹配
cert.is_expired=false 证书是否过期;true过期、false未过期
jarm="2ad...83e81" 搜索JARM指纹
-
banner="users" && protocol="ftp" 搜索FTP协议中带有users文本的资产
-
type="service" 搜索所有协议资产,支持subdomain和service两种
os="centos" 搜索CentOS资产
-
server=="Microsoft-IIS/10" 搜索IIS 10服务器
-
app="Microsoft-Exchange" 搜索Microsoft-Exchange设备
-
after="2017" && before="2017-10-01" 时间范围段搜索
-
asn="19551" 搜索指定asn的资产
-
org="LLC Baxet" 搜索指定org(组织)的资产
-
base_protocol="udp" 搜索指定udp协议的资产
-
is_domain=true 搜索域名的资产,只接受true和false
is_cloud=true 筛选使用了云服务的资产
-
port_size="6" 查询开放端口数量等于"6"的资产
port_size_gt="6" 查询开放端口数量大于"6"的资产
port_size_lt="12" 查询开放端口数量小于"12"的资产
ip_ports="80,161" 搜索同时开放80和161端口的ip
ip_country="CN" 搜索中国的ip资产
ip_region="Zhejiang" 搜索指定行政区的ip资产(以ip为单位的资产数据)
ip_city="Hangzhou" 搜索指定城市的ip资产(以ip为单位的资产数据)
ip_after="2021-03-18" 搜索2021-03-18以后的ip资产
ip_before="2019-09-09" 搜索2019-09-09以前的ip资产
二、fofa搜索组合拳
1、查找未授权访问漏洞:
title="401 Unauthorized" || title="403 Forbidden" || title="404 Not Found"
上述语法表示搜索所有返回“401 Unauthorized”、“403 Forbidden”或“404 Not Found”的页面,这些页面通常可能存在未授权访问漏洞。
2、查找弱口令漏洞:
title="401 Unauthorized" && body="input type=password" && status_code=200
方法二
body="<input type=\"password\""
上述语法表示搜索所有返回“401 Unauthorized”的页面,并且包含HTML表单,表单中包含type=password的输入框,返回状态码为200的页面,这些页面通常可能存在弱口令漏洞。
3、查找文件上传漏洞:
title="Upload" && body="form enctype=multipart/form-data method=post"
方法二:
body="<form[^>]*?enctype=\"multipart/form-data\"[^>]*?>"
上述语法表示搜索所有包含“Upload”关键词的页面,并且包含enctype=multipart/form-data、method=post的HTML表单,这些页面通常可能存在文件上传漏洞。
4、查找CMS漏洞:
title="Powered by WordPress" || title="Powered by Joomla" || title="Powered by Drupal"
上述语法表示搜索所有返回“Powered by WordPress”、“Powered by Joomla”或“Powered by Drupal”的页面,这些页面通常可能存在相关CMS的漏洞。
5、查找Web漏洞
title="404 Not Found" || title="403 Forbidden" || title="401 Unauthorized" || title="500 Internal Server Error" || title="502 Bad Gateway" || title="503 Service Unavailable" || title="SQL Error" || title="ASP.NET Error"
上述语法表示搜索所有返回“404 Not Found”、“403 Forbidden”、“401 Unauthorized”、“500 Internal Server Error”、“502 Bad Gateway”、“503 Service Unavailable”、“SQL Error”或“ASP.NET Error”的页面,这些页面通常可能存在Web漏洞。
6、查找未加密的数据库:
title="phpMyAdmin" || title="MySQL" || title="phpPgAdmin" || title="PostgreSQL" || title="Microsoft SQL Server" && body="input type=password"
上述语法表示搜索所有返回“phpMyAdmin”、“MySQL”、“phpPgAdmin”、“PostgreSQL”或“Microsoft SQL Server”的页面,并且包含type=password的HTML表单,这些页面可能存在未加密的数据库。
7、查找存储型XSS漏洞:
body="textarea" && body="input type=text" && body="input type=password"
上述语法表示搜索所有包含HTML文本输入框和密码输入框的页面,并且包含textarea的HTML表单,这些页面可能存在存储型XSS漏洞。
8、查找常见漏洞指纹
title="404 Not Found" || title="403 Forbidden" || title="401 Unauthorized" || title="500 Internal Server Error" || title="502 Bad Gateway" || title="503 Service Unavailable" || title="SQL Error" || title="ASP.NET Error" || title="404" || title="Login - Powered by Discuz" || title="Login - Powered by UCenter" || title="Powered by DedeCMS" || title="Powered by PHPWind" || title="Powered by discuz" || title="Powered by phpMyAdmin" || title="Powered by phpwind" || title="Powered by vBulletin" || title="Powered by wordpress" || title="phpMyAdmin" || title="phpinfo" || title="Microsoft-IIS" || title="Joomla" || title="Drupal" || title="WordPress" || title="Apache Tomcat" || title="GlassFish Server" || title="nginx" || title="Oracle HTTP Server"
上述语法表示搜索包含常见漏洞指纹的页面,例如Web服务器和CMS名称、错误页面、phpinfo、phpMyAdmin等等。
9、查找远程命令执行漏洞:
body="<form method=\"post\" enctype=\"multipart/form-data\" action=\"\S*/index.php\" name=\"form\" id=\"form\">"
上述语法表示搜索包含特定HTML表单的页面,该表单通常存在远程命令执行漏洞。
总结
有没有觉得思路打开了,师傅们,有补充的话可以和我交流一下,谢谢师傅们~