{"record":{"id":"e2d822787222fd24","repo":"shadow1ng/fscan","slug":"service-no-credentials","errorCode":null,"errorMessage":"service_no_credentials","messagePattern":"service_no_credentials","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/services/mssql.go","lineNumber":40,"sourceCode":"\t\tBasePlugin: plugins.NewBasePlugin(\"mssql\"),\n\t}\n}\n\nfunc (p *MSSQLPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {\n\tconfig := session.Config\n\tstate := session.State\n\tif config.DisableBrute {\n\t\treturn p.identifyService(ctx, info, session)\n\t}\n\n\ttarget := info.Target()\n\n\tcredentials := GenerateCredentials(\"mssql\", config)\n\tif len(credentials) == 0 {\n\t\treturn &ScanResult{\n\t\t\tSuccess: false,\n\t\t\tService: \"mssql\",\n\t\t\tError:   fmt.Errorf(\"%s\", i18n.GetText(\"service_no_credentials\")),\n\t\t}\n\t}\n\n\t// 使用公共框架进行并发凭据测试\n\tauthFn := p.createAuthFunc(info, config, state)\n\ttestConfig := DefaultConcurrentTestConfigWithTarget(config, info)\n\n\tresult := TestCredentialsConcurrently(ctx, credentials, authFn, \"mssql\", testConfig)\n\n\tif result.Success {\n\t\tsession.LogVuln(i18n.Tr(\"mssql_credential\", target, result.Username, result.Password))\n\t}\n\n\treturn result\n}\n\n// createAuthFunc 创建MSSQL认证函数\nfunc (p *MSSQLPlugin) createAuthFunc(info *common.HostInfo, config *common.Config, state *common.State) AuthFunc {","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/services/mssql.go#L22-L58","documentation":"The MSSQL service plugin's Scan first generates candidate credentials for the 'mssql' service. If GenerateCredentials returns an empty list (no usernames/passwords configured or enabled in the config), Scan immediately returns a failed ScanResult with the i18n message 'service_no_credentials'. The scan never attempts a connection in this state.","triggerScenarios":"Calling Scan with a config that yields zero credentials: both username and password lists empty or the mssql credential set disabled/missing in configuration passed to GenerateCredentials(\"mssql\", config).","commonSituations":"Config file omits the mssql credential section; user intended to use default credentials but they are disabled; wrong service key used so no matching credentials are generated.","solutions":["Add mssql usernames/passwords to the credential configuration","Enable the built-in default credential set for mssql in the config","Verify the service key in the config is exactly 'mssql'","Log the output of GenerateCredentials to debug which lists came back empty"],"exampleFix":"// before\nconfig := map[string]interface{}{\"targets\": []string{\"db.local:1433\"}}\nres := plugin.Scan(info, config, state) // service_no_credentials\n// after\nconfig := map[string]interface{}{\n    \"targets\": []string{\"db.local:1433\"},\n    \"usernames\": []string{\"sa\"},\n    \"passwords\": []string{\"sa\", \"123456\"},\n}\nres := plugin.Scan(info, config, state)","handlingStrategy":"validation","validationCode":"creds := GenerateCredentials(\"mssql\", config)\nif len(creds) == 0 {\n    return errors.New(\"no mssql credentials configured: add usernames/passwords to config before scanning\")\n}","typeGuard":null,"tryCatchPattern":"res := plugin.Scan(info, config, state)\nif !res.Success && res.Error != nil && strings.Contains(res.Error.Error(), \"service_no_credentials\") {\n    // fix config: supply mssql credentials, then rescan\n    return fmt.Errorf(\"scan aborted, mssql credential list empty: %w\", res.Error)\n}","preventionTips":["Always include at least one username/password pair for each service scanned","Enable default credential lists if you rely on built-ins","Validate config before launching scans (fail fast on empty lists)","Keep the service key spelling consistent ('mssql') with credential definitions"],"tags":["mssql","credentials","config","go"],"backgroundTag":"missing-credentials","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"}