{"record":{"id":"e68f260f25fda0f5","repo":"shadow1ng/fscan","slug":"i18n-tr-service-not-identified-mongodb","errorCode":null,"errorMessage":"i18n.Tr(\"service_not_identified\", \"MongoDB\")","messagePattern":"i18n\\.Tr\\(\"service_not_identified\", \"MongoDB\"\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"plugins/services/mongodb.go","lineNumber":638,"sourceCode":"\trealhost := info.Target()\n\n\treply, err := p.checkMongoAuth(ctx, realhost, createOpMsgPacket(), session)\n\tif err != nil {\n\t\treply, err = p.checkMongoAuth(ctx, realhost, createOpQueryPacket(), session)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\tif strings.Contains(reply, \"totalLinesWritten\") {\n\t\treturn true, nil\n\t}\n\n\tif len(reply) > 0 {\n\t\treturn false, nil\n\t}\n\n\treturn false, fmt.Errorf(\"%s\", i18n.Tr(\"service_not_identified\", \"MongoDB\"))\n}\n\nfunc (p *MongoDBPlugin) checkMongoAuth(ctx context.Context, address string, packet []byte, session *common.ScanSession) (string, error) {\n\tconn, err := session.DialTCP(ctx, \"tcp\", address, session.Config.ModuleTimeout())\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(i18n.Tr(\"service_connection_failed\", \"%w\"), err)\n\t}\n\tdefer func() { _ = conn.Close() }()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn \"\", ctx.Err()\n\tdefault:\n\t}\n\n\tif deadlineErr := conn.SetDeadline(time.Now().Add(session.Config.ModuleTimeout())); deadlineErr != nil {\n\t\treturn \"\", deadlineErr\n\t}","sourceCodeStart":620,"sourceCodeEnd":656,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/services/mongodb.go#L620-L656","documentation":"mongodbUnauth sends a probe to a MongoDB server without credentials; if the server returns a non-empty reply but the plugin cannot conclude an unauthenticated state from it, it reports the generic localized 'service not identified: MongoDB' error — the service could not be positively fingerprinted as MongoDB with the given response.","triggerScenarios":"checkMongoAuth returns a reply string, but the caller's heuristics find no MongoDB marker in it, or the reply is unexpected for both the auth and unauth paths, so mongodbUnauth falls through to its final error return.","commonSituations":"Scanning a port where a non-MongoDB service responds with arbitrary bytes; a mongod whose reply shape changed across major versions; firewalls/IPS returning synthetic responses.","solutions":["Verify the service on that port is genuinely MongoDB (check hello/buildInfo output)","Update the response-parsing heuristics if the target runs a newer MongoDB with a changed reply format","Scan with a plain protocol banner grab first to confirm what is listening","Exclude intermediate security devices that inject synthetic responses"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// confirm MongoDB banner before unauth check\nif !strings.Contains(strings.ToLower(banner), \"mongodb\") {\n    return errors.New(\"target does not advertise MongoDB\")\n}","typeGuard":"func isServiceNotIdentified(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"not identified\")\n}","tryCatchPattern":"ok, err := mongodbUnauth(ctx, addr, session)\nif err != nil {\n    if isServiceNotIdentified(err) {\n        log.Infof(\"%s did not fingerprint as MongoDB; skipping\", addr)\n        return nil\n    }\n    return err\n}","preventionTips":["Run a generic banner grab before service-specific plugins","Keep fingerprint heuristics updated for new MongoDB major versions","Exclude proxy-synthesized responses from detection logic"],"tags":["mongodb","service-detection","fingerprinting"],"backgroundTag":"unexpected-response-shape","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}