このプロジェクトは、CVE-2026-76460 に着想を得た、模擬的な認証バイパスシナリオを実演するものです。このラボは意図的に教育的かつ安全に設計されています。実際のシステムを対象とすることなく、脆弱な挙動と修正済みの挙動をシミュレートするローカルの Flask API です。
このアプリケーションは、特権管理 API が認証制御なしで公開される可能性があること、そして安全な実装が未認証アクセスをどのようにブロックするかを示します。
flowchart LR
Client[Local client or test harness] --> Entry[app.py]
Entry --> Factory[security_lab.factory]
Factory --> Mode{Lab mode}
Mode -->|vulnerable| Open[Management users endpoint\nallows anonymous access]
Mode -->|secure| Bearer[Bearer token validation]
Mode -->|secure-strict| Admin[Bearer token + admin role]
Bearer --> Result[200 or 401 response]
Admin --> Result2[200, 401, or 403 response]
Open --> Result3[200 response with warning]
Factory --> Audit[Audit logger]
Audit --> Log[audit.log].
├── app.py # entry point for the local lab
├── build.sh # creates the venv, installs dependencies, and runs checks
├── run.sh # starts the vulnerable app locally
├── pyproject.toml # project metadata and tool configuration
├── gunicorn.conf.py # deployment configuration for a production-style server
├── src/
│ └── security_lab/
│ ├── __init__.py
│ ├── config.py # lab settings and valid tokens
│ ├── audit.py # file-based audit logger
│ └── factory.py # Flask routes and auth logic
├── tests/
│ └── test_api.py # regression tests for vulnerable and secure modes
├── exploit.py # proof-of-concept route attack script
├── pentest_harness.py # CLI verification helper
├── BUILD_GUIDE.md # build and OS details
├── WALKTHROUGH.md # step-by-step lab walkthrough
├── SECURITY_REPORT.md # summary of the mock vulnerability and fix
├── CONTRIBUTING.md # contribution workflow
├── LICENSE # MIT license
├── requirements.txt # pinned dependencies
├── .env.example # sample environment configuration
└── .github/workflows/
└── python-tests.yml # CI validation for push and pull requests
chmod +x build.sh run.sh
./build.sh
./run.sh
次に、以下のコマンドでテストします:
curl -i http://127.0.0.1:5000/api/management/users
$ curl -i http://127.0.0.1:5000/api/management/users
HTTP/1.1 200 OK
Content-Type: application/json
{
"users": [
{"id": 1, "username": "admin", "role": "super-admin"},
{"id": 2, "username": "operator", "role": "operator"}
],
"warning": "unauthenticated access allowed"
}
source .venv/bin/activate
python exploit.py --host 127.0.0.1 --port 5000
source .venv/bin/activate
python pentest_harness.py --mode vulnerable
python pentest_harness.py --mode secure
python pentest_harness.py --mode secure-strict
/api/management/users にアクセスできます。403 で拒否されます。make lint
make test
main を対象とするすべてのプッシュとプルリクエストでは、サポートされている Python バージョンで Ruff と pytest スイートが実行されます。これらのチェックが通過した後にバージョンタグをプッシュすることでリリースが作成されます:
git tag v0.1.0
git push origin v0.1.0
タグワークフローは、生成されたリリースノートを含む GitHub Release を作成します。リリースは教育用ラボのソースとドキュメントを対象としています。実際の対象システム向けのエクスプロイト素材をパッケージ化しないでください。
これは、テスト、学習、および防御的研究のみを目的とした管理されたラボ環境です。許可なく実際のシステムに対して使用してはなりません。