渗透攻击之情报收集

1.情报搜集技术

渗透测试中情报搜集工作有两个方面的任务:
  • [ ] 通过信息搜集工作,确定渗透测试目标的范围;
  • [ ] 发现渗透目标的安全漏洞和脆弱点,为后续渗透攻击打下基础。

1.1外围信息收集

1.1.1通过DNS和IP地址挖掘目标网络信息

  • whois 域名注册信息查询
    ```
    msf>whois testfire.net
    [*] exec: whois testfire.net

Domain Name: TESTFIRE.NET
Registry Domain ID: 8363973_DOMAIN_NET-VRSN
Registrar WHOIS Server: whois.corporatedomains.com
Registrar URL: http://www.cscglobal.com/global/web/csc/digital-brand-services.html
Updated Date: 2017-07-19T05:16:54Z
Creation Date: 1999-07-23T13:52:32Z
Registry Expiry Date: 2018-07-23T13:52:32Z
Registrar: CSC Corporate Domains, Inc.
Registrar IANA ID: 299
Registrar Abuse Contact Email: [email protected]
Registrar Abuse Contact Phone: 8887802723
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Name Server: ASIA3.AKAM.NET
Name Server: EUR2.AKAM.NET
Name Server: EUR5.AKAM.NET
Name Server: NS1-206.AKAM.NET
Name Server: NS1-99.AKAM.NET
Name Server: USC2.AKAM.NET
Name Server: USC3.AKAM.NET
Name Server: USW2.AKAM.NET
DNSSEC: unsigned
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/

Last update of whois database: 2018-05-22T00:21:34Z <<<

> **提示**  进行whois 查询时去掉www、ftp等前缀。

- **nslookup 与 dig 域名查询**

root@bt:~# nslookup

set type=A
testfire.net
Server: 10.10.10.2
Address: 10.10.10.2#53

Non-authoritative answer:
Name: testfire.net
Address: 65.61.137.117

exit

> 提示 set type=A 对其ip地址进行解析,set type=MX 来查找其邮件转发,有些DNS服务器开放了区域传送,可以在nslookup中使用ls -d example.com 来查看其所有的DNS 记录,这些信息往往暴露大量网络内部拓扑消息。


root@bt:~# dig @ASIA3.AKAM.NET testfire.net

; <<>> DiG 9.7.0-P1 <<>> @ASIA3.AKAM.NET testfire.net
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51070
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;testfire.net. IN A

;; ANSWER SECTION:
testfire.net. 86400 IN A 65.61.137.117

;; Query time: 236 msec
;; SERVER: 23.211.61.64#53(23.211.61.64)
;; WHEN: Mon May 21 20:22:54 2018
;; MSG SIZE rcvd: 46

扫描二维码关注公众号,回复: 1104104 查看本文章
> 提示 dig 命令基本使用方法,

:dig @DNS服务器 待查询域名


- **IP2Location 地理位置查询**


[查询国外ip](http://www.maxmind.com):(收费)

[查询国内ip](http://www.cz88.net): (免费)

- **netcraft 网站提供信息查询服务**

[进入查询网站](http://searchdns.netcraft.com/)

- **IP2Domain 反查域名**

[国外反查域名](http://www.ip-adress.com/reverse_ip)

[国内反查域名](http://www.7c.com/)
> 提示 有一些网站共用一台服务器,可以通过其他网站的漏洞获取服务器访问控制权,进而迂回获取渗透攻击的权限。这种攻击技术成为“旁注”


### 1.1.2 通过搜索引擎进行信息搜集
- **Google Hacking 技术** 

[SiteDigger](https://www.mcafee.com/us/downloads/free-tools/termsofuse.aspx) 集成了FSDB(Foundstone Signature Database) 和 GHDB(Google Hacking DataBase) 的自动搜索功能。

[Search  Diggity](https://www.bishopfox.com/resources/tools/google-hacking-diggity/attack-tools/) 使用它不仅能够搜索字符串进行自动探测,还可以对源代码、恶意软件进行分析。

> 提示 SiteDigger 和 Search Diggity 都是Windows应用程序,由于Google Api 搜索次数限制,每次只选取只对感兴趣项目进行检索。
- **探索网站的目录结构**
[百度搜索](http://www.baidu.com/) 输入 **parent directory site:testfire.net**,打开第一个链接,网站的bank目录一览无余,在浏览网站目录,应对下面几类文件进行特别留意:
    - [ ] 扩展名为.inc 的文件,可能包含网站的配置信息,如数据库用户名/口令等。
    - [ ] 扩展名为.bak的文件,通常是文本编辑器在编辑源代码后留下的备份文件,可以让你知道与其对应的程序脚本文件中大致内容。
    - [ ] 扩展名为.txt或.sql 的文件, 一般包括网站运行sql脚本,可能会透漏类似数据库结构等信息。
    
类似工作可以metasploit中的brute_dirs、 dir_listing、 dir_scanner等辅助模块来完成,它们主要是暴力破解的方式工作。

msf > use auxiliary/scanner/http/dir_scanner
msf auxiliary(dir_scanner) > set THREADS 50
THREADS => 50
msf auxiliary(dir_scanner) > set RHOSTS www.testfire.net
RHOSTS => www.testfire.net
msf auxiliary(dir_scanner) > exploit

[*] Detecting error code
[*] Using code '404' as not found for 65.61.137.117
[*] Error: 65.61.137.117: ActiveRecord::RecordInvalid Validation failed: Pname can't be blank
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(dir_scanner) > exit

> 提示 这里并没有发现隐藏目录
-  **检索特定类型的文件**

使用Google Hacking 技术搜索某网站的xls文件

比如在[百度搜索](http://www.baidu.com/) 输入**site:sdu.edu.cn filetype:xls** 就可以得到一些xls文件。


- **搜素网站的E-mail地址**

使用metasploit的一个辅助模块search_email_collector,进行有针对性邮件地址收集。
- **搜索易存在SQL注入点的页面**

[百度搜索](http://www.baidu.com/) 输入**site:testfire.net inurl:login** ,得到其后台登录url。

Username:admin 'OR'1
Password:test 'OR'1
```

上面是通过SQL注入绕过testfire网站登录验证逻辑进入后台管理界面。

猜你喜欢

转载自www.cnblogs.com/fwb-hack/p/9108127.html