shadow1ng/fscan · warning
%s
Error message
%s
What it means
The Elasticsearch plugin's Scan builds candidate credentials via GenerateCredentials("elasticsearch", config); when the list is empty it aborts with this error from i18n key service_no_credentials. The plugin refuses to proceed because there is nothing to authenticate with, and a ScanResult with Success:false is returned instead of attempting the HTTP checks.
Source
Thrown at plugins/services/elasticsearch.go:52
// 首先检测未授权访问
if p.testCredential(ctx, info, Credential{Username: "", Password: ""}, session) {
session.LogVuln(i18n.Tr("elasticsearch_unauth", target))
return &ScanResult{
Success: true,
Type: plugins.ResultTypeVuln,
Service: "elasticsearch",
VulInfo: i18n.GetText("unauthorized_access"),
}
}
// 如果需要认证,尝试常见凭据
credentials := GenerateCredentials("elasticsearch", config)
if len(credentials) == 0 {
return &ScanResult{
Success: false,
Service: "elasticsearch",
Error: fmt.Errorf("%s", i18n.GetText("service_no_credentials")),
}
}
for _, cred := range credentials {
if p.testCredential(ctx, info, cred, session) {
session.LogVuln(i18n.Tr("elasticsearch_credential", target, cred.Username, cred.Password))
return &ScanResult{
Success: true,
Type: plugins.ResultTypeCredential,
Service: "elasticsearch",
Username: cred.Username,
Password: cred.Password,
}
}
}
return &ScanResult{
Success: false,View on GitHub (pinned to 95cc12e753)
Solutions
- Add elasticsearch credentials to the scan config (custom user/pass pairs) or re-enable default credential generation.
- Verify the dictionary/wordlist files referenced by the config exist and are readable and non-empty.
- Log GenerateCredentials("elasticsearch", config) output to confirm which config keys feed it and which are missing.
- If no credential testing is desired, skip the plugin instead of calling Scan.
Example fix
// before
config := &Config{} // no credentials configured
res := esPlugin.Scan(ctx, info, session)
// after
config := &Config{Credentials: []Credential{{Username: "elastic", Password: "changeme"}}}
res := esPlugin.Scan(ctx, info, session) Defensive patterns
Strategy: validation
Validate before calling
creds := GenerateCredentials("elasticsearch", config)
if len(creds) == 0 {
return errors.New("elasticsearch scan aborted: provide credentials or fix dictionary config")
} Try / catch
res := plugin.Scan(ctx, info, session)
if !res.Success && res.Error != nil && res.Error.Error() == i18n.GetText("service_no_credentials") {
log.Printf("no credentials for %s; configure them and rerun", res.Service)
return nil
} Prevention
- Populate credential config before running service plugins
- Verify wordlist files exist and are non-empty at startup
- Do not clear credential fields when copying config structs
- Dry-run GenerateCredentials during config validation
When it happens
Trigger: Scan called with a config that supplies no custom elasticsearch credentials and yields no generated defaults — e.g. empty username/password lists, missing dictionary, or config fields cleared by the caller.
Common situations: Running the scan with an empty or minimal config file; a refactor that renamed the config keys the credential generator reads; disabling the default-credential generation feature; service name mismatch so nothing is generated.
Related errors
AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06).
Data as JSON: /api/errors/703c28fb7dcff9c4.
Report an issue: GitHub.