Kali linux 学习笔记(二十六)提权——收集信息和隐藏痕迹 2020.3.5

前言

得到高权限的用户后
我们需要进行有用信息的收集
并尽可能隐藏痕迹

1、linux中的重要信息

Linux中的重要信息如下:

/etc/resolv.conf #DNS配置
/etc/passwd #用户账号
/etc/shadow #用户密码
whoami #当前用户
who –a #当前所有用户
ifconfig -a #网络信息
iptables -L -n  #防火墙
netstat –rn #当前系统的网关和路由
uname –a #系统版本
ps aux  #所有进程
dpkg -l | head #所有安装好的软件包

2、Windows中的重要信息

Windows中的重要信息如下:

ipconfig /all #所有网络参数
ipconfig /displaydns #DNS缓存
netstat -bnao #
netstat –r #当前系统的网关和路由
net view /domain #查共享信息
net user /domain #查域信息
net user %username% /domain  # 查域信息
net accounts, net share #查看共享
net group "Domain Controllers" /domain #域环境下的机器可以查看Domain Controllers组里的账号
net share name$=C:\ /unlimited    # 把 C盘无限制共享出来
net user username /active:yes /domain  # 域管理员重新启动被锁定账号

3、WMIC(WINDOWS MANAGEMENT INSTRUMENTATION)

这是windows中很好的一个工具

C:\Users\John>wmic
wmic:root\cli>/?
[global switches] <command>

有效的全局开关有:

/NAMESPACE           别名使用的名称空间路径。
/ROLE                包含此别名定义的角色路径。
/NODE                别名使用的服务器。
/IMPLEVEL            客户模拟级别。
/AUTHLEVEL           客户身份验证级别。
/LOCALE              客户应用的语言识别符。
/PRIVILEGES          启用或禁用所有特权。
/TRACE               将调试信息输出到 stderr。
/RECORD              将所有输入命令和输出写入日志。
/INTERACTIVE         设置或重设交互模式。
/FAILFAST            设置或重置 FailFast 模式。
/USER                会话期间使用的用户。
/PASSWORD            用于会话登录的密码。
/OUTPUT              为输出重新定向指定模式。
/APPEND              为输出重新定向指定模式。
/AGGREGATE           设置或重置集合模式。
/AUTHORITY           Specifies the <authority type> for the connection.
/?[:<BRIEF|FULL>]    用法信息。

一些有用的指令

wmic nicconfig get ipaddress,macaddress #读取IP,MAC地址
wmic computersystem get username #查看登录账号
wmic netlogin get name,lastlogon #查看登录记录
wmic process get caption, executablepath,commandline   #提取软件安装信息
wmic process where name=“calc.exe" call terminate #结束进程
wmic os get name,servicepackmajorversion #提取操作系统的补丁版本
wmic product get name,version  #提取软件信息
wmic product where name=“name” call uninstall /nointeractive #静默删除
wmic share get /ALL #提取共享文件夹
wmic /node:"machinename" path Win32_TerminalServiceSetting where  AllowTSConnections="0" call SetAllowTSConnections "1"  #开远程桌面
wmic nteventlog get path,filename, writeable  #查看日志目录

例:

C:\>wmic nteventlog get path,filename, writeable
FileName   Path                       Writeable
appevent   \windows\system32\config\  TRUE
ntds       \windows\system32\config\  TRUE
dnsevent   \windows\system32\config\  TRUE
ntfrs      \windows\system32\config\  TRUE
secevent   \windows\system32\config\  TRUE
sysevent   \windows\system32\config\  TRUE
ThinPrint  \windows\system32\config\  TRUE

4、一些敏感信息

主要是:

  • 商业信息
  • 系统信息

Linux值得关注的:

/etc #很多应用程序的配置文件
/usr/local/etc #同样会有应用程序的配置文件
/etc/passwd #用户
/etc/shadow #密码
.ssh
.gnupg #公私钥
The e-mail and data files
业务数据库
身份认证服务器数据库
/tmp

windows值得关注的:

SAM 数据库 #账号
注册表文件
%SYSTEMROOT%\repair\SAM #修复操作时存的SAM的副本
%SYSTEMROOT%\System32\config\RegBack\SAM #SAM的备份
业务数据库
身份认证数据库
临时文件目录
UserProfile\AppData\Local\Microsoft\Windows\Temporary Internet Files\

5、隐藏痕迹

不能让我们的用户账号在登录界面显示

REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersio\WinLogon\SpecialAccounts\UserList" /v uname /T REG_DWORD /D 0 #修改注册表,uname位置写想隐藏的账号

日志清理

del %WINDIR%\*.log /a/s/q/f #强制静默删除各种日志
history -c #清除命令记录
#一些重要日志
auth.log
secure
btmp
wtmp
lastlog
faillog
其他日志和 HIDS 等

结语

收集信息是攻击者的目的
隐藏信息是攻击者必须做的
这都需要注意

作为管理员
则要时刻注意各种日志信息的异常
以及一些敏感信息的安全

发布了28 篇原创文章 · 获赞 2 · 访问量 1021

猜你喜欢

转载自blog.csdn.net/weixin_44604541/article/details/104675678