- Hands-On Red Team Tactics
- Himanshu Sharma Harpreet Singh
- 528字
- 2021-08-13 15:36:43
Meterpreter
Meterpreter can be considered an advanced dynamic payload that uses in-memory.
The Dynamic Linked Library (DLL) injection stages at runtime. It also provides a client-side Ruby API that makes it extremely powerful. There are various advantages of using Meterpreter as a payload. Some of these are as follows:
- It resides in the memory and nothing is written to the disk.
- No new process is created as it can easily be injected into any other running processes of the system. However, there's a limitation to it. We can't inject multiple Meterpreter payloads in the same process.
- By default, all communication done by Meterpreter is encrypted.
- New features can be added by uploading the DLL via a client that is loaded in-memory and initialized.
In this section, we will cover the basics of Meterpreter. Once we get Meterpreter on a system, the first command to look at is the help command:
To get the current working directory, we can use the pwd command:

To list all the files in the directory, we use the ls command:

If we want to exploit another system or perform any other action on msfconsole without killing the current Meterpreter session, we can use the background command to put the session in the background:

To see a list of all the Meterpreter sessions we have, we can use the sessions command:
To interact with a Meterpreter session, we can use sessions -i <id>.
To kill all sessions, we can use sessions -K.
Similarly, we can use sessions -C <command> to execute a command across all sessions:
To list all the running processes on the system, we can use the ps command:

Now we can view only x86 (32-bit) processes by typing the following command:
ps -A x86
To view only 64-bit processes, we can use this:
ps -A x64
Using Meterpreter, we can also migrate it to another process using the migrate command. When this command is run, Meterpreter first gets the PID from the user to which it has to migrate, and then it checks the architecture of the process and SeDebugPrivilege (used to get a handle of the process). Next, it fetches the payload that will be injected to the process and calls various windows APIs, such as OpenProcess(), VirtualAllocEx(), WriteProcess—Memory() and CreateRemoteThread(). Once migration is complete, Meterpreter shuts down the previous thread that had the initial Meterpreter running. Although it sounds complicated, Meterpreter can do all of this with the following simple command:
migrate <Pid>

Meterpreter also introduced transport control with the transport command, which allows us to change the transport mechanism of a payload without killing the existing session.
Let's look at how to set up and change the transport of an existing Meterpreter. To view the options, we can simply type the transport or transport -h command:

We add transport by using the following command:

To list the available transports, we can use the following command:
transport list:

Then we start our exploit handler to whichever transport we want to switch to:

Now we simply use the transport next command:

And we will see we received a connection on our handler:

For more information, visit the following link:
https://github.com/rapid7/metasploit-framework/wiki/Meterpreter-Transport-Control
- 綜合布線實(shí)訓(xùn)教程(第3版)
- 應(yīng)對(duì)多突發(fā)事件的信息系統(tǒng)應(yīng)用技術(shù)
- 這就是搜索引擎
- 地理信息系統(tǒng)中的不確定性問題
- Axure RP 7.0從入門到精通:Web + APP產(chǎn)品經(jīng)理原型設(shè)計(jì)
- 計(jì)算機(jī)網(wǎng)絡(luò)技術(shù)基礎(chǔ)(第2版)
- 網(wǎng)絡(luò)掃描技術(shù)揭秘:原理、實(shí)踐與掃描器的實(shí)現(xiàn)
- 巧學(xué)巧用Dreamweaver CS6、Flash CS6、Fireworks CS6網(wǎng)站制作
- Getting Started with Ghost
- 分析信息:香農(nóng)、維特根斯坦、圖靈和喬姆斯基對(duì)信息的兩次分離
- 華為云計(jì)算HCIA實(shí)驗(yàn)指南(第二版)
- 矛與盾:黑客攻防與腳本編程
- 現(xiàn)代網(wǎng)絡(luò)控制技術(shù)及應(yīng)用
- Axure RP 9 高保真原型設(shè)計(jì)實(shí)例教程
- Cisco Unified Communications Manager 8:Expert Administration Cookbook