#知识点
1、信息收集-Web应用-源码获取-已知指纹&未知指纹
2、信息收集-Web应用-源码获取-泄漏问题&发现指纹
一、参考文章:
https://www.secpulse.com/archives/124398.html

https://mp.weixin.qq.com/s/QgLDdaefXlZtvlSiFQShZw

二、源码泄漏原因:
由于开发者不好的习惯或者开发工具,如IDEA、vscode等,有时还会在公网,如github、gitee、oschina上遗留下历史存档(或者说是备份),给攻击者获取网站源代码提供了切入口;
1、从源码本身的特性入口
2、从管理员不好的习惯入口
3、从管理员习惯的开发入口
4、从管理员不好的配置入口
5、从管理员不好的意识入口
6、从管理员资源信息搜集入口
三、源码泄漏大概集合:
1、Webpack打包器泄漏(前端技术出现)
一般在Vue、Node.js的前端技术,用js传输的,造成泄露(用php、java语言写的后端是看不到的);这两种语言开发的,一般会用到webpack打包器做存档
识别泄露的步骤:
①通过指纹识别->发现使用了webpack打包器

②利用chrome浏览器的source detector插件->获取到泄露的部分源代码

案例1:https://mp.weixin.qq.com/s/zhjxW2mUEgq6dFAp3kBcgQ

案例2:SRC挖掘-js.map泄露到接管云上域控
https://mp.weixin.qq.com/s/QZsNjbTiaqC1qwzARVAiGQ

2、composer.json
一般出现在php语言开发的网站,PHP语言在composer的功能和python语言中的pip类似,主要用来管理调用的第三方库的框架等信息;
3、GitHub源码泄漏
最好使GitHub处于登录状态,再进行源码搜索

①特定文件->GitHub搜索



②特征联系方式->如qq号、手机邮箱等->github搜索

③对github进行监控,有些源码作者上传后,后因某种原因,可能删除;这时持续对GitHub进行监控就有一定的必要,可以及时获得源码资源,以免后期资源找不着( 除了源码,漏洞更新,工具更新等都有用处)
补:GitHub搜索需注意目标使用的源码是开源还是闭源,是否公开,github可以搜到的一般是开源的、公开的源码泄露;
4、git源码泄露

实验:



5、svn源码泄露

实验:




6、网站备份压缩文件如.zip文件
思路:利用工具进行目录扫描->发现.zip文件->url地址访问.zip文件->成功下载该文件
.zip文件里面可能打包了所有的网站源代码

7、DS_Store文件泄露

实验:


类似案例:渗透测试实战---某资金盘信息收集(.idea目录泄露)
https://mp.weixin.qq.com/s/7cSrDZci_drE6wTGvQOOHw

8、hg源码泄漏
9、SWP 文件泄露
10、CVS泄露
11、Bzr泄露
12、'WEB-INF/web.xml 泄露
四、源码搜集思路点:
1、使用指纹识别平台获取到目标是什么名字的源码程序(指纹已识别的情况)
通过搜索引擎获取到源码
2、使用指纹识别平台不能获取目标信息(指纹不能识别的情况)
后端:借助svn git composer.json ds_store 备份扫描(.zip)等配置泄漏安全
前端:webpack打包 谷歌插件source detector获取源码
如果没有这些问题 还想获取源码怎么办 见下面方法
3、借助资源平台去搜索(github gitee oschina等源码)
-特定文件
-特征联系方式,如手机号、邮箱等
-github监控( 除了源码,漏洞更新,工具更新等都有用处)
目标使用的源码是开源还是闭源,是否公开
五、Github资源搜索-未知指纹识别获取源码途径
*拓展:配合后期监控保证第一时间通知
资源搜索语法:
in:name test #仓库标题搜索含有关键字
in:descripton test #仓库描述搜索含有关键字
in:readme test #Readme文件搜素含有关键字
stars:>3000 test #stars数量大于3000的搜索关键字
stars:1000..3000 test #stars数量大于1000小于3000的搜索关键字 forks:>1000 test #forks数量大于1000的搜索关键字
forks:1000..3000 test #forks数量大于1000小于3000的搜索关键字 size:>=5000 test #指定仓库大于5000k(5M)的搜索关键字 pushed:>2019-02-12 test #发布时间大于2019-02-12的搜索关键字 created:>2019-02-12 test #创建时间大于2019-02-12的搜索关键字 user:test #用户名搜素
license:apache-2.0 test #明确仓库的 LICENSE 搜索关键字 language:java test #在java语言的代码中搜索关键字
user:test in:name test #组合搜索,用户名test的标题含有test的
关键字配合谷歌搜索:
site:Github.com smtp
site:Github.com smtp @qq.com
site:Github.com smtp @126.com
site:Github.com smtp @163.com
site:Github.com smtp @sina.com.cn
site:Github.com smtp password
site:Github.com String password smtp
六、另类目标源码获取
一般是不正规网站,多采用的网站源码选择地址
这些不正规网站,还可以通过网站的icon图标(一般不会改),在fofa等网络空间引擎搜索,从而找到源码


从目标转到寻找源码系统上,从源码系统上找应用目标