mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-25 20:51:52 +08:00
fix: Elasticsearch未授权检测优先于爆破 (#554)
This commit is contained in:
@@ -438,6 +438,8 @@ mongodb_auth_required:
|
|||||||
other: "MongoDB {{.Arg1}} Authentication required"
|
other: "MongoDB {{.Arg1}} Authentication required"
|
||||||
elasticsearch_credential:
|
elasticsearch_credential:
|
||||||
other: "Elasticsearch {{.Arg1}} {{.Arg2}}:{{.Arg3}}"
|
other: "Elasticsearch {{.Arg1}} {{.Arg2}}:{{.Arg3}}"
|
||||||
|
elasticsearch_unauth:
|
||||||
|
other: "Elasticsearch {{.Arg1}} Unauthorized access"
|
||||||
elasticsearch_service:
|
elasticsearch_service:
|
||||||
other: "Elasticsearch {{.Arg1}} {{.Arg2}}"
|
other: "Elasticsearch {{.Arg1}} {{.Arg2}}"
|
||||||
mysql_credential:
|
mysql_credential:
|
||||||
|
|||||||
@@ -438,6 +438,8 @@ mongodb_auth_required:
|
|||||||
other: "MongoDB {{.Arg1}} 需要认证"
|
other: "MongoDB {{.Arg1}} 需要认证"
|
||||||
elasticsearch_credential:
|
elasticsearch_credential:
|
||||||
other: "Elasticsearch {{.Arg1}} {{.Arg2}}:{{.Arg3}}"
|
other: "Elasticsearch {{.Arg1}} {{.Arg2}}:{{.Arg3}}"
|
||||||
|
elasticsearch_unauth:
|
||||||
|
other: "Elasticsearch {{.Arg1}} 未授权访问"
|
||||||
elasticsearch_service:
|
elasticsearch_service:
|
||||||
other: "Elasticsearch {{.Arg1}} {{.Arg2}}"
|
other: "Elasticsearch {{.Arg1}} {{.Arg2}}"
|
||||||
mysql_credential:
|
mysql_credential:
|
||||||
|
|||||||
@@ -32,6 +32,18 @@ func (p *ElasticsearchPlugin) Scan(ctx context.Context, info *common.HostInfo, c
|
|||||||
return p.identifyService(ctx, info, config, state)
|
return p.identifyService(ctx, info, config, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 首先检测未授权访问
|
||||||
|
if p.testCredential(ctx, info, Credential{Username: "", Password: ""}, config, state) {
|
||||||
|
common.LogSuccess(i18n.Tr("elasticsearch_unauth", target))
|
||||||
|
return &ScanResult{
|
||||||
|
Success: true,
|
||||||
|
Type: plugins.ResultTypeVuln,
|
||||||
|
Service: "elasticsearch",
|
||||||
|
VulInfo: "未授权访问",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果需要认证,尝试常见凭据
|
||||||
credentials := GenerateCredentials("elasticsearch", config)
|
credentials := GenerateCredentials("elasticsearch", config)
|
||||||
if len(credentials) == 0 {
|
if len(credentials) == 0 {
|
||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
@@ -46,7 +58,7 @@ func (p *ElasticsearchPlugin) Scan(ctx context.Context, info *common.HostInfo, c
|
|||||||
common.LogSuccess(i18n.Tr("elasticsearch_credential", target, cred.Username, cred.Password))
|
common.LogSuccess(i18n.Tr("elasticsearch_credential", target, cred.Username, cred.Password))
|
||||||
return &ScanResult{
|
return &ScanResult{
|
||||||
Success: true,
|
Success: true,
|
||||||
Type: plugins.ResultTypeCredential,
|
Type: plugins.ResultTypeCredential,
|
||||||
Service: "elasticsearch",
|
Service: "elasticsearch",
|
||||||
Username: cred.Username,
|
Username: cred.Username,
|
||||||
Password: cred.Password,
|
Password: cred.Password,
|
||||||
|
|||||||
Reference in New Issue
Block a user