HVV面试

  • linux日志管理

1. 检查系统帐号安全

(1) /etc/passwd

(2) /etc/shadow

(3) 特权用户(uid==0)

awk -F: ‘$3==0{print $1}’ /etc/passwd

(4) 可远程登录的帐号

awk ‘/$1|$6/{print $1}’ /etc/shadow

2. History历史命令

(1) .bash_history文件

3. 端口、进程

(1) netstat -antlp|more

(2) file /proc/$PID/exe

(3) ps aux | grep pid

4. 开机启动项

(1) 在/etc/init.d

5. 计划任务

(1) crontab -l

(2) /var/spool/cron/*

(3) /etc/crontab

(4) /etc/cron.d/*

(5) /etc/cron.daily/*

(6) /etc/cron.hourly/*

(7) /etc/anacrontab

(8) …

There were 13 failed login attempts since the last successful login.

远程登录linux服务器的时候偶尔会看到这样的提示,说明有人/程序在偷偷的尝试登录你的服务器。

对于这种情况,有必要排查系统是否已经被人成功的远程登录了。

  • 使用lastlog命令查询各个用户最后一次的登录时间,

    检查是否有可疑的用户登录

    检查上次的登录时间

    last

    使用last命令可以检查用户的登录历史

    Last searches back through the file /var/log/wtmp (or the file designated by the -f flag) and displays a list of all users logged in (and out) since that file was created.
  • lastb

    使用lastb命令可以检查用户登录失败的历史

    Lastb is the same as last, except that by default it shows a log of the file /var/log/btmp, which contains all the bad login attempts.

    不管是/var/log/wtmp,还是 /var/log/btmp,系统每隔一段时间会备份一次并清空。备份的文件都会放在/var/log/目录下。备份时间应该是可以设定的,我的系统是1个月。对于我这种情况,如果异常登录发生在月初,有必要使用-f参数加载上个月的日志检查一下

    补充一下,上面说的备份时间在/etc/logrotate.conf这个文件中设定,具体的帮助见man logrotate
  • 检查服务器的负荷,使用top命令

    服务器被黑之后,可能会被偷偷用于挖矿等各种CPU密集型的业务。服务器负荷一般是比较稳定的,如果发现负荷比正常大了,就得去检查有没有什么可疑的进程了。对于这种情况,往往程序会向骇客自己的服务器回传消息,检查异常的网络连接一般可以发现。

    lsof -i

    检查所有的网络连接

    netstat -nltp

    检查所有的监听端口,对于黑别人的机器作为服务端,情况应该比较少见。

    之前遇到过一次这种情况,服务器的负荷突然增加,检查发现了一个从未用过的用户的登录记录,以及一个可疑的进程。大体分析了一下,应该是一个挖矿程序。通过rsync向自己的服务器回传消息。至于为什么我的服务器被黑之后还可以登录,大概是因为他只拿到了那个用户的权限,没法进一步提权吧

发现可疑的进程ID后,如何确定程序所在的目录以及命令入口?

  • 通过PID获取用户的工作目录和命令行参数

    /proc/<PID>目录下

    - `cwd`是指向工作程序目录的软链接
    - `exe`是工作程序的软链接
    - `cmdline`里面的内容是程序的命令行参数
    
  • 通过PID获取程序监听的端口

    $ sudo netstat -nltp | grep <pid>

  • 检查占用端口的程序

    $ sudo lsof -i :<port>

对于频繁尝试登录服务器的IP地址,可以将其添加到/etc/hosts.deny中。

  • 内核提权
  • Windows下的几种提权方式(具体做法);命令提示符下建立新的Windows用户以及提权

使用命令给windows用户提权
创建与提权
功打开虚拟终端后,首先使用命令“ipconfig”,查看网站服务器的IP地址。
接下来,我们使用“whoami”命令查看当前用户。
然后使用“net user”命令,查看网站服务器上的用户账户。
使用命令“net user hack hack /add”,添加一个用户名为hack,密码为hack的用户到网站服务器。
使用“net user”命令查看,hack用户添加成功。
使用命令“net localgroup Administrators hack /add”,将我们刚添加的hack用户提升至“管理员权限。
然后使用命令net user hack”,查看用户名为hack的全部账号信息,可以看到其本地组成员已经提升至管理员。
“使用命令netstat -an”,查看网站服务器上开启的端口,可以看到其3389远程桌面的端“口 已 经 开 启 。
在本地计算机上打开远程桌面连接,输入网站服务器的IP“”地址,点击 连接 ,等待响应。(mstsc远程桌面    regedit注册表)
成功连接后输入我们添加的用户名和密码后,点击确定。成功远程连接到网站服务器,获取到服务器管理员权限。
::启用远程桌面连接

@echo off

reg add "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f

::禁用远程桌面连接

@echo off

reg add "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f

或者:

reg delete "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal Server" /v fDenyTSConnections /f 

reg add "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 

3389安全加固:
既然3389这么危险,所以更改这个默认端口就很有必要了。

在命令行下批处理命令
1.  REG ADD "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWds dpwdTds cp" /v PortNumber /t REG_DWORD /d 0X22B8 /f  

2.  REG ADD "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp"  /v PortNumber /t REG_DWORD /d 0X22B8 /f  

这里要用16进制。0X22B8-->8888

图形化修改:regedit
在注册表local_machine中systemcurrntcontrolsetcontrol erminal serverwds dpwd ds cp里面的portnumber改掉。同时该

systemcurrntcontrolsetcontrol erminal serverwinstations dp-tcp里面的portnumber。然后在连接的时候就在ip后面加上端口号192.168.199.137:8888

https://www.freebuf.com/articles/system/184289.html

http://www.sins7.cn/several-common-postures-of-windows-power-raising/

https://www.anquanke.com/post/id/153474

  • Windows查看用户组

使用“Windows+R“组合键—>输入“compmgmt.msc”—>按回车键—>打开计算机管理—>单击“系统工具”—>“本地用户和组”

https://www.cnblogs.com/hjq111/p/13846328.html

  • waf判断攻击

https://blog.csdn.net/Candyys/article/details/105585036

  • xss的三种类型详解;xss攻击常识及实战、攻击代码判断

https://blog.csdn.net/qq_37236745/article/details/83590663

https://blog.csdn.net/lzy98/article/details/114042271

  • sql注入的基本原理和防御方法

https://www.freebuf.com/vuls/265308.html

  • sqlmal使用

https://www.freebuf.com/articles/es/229425.html

  • Burp suite使用模块

https://www.freebuf.com/articles/web/100377.html

  • HW日志分析、查看

https://www.freebuf.com/articles/network/201334.html

https://www.freebuf.com/articles/network/265912.html

  • 有那些基础的web漏洞、原理

https://blog.csdn.net/wuhuimin521/article/details/79943644
有没有挖洞经验、src有没有实战过


用过那些靶机

你有什么要问我的

......不记得了



原文地址:https://www.cnblogs.com/hjq111/p/14610248.html