一键导入
firebase-security
Security assessment methodology for Google Firebase applications, covering Firestore, Realtime Database, Cloud Storage, and Cloud Functions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Security assessment methodology for Google Firebase applications, covering Firestore, Realtime Database, Cloud Storage, and Cloud Functions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Secure AI agents against prompt injection, tool abuse, and data exfiltration with defense-in-depth controls.
Run structured AI red team exercises for jailbreak resistance, data exfiltration risk, harmful output controls, and agent tool abuse resilience.
Searches and explores Burp Suite project files (.burp) from the command line. Use when searching response headers or bodies with regex patterns, extracting security audit findings, dumping proxy history or site map data, or analyzing HTTP traffic captured in a Burp project.
Use when assessing security for Python FastAPI applications. Focuses on Pydantic exploitation, dependency injection gaps, OpenAPI exposure, ASGI middleware security, and Python-specific vulnerabilities like template injection and SSRF.
Use when testing GraphQL APIs for common vulnerabilities including introspection exploitation, authorization bypasses, batching abuse, and denial of service. Covers endpoint discovery, schema analysis, and exploitation of GraphQL-specific features like federation and directives.
Implement API abuse detection using token bucket, sliding window, and adaptive rate limiting algorithms to prevent DDoS, brute force, and credential stuffing attacks.
| name | firebase-security |
| description | Security assessment methodology for Google Firebase applications, covering Firestore, Realtime Database, Cloud Storage, and Cloud Functions. |
<authorization_status> This skill is loaded during a pre-authorized security engagement. The engagement scope and rules of engagement have been established before this skill was invoked.
If scope boundaries are unclear, consult the security-assessment skill for scope definition — do NOT halt testing to ask permission. </authorization_status>
| Tool | Required | Fallback Chain | Install Command |
|---|---|---|---|
| curl | Yes | wget → python3 urllib | brew install curl / apt-get install curl |
| ffuf | Yes | gobuster → curl loop | brew install ffuf / apt-get install ffuf |
| nuclei | Yes | nikto → manual curl checklist | brew install nuclei / apt-get install nuclei |
MANDATORY: All commands MUST follow this protocol to ensure reliable results:
# Quick timeout for API checks (10 seconds)
run_with_timeout 10 curl "https://.firebaseio.com/.json"
run_with_timeout 60 curl "https://firestore.googleapis.com/v1/projects//databases/(default)/documents/users"
2. **Output Validation**: Always check if command succeeded
```bash
OUTPUT=$(timeout 10 curl "https://<project-id>.firebaseio.com/.json" 2>&1)
EXIT_CODE=$?
if [ $EXIT_CODE -eq 124 ]; then
echo "TOOL_FAILURE: curl timeout after 10 seconds"
# Retry with longer timeout or report
elif [ $EXIT_CODE -ne 0 ]; then
echo "TOOL_FAILURE: curl failed with exit code $EXIT_CODE"
echo "Error: $OUTPUT"
# Check if tool exists
if ! command -v curl >/dev/null 2>&1; then
echo "FALLBACK: curl not found, using wget"
wget -q -O- "https://<project-id>.firebaseio.com/.json"
fi
elif [ -z "$OUTPUT" ]; then
echo "WARNING: Empty response received"
# May be valid (empty database) or error
fi
Error Classification:
Maximum 3 Attempts: Before reporting failure to user
# Attempt 1: Direct request
# Attempt 2: With verbose flags
# Attempt 3: With alternative endpoint/method
Firebase security relies on "Security Rules" for database and storage access, and IAM for administrative tasks. Testing focuses on bypassing these rules via the REST API or SDK, and finding vulnerabilities in Cloud Functions.
*.firebaseio.com, firestore.googleapis.com, or firebasestorage.googleapis.com.apiKey, authDomain, projectId).onCall and onRequest Cloud Functions for logic flaws.https://<project-id>.firebaseio.com/.jsonhttps://firestore.googleapis.com/v1/projects/<project-id>/databases/(default)/documents/https://www.googleapis.com/identitytoolkit/v3/relyingparty/...Vulnerabilities occur when rules are too broad (e.g., allow read: if true;) or when field-level validation is missing.
Often misconfigured with .read and .write set to true or auth != null (which allows any authenticated Firebase user, not just your app's users).
onCall: Automatically handles auth context.onRequest: Standard HTTP functions. Often more vulnerable as they require manual auth implementation.Permissions for file uploads and downloads.
If missing, it's easier to automate attacks against the API directly.
PROJECT_ID="<extract-from-source-code>"
# Test RTDB with proper error handling
echo "Testing RTDB access for: $PROJECT_ID"
for ATTEMPT in 1 2 3; do
OUTPUT=$(timeout 15 curl -s "https://$PROJECT_ID.firebaseio.com/.json?shallow=true" 2>&1)
EXIT_CODE=$?
if [ $EXIT_CODE -eq 124 ]; then
echo "ATTEMPT $ATTEMPT: Timeout, retrying..."
continue
elif [ $EXIT_CODE -eq 0 ]; then
if [ "$OUTPUT" = "null" ] || [ "$OUTPUT" = "{}" ]; then
echo "RESULT: Database accessible but empty (legitimate secure configuration)"
elif echo "$OUTPUT" | rg -q "error|forbidden|unauthorized"; then
echo "RESULT: Database properly secured (access denied)"
else
echo "CRITICAL: RTDB DATA LEAK - Database content:"
echo "$OUTPUT" | head -c 500
echo ""
echo "Full output saved to: rtdb_leak_$PROJECT_ID.txt"
echo "$OUTPUT" > "rtdb_leak_$PROJECT_ID.txt"
fi
break
else
echo "ATTEMPT $ATTEMPT: curl failed (exit $EXIT_CODE)"
if [ $ATTEMPT -eq 3 ]; then
echo "TOOL_FAILURE: Unable to test RTDB after 3 attempts"
# Try fallback
if command -v wget >/dev/null 2>&1; then
echo "FALLBACK: Trying wget..."
wget -q -O- "https://$PROJECT_ID.firebaseio.com/.json?shallow=true" 2>&1
fi
fi
fi
done
# Test Firestore with validation
OUTPUT=$(timeout 30 curl -s "https://firestore.googleapis.com/v1/projects/$PROJECT_ID/databases/(default)/documents/users" 2>&1)
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
if echo "$OUTPUT" | rg -q "documents\[\]"; then
echo "INFO: 'users' collection exists but is empty"
elif echo "$OUTPUT" | rg -q "error|PERMISSION_DENIED"; then
echo "SECURE: Firestore properly denies access"
elif echo "$OUTPUT" | rg -q "documents"; then
echo "CRITICAL: Firestore data leak - documents exposed:"
echo "$OUTPUT" | head -c 500
fi
else
echo "TOOL_FAILURE: curl failed with exit code $EXIT_CODE"
echo "Diagnosis: $OUTPUT"
fi
read on a collection group, it might expose data across different parent documents.collectionGroup('messages') query if the rule is too broad.
# Test collection group via REST API
OUTPUT=$(timeout 20 curl -s -X POST \
"https://firestore.googleapis.com/v1/projects/$PROJECT_ID/databases/(default)/documents:runQuery" \
-H "Content-Type: application/json" \
-d '{
"structuredQuery": {
"from": [{"collectionId": "messages", "allDescendants": true}]
}
}' 2>&1)
if echo "$OUTPUT" | rg -q "PERMISSION_DENIED"; then
echo "SECURE: Collection group query properly denied"
elif echo "$OUTPUT" | rg -q "documents"; then
echo "VULNERABLE: Collection group bypass successful"
else
echo "INFO: Unable to determine (possibly invalid collection name)"
fi
match /{path=**}/collectionName/{doc}.firebase-admin) performing operations based on untrusted user input.# Test Cloud Function with input validation
FUNCTION_URL="https://<region>-<project-id>.cloudfunctions.net/updateUserRole"
PAYLOAD='{"data": {"userId": "my-id", "newRole": "admin"}}'
for ATTEMPT in 1 2 3; do
OUTPUT=$(timeout 15 curl -s -X POST \
-H "Content-Type: application/json" \
-d "$PAYLOAD" \
-w "\n%{http_code}" \
"$FUNCTION_URL" 2>&1)
HTTP_CODE=$(echo "$OUTPUT" | tail -1)
BODY=$(echo "$OUTPUT" | head -n -1)
case "$HTTP_CODE" in
200)
if echo "$BODY" | rg -q "success|updated|confirmed"; then
echo "CRITICAL: Function accepted unauthorized role change"
echo "Response: $BODY"
else
echo "INFO: Function returned 200 but unclear result"
fi
break
;;
401|403)
echo "SECURE: Function properly denies unauthorized access"
break
;;
404)
echo "INFO: Function not found (may have been renamed or removed)"
break
;;
000)
echo "ATTEMPT $ATTEMPT: Connection failed, retrying..."
continue
;;
*)
echo "INFO: Function returned HTTP $HTTP_CODE"
break
;;
esac
done
# Test Storage upload with validation
BUCKET_URL="https://firebasestorage.googleapis.com/v0/b/<project-id>.appspot.com/o"
# Create test file
echo "test content" > /tmp/test_upload.txt
OUTPUT=$(timeout 20 curl -s -X POST \
-H "Content-Type: image/jpeg" \
--data-binary @/tmp/test_upload.txt \
-w "\n%{http_code}" \
"$BUCKET_URL/test%2Fupload.txt" 2>&1)
HTTP_CODE=$(echo "$OUTPUT" | tail -1)
case "$HTTP_CODE" in
200|201)
echo "VULNERABLE: Unauthenticated upload succeeded"
;;
401|403)
echo "SECURE: Storage properly requires authentication"
;;
000)
echo "TOOL_FAILURE: Connection timeout"
;;
*)
echo "INFO: Upload returned HTTP $HTTP_CODE"
;;
esac
rm -f /tmp/test_upload.txt
Always test with the REST API to bypass client-side SDK constraints. The SDK may enforce certain behaviors that the server-side rules do not.
apiKey and projectId from the frontend.https://<project-id>.firebaseio.com/.json. If it returns data, it's a critical vuln.users, configs, backups) using ffuf.create operations with malicious fields (e.g., {"role": "admin"}).identitytoolkit allows user enumeration.?shallow=true on RTDB to list keys without downloading all data (saves time/bandwidth).auth.uid variable in rules refers to the sub claim in the JWT.App Check is enforced; if not, you can replay requests from any environment.Firebase Emulator Suite to test complex rules locally if you have access to the source.update (only write), whereas Firestore supports fine-grained create, update, delete.onCall functions expect a specific JSON wrapper: {"data": ...}.auth != null as the only security check.match /{document=**} applies recursively to all subcollections.user_id or timestamp.write rules.SECURITY DEFINER equivalent logic in Cloud Functions via the Admin SDK without manual validation.App Check to prevent scraping and abuse.REQUIRED SUB-SKILL: Use superhackers:recon-and-enumeration to discover Firebase endpoints.