환경 구성

- Kali MCP Server: Kali VM (10.10.10.10)
- Kali MCP Client: Windows Local
- DVWA: Ubuntu VM (10.10.10.22)
| 목차 |
| 0. Ubuntu VM 구축: VMware |
| 1. DVWA 구축 |
| 2. Kali MCP 취약점 분석 |
| 3. 프롬프트 구체화 |
0. Ubuntu VM 구축: VMware
- IP 확인
ip addr

1. DVWA 구축
sudo apt update
sudo apt install -y apache2 mariadb-server php php-mysqli php-gd libapache2-mod-php git
- Web 반응 확인

※ 간단한 실습을 위해 root 경로로 진행했습니다.
- DVWA git 설치
cd /var/www/html
sudo git clone https://github.com/digininja/DVWA.git
- DVWA 경로 권한 부여
sudo chown -R www-data:www-data /var/www/html/DVWA
sudo chmod -R 755 /var/www/html/DVWA
- DVWA 데이터베이스 구축
sudo mysql -u root
CREATE DATABASE dvwa;
CREATE USER 'dvwa'@'localhost' IDENTIFIED BY 'dvwa';
GRANT ALL PRIVILEGES ON dvwa.* TO 'dvwa'@'localhost';
FLUSH PRIVILEGES;
EXIT;

- DVWA config.inc.php 설정
cd /var/www/html/DVWA/config
sudo cp config.inc.php.dist config.inc.php
sudo nano config.inc.php

$_DVWA['db_user'] = 'dvwa';
$_DVWA['db_password'] = 'dvwa';
$_DVWA['db_database'] = 'dvwa';
- DVWA php.ini 설정
sudo nano /etc/php/*/apache2/php.ini

allow_url_include = On
allow_url_fopen = On
- DVWA 페이지 로그인

- Username: DVWA
- Password: DVWA
2. Kali MCP 취약점 분석
Cursor New Chat에 프롬프트 입력
- 프롬프트1
/mcp mcp-kali-server nmap_scan 을 이용해서 http://IP를 버전 정보와 함께 스캔해줘.


kali mcp server VM에서 보면 어떤 명령어를 실행하는지 볼 수 있음.
- 결과1
스캔 요약
80/tcp open — http, Apache httpd 2.4.58 (Ubuntu)
_http-server-header: Apache/2.4.58 (Ubuntu)
_http-title: Apache2 Ubuntu Default Page: It works
443, 8080, 8443 — 닫힘
MAC: VMware
- 프롬프트2
nikto 결과를 html 결과 보고서로 만들어줘.

+ 서버 실행 화면

- 결과2

더보기
결과 보고서
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Nikto 스캔 보고서 — 10.10.10.22 /DVWA/</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;600&family=IBM+Plex+Mono:wght@400&display=swap" rel="stylesheet" />
<style>
:root {
--bg: #0f1419;
--surface: #1a2332;
--border: #2d3a4d;
--text: #e6edf3;
--muted: #8b9cb3;
--accent: #3d9a78;
--warn: #c9a227;
--high: #e05555;
--info: #5b8cff;
}
* { box-sizing: border-box; }
body {
margin: 0;
font-family: "IBM Plex Sans", system-ui, sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.55;
font-size: 15px;
}
.wrap { max-width: 920px; margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }
header {
border-bottom: 1px solid var(--border);
padding-bottom: 1.5rem;
margin-bottom: 2rem;
}
h1 {
font-size: 1.65rem;
font-weight: 600;
margin: 0 0 0.35rem 0;
letter-spacing: -0.02em;
}
.subtitle { color: var(--muted); font-size: 0.95rem; }
h2 {
font-size: 1.1rem;
font-weight: 600;
margin: 2rem 0 0.75rem 0;
color: var(--accent);
letter-spacing: 0.02em;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 0.92rem;
}
th, td {
text-align: left;
padding: 0.65rem 0.85rem;
border: 1px solid var(--border);
vertical-align: top;
}
th { background: var(--surface); color: var(--muted); font-weight: 600; }
tr:nth-child(even) td { background: rgba(26, 35, 50, 0.45); }
.badge {
display: inline-block;
padding: 0.15rem 0.5rem;
border-radius: 4px;
font-size: 0.78rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
white-space: nowrap;
}
.badge-low { background: #2a3f5f; color: #8ec5ff; }
.badge-med { background: #4a3d1a; color: #f0d060; }
.badge-high { background: #4a2525; color: #ff9a9a; }
.badge-info { background: #1a3d2e; color: #7dffc2; }
pre.raw {
font-family: "IBM Plex Mono", ui-monospace, monospace;
font-size: 0.76rem;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 6px;
padding: 1rem 1.1rem;
overflow-x: auto;
white-space: pre-wrap;
word-break: break-word;
color: #c8d4e0;
}
.note {
margin-top: 2rem;
padding: 1rem 1.15rem;
border-left: 3px solid var(--warn);
background: rgba(201, 162, 39, 0.08);
font-size: 0.88rem;
color: var(--muted);
}
footer {
margin-top: 2.5rem;
padding-top: 1rem;
border-top: 1px solid var(--border);
font-size: 0.82rem;
color: var(--muted);
}
a { color: var(--info); }
code { font-family: "IBM Plex Mono", monospace; font-size: 0.88em; }
h3 {
font-size: 1rem;
margin: 1.35rem 0 0.55rem 0;
color: #a8b8cc;
font-weight: 600;
}
.prompt-label {
font-size: 0.8rem;
color: var(--muted);
margin-bottom: 0.35rem;
text-transform: uppercase;
letter-spacing: 0.06em;
}
.section-box {
border: 1px solid var(--border);
border-radius: 8px;
padding: 1rem 1.15rem;
margin-top: 0.75rem;
background: rgba(26, 35, 50, 0.35);
}
</style>
</head>
<body>
<div class="wrap">
<header>
<h1>Nikto 웹 서버 취약점 스캔 보고서 (DVWA)</h1>
<p class="subtitle">대상: <strong>http://10.10.10.22/DVWA/</strong> · Nikto 2.5.0</p>
</header>
<section>
<h2>요약</h2>
<p>
<strong>Apache/2.4.58 (Ubuntu)</strong> 위의 DVWA 경로에 대해 Nikto가 <strong>16건</strong>의 항목을 보고했습니다.
HTTP 보안 헤더 누락, <code>login.php</code> 노출, 다수 디렉터리의 <strong>디렉터리 인덱싱</strong>,
<strong>.git</strong> 및 설정/DB 관련 경로 노출 가능성 등이 포함됩니다. 운영 환경에서는 Git 저장소·설정 디렉터리 노출은
심각한 정보 유출로 이어질 수 있으나, DVWA 기본 설치에서는 흔히 나타나는 패턴이기도 합니다.
</p>
</section>
<section>
<h2>스캔 메타데이터</h2>
<table>
<thead>
<tr><th>항목</th><th>값</th></tr>
</thead>
<tbody>
<tr><td>도구</td><td>Nikto 2.5.0</td></tr>
<tr><td>대상 URL</td><td>http://10.10.10.22/DVWA/</td></tr>
<tr><td>대상 IP / 포트</td><td>10.10.10.22 · 80</td></tr>
<tr><td>식별 서버</td><td>Apache/2.4.58 (Ubuntu)</td></tr>
<tr><td>스캔 구간</td><td>2026-03-28 15:17:32 ~ 15:17:41 (GMT+9), 약 9초</td></tr>
<tr><td>요청 / 보고</td><td>8046 requests · <strong>16 item(s)</strong> reported · 0 error(s)</td></tr>
</tbody>
</table>
</section>
<section>
<h2>발견 사항 정리</h2>
<table>
<thead>
<tr>
<th style="width:96px">심각도</th>
<th style="width:28%">경로/대상</th>
<th>설명</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="badge badge-med">구성</span></td>
<td><code>/DVWA/</code></td>
<td><code>X-Frame-Options</code> 없음 (클릭재킹 완화 부족)</td>
</tr>
<tr>
<td><span class="badge badge-med">구성</span></td>
<td><code>/DVWA/</code></td>
<td><code>X-Content-Type-Options</code> 미설정</td>
</tr>
<tr>
<td><span class="badge badge-info">동작</span></td>
<td><code>/DVWA/</code></td>
<td>루트가 <code>login.php</code> 로 리다이렉트</td>
</tr>
<tr>
<td><span class="badge badge-info">정보</span></td>
<td>OPTIONS</td>
<td>허용 메서드: GET, POST, OPTIONS, HEAD</td>
</tr>
<tr>
<td><span class="badge badge-info">정보</span></td>
<td>CGI</td>
<td>CGI 디렉터리 자동 탐지 없음 (<code>-C all</code> 시 추가 검사 가능)</td>
</tr>
<tr>
<td><span class="badge badge-high">노출</span></td>
<td><code>/DVWA/config/</code></td>
<td>디렉터리 인덱싱 · 원격에서 설정 정보 노출 가능성</td>
</tr>
<tr>
<td><span class="badge badge-med">노출</span></td>
<td><code>/DVWA/tests/</code></td>
<td>디렉터리 인덱싱</td>
</tr>
<tr>
<td><span class="badge badge-high">노출</span></td>
<td><code>/DVWA/database/</code></td>
<td>디렉터리 인덱싱 · DB 디렉터리 노출</td>
</tr>
<tr>
<td><span class="badge badge-med">노출</span></td>
<td><code>/DVWA/docs/</code></td>
<td>디렉터리 인덱싱</td>
</tr>
<tr>
<td><span class="badge badge-info">인증</span></td>
<td><code>/DVWA/login.php</code></td>
<td>관리자/로그인 페이지로 식별됨</td>
</tr>
<tr>
<td><span class="badge badge-high">노출</span></td>
<td><code>.git/</code></td>
<td><code>index</code>, <code>HEAD</code>, <code>config</code> 등 Git 메타파일 노출 가능성 (저장소 정보 유출)</td>
</tr>
<tr>
<td><span class="badge badge-med">정보</span></td>
<td><code>.gitignore</code></td>
<td>디렉터리 구조 파악에 활용될 수 있음</td>
</tr>
<tr>
<td><span class="badge badge-med">정보</span></td>
<td><code>.dockerignore</code></td>
<td>디렉터리 구조·배포 맥락 정보 유출 가능성</td>
</tr>
</tbody>
</table>
</section>
<section>
<h2>원본 Nikto 출력</h2>
<pre class="raw">- Nikto v2.5.0
---------------------------------------------------------------------------
+ Target IP: 10.10.10.22
+ Target Hostname: 10.10.10.22
+ Target Port: 80
+ Start Time: 2026-03-28 15:17:32 (GMT9)
---------------------------------------------------------------------------
+ Server: Apache/2.4.58 (Ubuntu)
+ /DVWA/: The anti-clickjacking X-Frame-Options header is not present. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
+ /DVWA/: The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type. See: https://www.netsparker.com/web-vulnerability-scanner/vulnerabilities/missing-content-type-header/
+ Root page /DVWA redirects to: login.php
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ OPTIONS: Allowed HTTP Methods: GET, POST, OPTIONS, HEAD .
+ /DVWA/config/: Directory indexing found.
+ /DVWA/config/: Configuration information may be available remotely.
+ /DVWA/tests/: Directory indexing found.
+ /DVWA/tests/: This might be interesting.
+ /DVWA/database/: Directory indexing found.
+ /DVWA/database/: Database directory found.
+ /DVWA/docs/: Directory indexing found.
+ /DVWA/login.php: Admin login page/section found.
+ /DVWA/.git/index: Git Index file may contain directory listing information.
+ /DVWA/.git/HEAD: Git HEAD file found. Full repo details may be present.
+ /DVWA/.git/config: Git config file found. Infos about repo details may be present.
+ /DVWA/.gitignore: .gitignore file found. It is possible to grasp the directory structure.
+ /DVWA/.dockerignore: .dockerignore file found. It may be possible to grasp the directory structure and learn more about the site.
+ 8046 requests: 0 error(s) and 16 item(s) reported on remote host
+ End Time: 2026-03-28 15:17:41 (GMT9) (9 seconds)
---------------------------------------------------------------------------
+ 1 host(s) tested</pre>
</section>
<section>
<h2>참고: 경로 대소문자</h2>
<p style="color:var(--muted); font-size:0.92rem;">
별도 HTTP 확인 시 <code>http://10.10.10.22/dvwa/</code> (소문자)는 404이고,
Nikto 스캔은 <code>/DVWA/</code> 기준으로 수행되었습니다. 이 서버는 경로 대소문자를 구분합니다.
</p>
</section>
<p class="note">
<strong>주의:</strong> 스캔 종료 후 Nikto가 CIRT.net DB 업데이트 제출을 묻는 대화형 메시지를 출력할 수 있습니다.
자동화·배치 실행 시 <code>-maxtime</code> 등과 함께 비대화형 옵션을 검토하세요. DVWA는 교육용 의도적 취약 애플리케이션입니다.
</p>
<footer>
Nikto 2.5.0 출력 기반 HTML 보고서 · 승인된 범위에서만 활용하세요.
</footer>
</div>
</body>
</html>
- Cursor 전체 창

3. 프롬프트 구체화
Target: http://10.10.10.22/DVWA/
목표:
DVWA 웹 애플리케이션의 취약점을 분석하라.
서버 설정이 아닌 웹 취약점(SQL Injection, XSS, Command Injection 등)에 집중하라.
요구사항:
1. /DVWA/vulnerabilities/ 하위 기능들을 탐색하라
2. 각 취약점 페이지의 파라미터를 식별하라
3. 입력값을 변조하여 취약 여부를 테스트하라
4. 가능한 경우 실제 공격 payload를 생성하라
5. 결과를 취약점 종류별로 정리하라
조건:
- security level = low 기준
- 세션 유지 필요 (PHPSESSID 포함)
- 로그인 정보: admin / password
출력 형식:
[취약점 이름]
- URL:
- 파라미터:
- 공격 payload:
- 결과:
- 설명:
- 결과 영상
녹음 2026-03-28 160849.mp4
6.75MB


장점
1. kali 도구에 대해 원격으로 수행(실제 외부에서 터널링 해서 접속)해서 쓰면 여러 사용자들이 사용 가능하다.
2. 프롬프트 엔지니어링으로 원하는 정보를 수집 가능하다.
'개인 공부 > MCP & OpneClaw' 카테고리의 다른 글
| Kali Linux MCP Server 취약점 분석 환경 구축 (AI Agent Hacking) (0) | 2026.03.28 |
|---|