问答
发起
提问
文章
攻防
活动
Toggle navigation
首页
(current)
问答
商城
实战攻防技术
漏洞分析与复现
NEW
活动
摸鱼办
搜索
登录
注册
资产收集常用工具以及思路总结
渗透测试
渗透测试中拿到目标资产后需要对目标资产进行资产整理再进行测试,目标资产形式可能是企业名称、域名信息等。此篇文章主要总结对目标资产收集的一些思路、渠道和工具等。
前言: --- 渗透测试中拿到目标资产后需要对目标资产进行资产整理再进行测试,目标资产形式可能是企业名称、域名信息等。此篇文章主要总结对目标资产收集的一些思路、渠道和工具等。 0x01 企业信息以及知识产权 --------------- 一般拿到目标资产如果是公司名称的时候可以通过企业信息去获取更多信息。 1、可以使用:天眼查、企查查、爱企查、小蓝本等工具查询。 结合知识产权下的信息进行收集,会展示域名、小程序、app、公众号等。  2、查询股权控制,通过控股比例去收集子公司。  3、通过微信搜索公司名称查看涉及到的小程序等资产,也可以通过看一些热点或者文章中的公司合作方(与第三方合作的小程序资产主体并不是该公司但是在协议里会写明有参与),可以看用户协议、隐私政策中的归属使用方。   4、通过ICP备案查询 工业和信息化部政务服务平台:<https://beian.miit.gov.cn/#/Integrated/index>  站长之家:<http://icp.chinaz.com/>  0x02 域名及IP信息 ------------ 如果给出的目标资产是域名形式,那么可以进行资产测绘,收集其IP和子域名信息。 1、子域名通过工具辅助测试 (1)子域名在线查询:<https://zh.subdomains.whoisxmlapi.com/lookup>  (2)Subdomian Finder在线查找:<https://pentest-tools.com/information-gathering/find-subdomains-of-domain>  (3)OneForAll:高效暴破爬取子域名 项目地址:<https://github.com/shmilylty/OneForAll>  2、利用DNS记录公开数据: (1)ip138:<https://site.ip138.com/ip/domain.htm>  (2)hackertarget:<https://hackertarget.com/find-dns-host-records/>  (3)netcraft:<https://searchdns.netcraft.com/>  (4)ViewDNS.info:<http://viewdns.info/>   3、暴破子域名 通过现有的工具暴破: <https://github.com/knownsec/ksubdomain> <https://github.com/FeeiCN/ESD> <https://github.com/Lijijie/subDomiansBrute> 4、利用证书透明度收集子域 使用一下网站搜索需要查询的域名:如baidu.com (1)crtsh:<https://crt.sh/> (2)facebook:<https://developers.facebook.com/tools/ct> (3)entrust:<https://www.entrust.com/ct-search/> (4)certspotter:<https://sslmate.com/certspotter/api/> (5)spyse:<https://spyse.com/search/certificate> (6)censys:<https://censys.io/certificates> (7)google: <https://google.com/transparencyreport/https/ct/>   5、whois查询法 whois是用来查询域名的IP以及所有者等信息的传输协议。用来查询域名是否被注册,注册域名的详细信息的数据库(如:域名所有人、域名注册商),一般情况下对于中小型网站域名注册者就是网站管理员。通过域名Whois服务器查询,可以查询域名归属者联系方式,以及注册和到期时间。 常用whois查询工具: (1)<http://whois.chinaz.com/> 站长之家 (2)<https://whois.aliyun.com/> 阿里云域名信息查询 (3)<https://www.whois365.com/cn/> 全球whois查询 6、搜索引擎搜索 常见的一些资产空间测绘网站都可以用来做信息收集,比如sofa、hunter等等。 这里主要介绍如何利用google 搜索信息,可以借助搜索引擎收集到更多的资产、文件等其他信息。 ```php site:网址 //搜索指定的域名的网页内容 、可以用来搜索子域名、跟此域名相关的内容 ```  ```php site:sohu.com -www //搜索除了www.xxx.com其他的网站信息 ```  ```php filetype:文件类型 //搜索指定文件类型 ```  ```php intitle:keyword //搜索标题存在特定关键字的网页 ```  ```php intext:keyword //搜索正文存在特定关键字的网页 intext:powered by wordpress 搜索wordpress制作的博客网址 intext:Powered by *CMS 搜索CMS相关的页面 ``` 7、根据目标站点抓包测试 站点配置文件信息泄露或者观察请求中是否有第三方站点资产。 比如:通过收集js文件以及其他配置中泄露的域名、ip等。  8、结合端口探测和目录探测识别目标网站的实际服务位置。 在实际漏洞挖掘时,相当数量的系统实际服务位置并未在网站根目录,且直接访问根目录不会跳转,因此考虑该网站的实际服务位置在非标端口,或者网站的服务器配置需要特定路径才能正确访问。因此在这种情况下我们可以结合端口和uri探测实现访问。 (1)端口探测 使用端口扫描工具对目标系统进行端口探测,以nmap为例: nmap -p 1-65535 <目标域名> (所有端口扫描) nmap -p 80,443,8080,8000,5000 <目标域名> (常用端口扫描) nmap -sV -p <开放端口> <目标域名> (服务器版本检测) (2)URI 探测 使用目录探测对目标系统进行探测: gobuster dir -u http://<目标域名>:<开放端口> -w /path/to/wordlist.txt dirb http://<目标域名>:<开放端口> /path/to/wordlist.txt (3)端口扫描结合目录爆破的自动化脚本: ./scan.sh example.com ```php #!/bin/bash TARGET=$1 WORDLIST="/usr/share/wordlists/dirb/common.txt" # 检查输入 if [ -z "$TARGET" ]; then echo "Usage: $0 <target-domain>" exit 1 fi # 端口探测 echo "Scanning ports for $TARGET..." nmap -p 1-65535 $TARGET -oN ports.txt # 查找开放的 HTTP/HTTPS 端口 OPEN_PORTS=$(grep "/open" ports.txt | awk '{print $2}' | tr '\n' ' ') if [ -z "$OPEN_PORTS" ]; then echo "No open ports found." exit 1 fi # 迭代每个开放的端口进行目录探测 for PORT in $OPEN_PORTS; do echo "Found open port: $PORT" # 目录探测 echo "Directory scanning on http://$TARGET:$PORT..." gobuster dir -u http://$TARGET:$PORT -w $WORDLIST done ``` 9、host碰撞 当多个域名共享同一个IP地址时,服务器需要根据HTTP请求中的Host头部来确定将请求路由到哪个虚拟主机。如果服务器配置不当,攻击者可能会利用这一点来访问内网资源。综合收集到的ip、域名并生成字典。通过将域名和IP进行捆绑碰撞,一旦匹配到后端代理服务器上的域名绑定配置,就可以访问到对应的业务系统,从而发现隐形资产。 (1)通过收集资产IP与域名生成字典后碰撞。 访问目标站点,通过已经收集到的ip、域名生成字典后尝试host碰撞。设置host头为暴破点开始暴破: <img src="[https://shs3.b.qianxin.com/butian\_public/fbd5efafd73d26f81d080f48c4df128c8.png](https://shs3.b.qianxin.com/butian_public/fbd5efafd73d26f81d080f48c4df128c8.png)" alt="image-20240723162433165" style="zoom:150%;" /> 成功访问该系统。  常见内网关键系统: ```php admin autotest cert confluence console crm galaxy git gitlab grafana hr it jira k8s kafka kafka-manager oa okr package packages release repo report sso wiki work zabbix ``` 直接使用burp暴破模块的方式一次只能检验一个IP或者域名,可以借助工具实现IP、域名混合暴破。 (2)通过使用工具碰撞: [https://github.com/fofapro/Hosts\_scan](https://github.com/fofapro/Hosts_scan) 替换收集到的IP、域名字典,使用脚本实现host碰撞。 <img src="[https://shs3.b.qianxin.com/butian\_public/f727ee35e285812de1e68f1a102be5c62.png](https://shs3.b.qianxin.com/butian_public/f727ee35e285812de1e68f1a102be5c62.png)" alt="image-20240723170117375" style="zoom:200%;" />  其他工具项目地址: <https://github.com/cckuailong/hostscan> <https://github.com/alwaystest18/hostCollision> 0x03 指纹探测 --------- ### 3.1 框架识别 框架识别:识别网站使用的框架,在目标站无法攻破的情况下可以根据识别到的框架搜索,可以搜索历史漏洞,还可以根据同框架的其他站点入手测试,继而在目标站点发现问题,比如token共用、未授权漏洞等。 1、使用在线工具: [Wappalyzer](https://www.wappalyzer.com/) 专门用于分析网站技术栈的浏览器扩展程序,它能够识别网站使用了哪些技术,包括编程语言、UI框架、JavaScript库等,并提供使用相同技术的公司排名。  2、使用命令行工具: whatweb,可以用于扫描网站并识别使用的CMS、服务器、应用程序等信息。 ```php whatweb www.xxx.com //扫描单个目标 whatweb -i xxx --log-brief=txt.txt //把目标保存为txt文件,扫描多个目标 ``` 3、手动检查分析源代码: 通过浏览器开发者工具查看网站的源代码,特别是<head>标签中的<meta>信息,以及HTML注释中可能包含的框架信息。 常见的特征: ```php %framework_name% powered by built upon running ``` 检查JavaScript文件:某些框架会在其生成的JavaScript文件中包含特定的注释或调用模式。 例如,Django框架生成的JavaScript可能包含:  4、分析网站页面中的提示信息,将提示信息作为框架内容去搜索。   5、可以访问服务器配置文件,可能会发现关于编程语言的配置信息。 ```php httpd.conf、.htaccess //Apache nginx.conf //nginx web.config、applicationHost.config //IIS application.properties、application.yml //springboot server.xml //Tomcat php.ini //PHP settings.py、wsgi.py //Python、Django postgresql.conf //PostgreSQL my.cnf、my.ini //Mysql mongod.conf //MongoDB redis.conf //Redis elasticsearch.yml //elasticsearch ``` 6、分析HTTP响应头:许多服务器会在HTTP响应头中包含一些信息,如`X-Powered-By`字段,可能会显示服务器或应用框架的名称。 ```php X-Powered-By: PHP/7.4.3 ``` 7、检查Cookies:某些框架会在HTTP请求的Cookies中包含特定的名称,可以作为识别框架的线索。 ```php Cookie: CAKEPHP=xxxxxxxxxxxx; //web应用框架是CakePHP ``` 8、使用CMS识别工具:可以扫描CMS相关信息,进行多个CMS的基本检测。 [CMSeeK](https://github.com/Tuhinshubhra/CMSeeK)  [CmsVulScan](https://github.com/F6JO/CmsVulScan)  ### 3.2 Github、Yuque、网盘等在线资源对目标资产信息收集 1、Github信息收集 部分人员经常会将公司的代码或者其他账户用户名、密码等敏感信息放到github中。利用github以搜索域名、特殊JS路径、备案、网站的技术支持等关键内容会有意想不到的收获。 高级搜索:<https://github.com/search/advanced>  一些常用的搜索[关键字](https://github.com/obheda12/GitDorker/blob/master/Dorks/medium_dorks.txt): ```php "token" "password" "secret" "passwd" "username" "key" "apidocs" "AWSSecretKey" "access_key" "access_token" "amazonaws" "apiSecret" "api_key" "api_secret" "auth" "aws_access" "config" "login" "mysql" "pass" "pwd" "ssh" "swagger" "jdbc" ``` 2、语雀信息收集 可以通过关键字,一般最常用的就是企业名称,企业邮件后缀,企业域名等直接搜索,也可以使用通配符,比如“xxx\*”就是匹配xxx在内的全部信息。  3、网盘信息收集 凌风云:<https://www.lingfengyun.com/> 直接输入关键字进行搜索。   猪猪盘:<http://www.zhuzhupan2.com/>  ### 3.3 全面指纹检测收集工具汇总 一些好用的全面信息收集工具分享。 1、TideFinger:通过分析web指纹的检测对象、检测方法、检测原理及常用工具,并提取了多个开源指纹识别工具的规则库,将以上进行整合进行了规则重组实现指纹识别。可以识别网站信息、IP地址信息、CDN、中间件、banner信息、操作系统等。 在线网址:<http://finger.tidedesec.net/>  项目地址:<http://github.com/TideSec/TideFinger>  2、[Amass](https://mp.weixin.qq.com/s?__biz=MzU1NzczNTM1MQ==&mid=2247484647&idx=2&sn=68480252e0732e60665c63aedf014d95&scene=21#wechat_redirect) 工具位置:<https://github.com/owasp-amass/amass> 一款开源的网络资产发现工具,由 OWASP(Open Web Application Security Project)维护。它通过收集和关联多种数据源的信息,帮助用户发现网络资产和子域名。Amass 不仅可以被动收集数据,还支持主动扫描,提供了全面的网络资产发现解决方案。  3、[TscanPlus](https://mp.weixin.qq.com/s?__biz=MzkxMzIwNTY1OA==&mid=2247505129&idx=1&sn=1f0f2de911886415aed934a1f51b93d0&scene=21#wechat_redirect) 一款综合性网络安全检测和运维工具,旨在快速资产发现、识别、检测,构建基础资产信息库,协助甲方安全团队或者安全运维人员有效侦察和检索资产,发现存在的薄弱点和攻击面。是一款界面美观、功能强大的一款综合信息探测扫描工具。 项目地址:<https://github.com/TideSec/TscanPlus> 4、EHole\_magic:可对识别出来的重点资产进行漏洞检测。 [https://github.com/lemonlove7/EHole\_magic](https://github.com/lemonlove7/EHole_magic) 
发表于 2024-11-15 10:00:01
阅读 ( 3069 )
分类:
渗透测试
7 推荐
收藏
0 条评论
请先
登录
后评论
中铁13层打工人
77 篇文章
×
发送私信
请先
登录
后发送私信
×
举报此文章
垃圾广告信息:
广告、推广、测试等内容
违规内容:
色情、暴力、血腥、敏感信息等内容
不友善内容:
人身攻击、挑衅辱骂、恶意行为
其他原因:
请补充说明
举报原因:
×
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!