Add
This commit is contained in:
parent
80f55b50a3
commit
8db61daaeb
41
docker-compose.yml
Normal file
41
docker-compose.yml
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
services:
|
||||||
|
# ----------------------------------------
|
||||||
|
# NGINX (Web Server)
|
||||||
|
# ----------------------------------------
|
||||||
|
nginx:
|
||||||
|
image: nginx:stable-alpine
|
||||||
|
container_name: sec_lab_nginx
|
||||||
|
ports:
|
||||||
|
- "58690:80" # روی سرور پورت 80 باز باشد
|
||||||
|
volumes:
|
||||||
|
- ./:/var/www/html:ro
|
||||||
|
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
depends_on:
|
||||||
|
php:
|
||||||
|
condition: service_started
|
||||||
|
networks:
|
||||||
|
- lab_net
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
# ----------------------------------------
|
||||||
|
# PHP-FPM (Vulnerable Laravel Core)
|
||||||
|
# ----------------------------------------
|
||||||
|
php:
|
||||||
|
container_name: sec_lab_php
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./docker/php/Dockerfile
|
||||||
|
args:
|
||||||
|
# اینجا میتوانید آدرس Nexus داخلی سرور خود را بدهید
|
||||||
|
- COMPOSER_REGISTRY=http://192.168.1.201:8081/
|
||||||
|
- LINUX_REGISTRY=http://192.168.1.201:8081/
|
||||||
|
- SECURITY_REGISTRY=http://192.168.1.201:8081/
|
||||||
|
volumes:
|
||||||
|
- ./:/var/www/html:rw
|
||||||
|
networks:
|
||||||
|
- lab_net
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
networks:
|
||||||
|
lab_net:
|
||||||
|
driver: bridge
|
||||||
27
docker/nginx/default.conf
Normal file
27
docker/nginx/default.conf
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
# شناسایی همزمان هر دو دامنه شبیهسازی شده
|
||||||
|
server_name victim.lab attacker.lab localhost;
|
||||||
|
|
||||||
|
root /var/www/html/public;
|
||||||
|
index index.php index.html;
|
||||||
|
|
||||||
|
# لاگهای مجزا برای تحلیل حملات
|
||||||
|
access_log /var/log/nginx/sec-lab-access.log;
|
||||||
|
error_log /var/log/nginx/sec-lab-error.log;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_pass php:9000;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.ht {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
||||||
35
docker/php/Dockerfile
Normal file
35
docker/php/Dockerfile
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
FROM php:8.2-fpm-bookworm
|
||||||
|
|
||||||
|
# متغیرهای ریجستری (قابل تنظیم از سمت docker-compose)
|
||||||
|
ARG COMPOSER_REGISTRY="https://mirror-composer.runflare.com"
|
||||||
|
ARG LINUX_REGISTRY="http://deb.debian.org/debian"
|
||||||
|
ARG SECURITY_REGISTRY="http://security.debian.org/debian-security"
|
||||||
|
|
||||||
|
# تغییر سورسهای apt به ریجستری لوکال/کاستوم شما
|
||||||
|
RUN sed -i "s|http://deb.debian.org/debian|${LINUX_REGISTRY}|g" /etc/apt/sources.list.d/debian.sources \
|
||||||
|
&& sed -i "s|http://security.debian.org/debian-security|${SECURITY_REGISTRY}|g" /etc/apt/sources.list.d/debian.sources \
|
||||||
|
&& echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99ignore \
|
||||||
|
&& echo 'Acquire::AllowInsecureRepositories "true";' >> /etc/apt/apt.conf.d/99ignore
|
||||||
|
|
||||||
|
# نصب وابستگیهای پایه (بدون دیتابیس چون فعلاً نیاز نداریم)
|
||||||
|
RUN apt-get update && apt-get install -y --allow-downgrades --no-install-recommends \
|
||||||
|
libzip-dev \
|
||||||
|
unzip \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
|
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# نصب اکستنشنهای پایه PHP
|
||||||
|
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||||
|
RUN install-php-extensions zip bcmath
|
||||||
|
|
||||||
|
# تنظیمات کامپوزر و استفاده از ریجستری
|
||||||
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||||
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
|
ENV COMPOSER_ALLOW_SUPERUSER=1
|
||||||
|
|
||||||
|
# غیرفعال کردن JIT برای جلوگیری از باگهای احتمالی PCRE
|
||||||
|
RUN echo "pcre.jit=0" > /usr/local/etc/php/conf.d/disable-pcre-jit.ini
|
||||||
|
|
||||||
|
CMD ["php-fpm"]
|
||||||
28
package-lock.json
generated
28
package-lock.json
generated
|
|
@ -5,6 +5,7 @@
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@tailwindcss/postcss": "^4.2.2",
|
||||||
"@tailwindcss/vite": "^4.0.0",
|
"@tailwindcss/vite": "^4.0.0",
|
||||||
"alpinejs": "^3.15.11",
|
"alpinejs": "^3.15.11",
|
||||||
"autoprefixer": "^10.5.0",
|
"autoprefixer": "^10.5.0",
|
||||||
|
|
@ -16,6 +17,19 @@
|
||||||
"vite": "^7.0.7"
|
"vite": "^7.0.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@alloc/quick-lru": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz",
|
||||||
|
"integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@esbuild/aix-ppc64": {
|
"node_modules/@esbuild/aix-ppc64": {
|
||||||
"version": "0.27.7",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz",
|
||||||
|
|
@ -1115,6 +1129,20 @@
|
||||||
"node": ">= 20"
|
"node": ">= 20"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@tailwindcss/postcss": {
|
||||||
|
"version": "4.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tailwindcss/postcss/-/postcss-4.2.2.tgz",
|
||||||
|
"integrity": "sha512-n4goKQbW8RVXIbNKRB/45LzyUqN451deQK0nzIeauVEqjlI49slUlgKYJM2QyUzap/PcpnS7kzSUmPb1sCRvYQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@alloc/quick-lru": "^5.2.0",
|
||||||
|
"@tailwindcss/node": "4.2.2",
|
||||||
|
"@tailwindcss/oxide": "4.2.2",
|
||||||
|
"postcss": "^8.5.6",
|
||||||
|
"tailwindcss": "4.2.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@tailwindcss/vite": {
|
"node_modules/@tailwindcss/vite": {
|
||||||
"version": "4.2.2",
|
"version": "4.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.2.2.tgz",
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
"dev": "vite"
|
"dev": "vite"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@tailwindcss/postcss": "^4.2.2",
|
||||||
"@tailwindcss/vite": "^4.0.0",
|
"@tailwindcss/vite": "^4.0.0",
|
||||||
"alpinejs": "^3.15.11",
|
"alpinejs": "^3.15.11",
|
||||||
"autoprefixer": "^10.5.0",
|
"autoprefixer": "^10.5.0",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
export default {
|
export default {
|
||||||
plugins: {
|
plugins: {
|
||||||
tailwindcss: {},
|
'@tailwindcss/postcss': {},
|
||||||
autoprefixer: {},
|
autoprefixer: {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en" dir="rtl">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
@ -8,23 +8,45 @@
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-gray-900 text-white font-sans p-10">
|
<body class="bg-gray-900 text-white font-sans p-10">
|
||||||
<div class="max-w-4xl mx-auto">
|
<div class="max-w-4xl mx-auto">
|
||||||
<h1 class="text-3xl font-bold text-red-500 mb-6">Reflected XSS Lab</h1>
|
<h1 class="text-3xl font-bold text-red-500 mb-6 border-b border-red-500 pb-2">آزمایشگاه Reflected XSS</h1>
|
||||||
|
|
||||||
|
<div class="bg-gray-800 p-6 rounded-lg border border-gray-700 shadow-xl mb-6">
|
||||||
|
<form action="{{ route('vulnerability.xss') }}" method="GET">
|
||||||
|
<label for="payload" class="block text-sm font-medium text-gray-300 mb-2">پیلود مخرب (Payload) خود را اینجا وارد کنید:</label>
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-4">
|
||||||
|
<textarea
|
||||||
|
name="payload"
|
||||||
|
id="payload"
|
||||||
|
rows="3"
|
||||||
|
class="w-full bg-gray-900 text-green-400 border border-gray-600 rounded-md p-3 focus:ring-red-500 focus:border-red-500 font-mono text-left"
|
||||||
|
dir="ltr"
|
||||||
|
placeholder="<script>alert(1)</script>"
|
||||||
|
>{{ $payload ?? '' }}</textarea>
|
||||||
|
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<label class="flex items-center space-x-2 space-x-reverse cursor-pointer">
|
||||||
|
<input type="checkbox" name="disable_csp" value="1" class="form-checkbox h-5 w-5 text-red-600 rounded bg-gray-700 border-gray-500" {{ request('disable_csp') ? 'checked' : '' }}>
|
||||||
|
<span class="text-sm text-gray-400">غیرفعال کردن Content-Security-Policy (برای اجرای راحتتر اسکریپت)</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<button type="submit" class="bg-red-600 hover:bg-red-700 text-white font-bold py-2 px-6 rounded transition duration-200">
|
||||||
|
اجرای حمله (Execute)
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="bg-gray-800 p-6 rounded-lg border border-gray-700 shadow-xl">
|
<div class="bg-gray-800 p-6 rounded-lg border border-gray-700 shadow-xl">
|
||||||
<p class="mb-4">ورودی شما در زیر به صورت <strong>Raw</strong> رندر میشود:</p>
|
<h2 class="text-xl font-semibold mb-3 text-yellow-400">خروجی سرور (DOM Sink):</h2>
|
||||||
|
<p class="mb-4 text-sm text-gray-400">ورودی شما بدون فیلتر در کادر زیر رندر شده است:</p>
|
||||||
|
|
||||||
<div class="p-4 bg-gray-700 rounded border border-yellow-500 text-yellow-200">
|
<div class="p-4 bg-gray-700 rounded border border-dashed border-yellow-500 text-yellow-200 min-h-[50px] text-left" dir="ltr">
|
||||||
{{-- استفاده از سینتکس خام برای اجرای اسکریپت --}}
|
{{-- آسیبپذیری ساختاریافته Blade --}}
|
||||||
{!! $payload !!}
|
{!! $payload ?? 'خروجی در اینجا نمایش داده میشود...' !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-10 p-6 bg-blue-900/30 rounded-lg border border-blue-500">
|
|
||||||
<h2 class="text-xl font-semibold mb-3">تست در مرورگر:</h2>
|
|
||||||
<code class="block bg-black p-3 rounded text-green-400 break-all">
|
|
||||||
/xss?payload=<script>alert('XSS by Browser-Sec-Lab')</script>
|
|
||||||
</code>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
Reference in New Issue
Block a user