Skip to content

Commit d1533f9

Browse files
results
1 parent cca39be commit d1533f9

2 files changed

Lines changed: 50 additions & 39 deletions

File tree

cmd/results.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,12 +480,14 @@ var resultsQueryCmd = &cobra.Command{
480480
Long: `Query findings across all scans with advanced filtering options.
481481
482482
Examples:
483+
shells results query --scan-id abc8343a-76ed-4346-bd62-4b04a0e46d12
483484
shells results query --severity critical
484485
shells results query --tool scim --type "SCIM_UNAUTHORIZED_ACCESS"
485486
shells results query --search "injection" --limit 20
486487
shells results query --target example.com --severity high,critical`,
487488
RunE: func(cmd *cobra.Command, args []string) error {
488489
// Get flags
490+
scanID, _ := cmd.Flags().GetString("scan-id")
489491
severity, _ := cmd.Flags().GetString("severity")
490492
tool, _ := cmd.Flags().GetString("tool")
491493
findingType, _ := cmd.Flags().GetString("type")
@@ -503,6 +505,7 @@ Examples:
503505

504506
// Build query
505507
query := core.FindingQuery{
508+
ScanID: scanID,
506509
Tool: tool,
507510
Type: findingType,
508511
Target: target,
@@ -595,6 +598,7 @@ Shows:
595598

596599
func init() {
597600
// Query command flags
601+
resultsQueryCmd.Flags().String("scan-id", "", "Filter by specific scan ID")
598602
resultsQueryCmd.Flags().String("severity", "", "Filter by severity (critical,high,medium,low,info)")
599603
resultsQueryCmd.Flags().String("tool", "", "Filter by tool (scim,smuggling,nmap,etc)")
600604
resultsQueryCmd.Flags().String("type", "", "Filter by finding type")

cmd/vuln_testing.go

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ func runBugBountyVulnTesting(ctx context.Context, session *discovery.DiscoverySe
3737
totalFindings = runWebAppTestSuite(ctx, session, log, store)
3838
}
3939

40+
// Always run authentication testing regardless of target type
41+
// (mail servers, APIs, and web apps can all have auth mechanisms)
42+
fmt.Printf("\n%s=== Cross-Cutting Security Tests ===%s\n", "\033[1;35m", "\033[0m")
43+
fmt.Printf("[+] Testing authentication mechanisms... ")
44+
authFindings := testWebAuthentication(ctx, session, log)
45+
totalFindings = append(totalFindings, authFindings...)
46+
printTestResult(len(authFindings))
47+
4048
// Display summary
4149
fmt.Printf("\n%sVulnerability Testing Complete%s\n", "\033[1;32m", "\033[0m")
4250
fmt.Printf("Time: %v\n", time.Since(startTime).Round(time.Second))
@@ -149,38 +157,32 @@ func runAPITestSuite(ctx context.Context, session *discovery.DiscoverySession, l
149157
func runWebAppTestSuite(ctx context.Context, session *discovery.DiscoverySession, log *logger.Logger, store core.ResultStore) []types.Finding {
150158
var allFindings []types.Finding
151159

152-
// Test 1: Authentication
153-
fmt.Printf("[1/6] Testing authentication mechanisms... ")
154-
authFindings := testWebAuthentication(ctx, session, log)
155-
allFindings = append(allFindings, authFindings...)
156-
printTestResult(len(authFindings))
157-
158-
// Test 2: SQL Injection
159-
fmt.Printf("[2/6] Testing for SQL injection... ")
160+
// Test 1: SQL Injection
161+
fmt.Printf("[1/5] Testing for SQL injection... ")
160162
sqliFindings := testSQLInjection(ctx, session, log)
161163
allFindings = append(allFindings, sqliFindings...)
162164
printTestResult(len(sqliFindings))
163165

164-
// Test 3: XSS
165-
fmt.Printf("[3/6] Testing for XSS... ")
166+
// Test 2: XSS
167+
fmt.Printf("[2/5] Testing for XSS... ")
166168
xssFindings := testXSS(ctx, session, log)
167169
allFindings = append(allFindings, xssFindings...)
168170
printTestResult(len(xssFindings))
169171

170-
// Test 4: IDOR
171-
fmt.Printf("[4/6] Testing for IDOR... ")
172+
// Test 3: IDOR
173+
fmt.Printf("[3/5] Testing for IDOR... ")
172174
idorFindings := testIDOR(ctx, session, log)
173175
allFindings = append(allFindings, idorFindings...)
174176
printTestResult(len(idorFindings))
175177

176-
// Test 5: SSRF
177-
fmt.Printf("[5/6] Testing for SSRF... ")
178+
// Test 4: SSRF
179+
fmt.Printf("[4/5] Testing for SSRF... ")
178180
ssrfFindings := testSSRF(ctx, session, log)
179181
allFindings = append(allFindings, ssrfFindings...)
180182
printTestResult(len(ssrfFindings))
181183

182-
// Test 6: Open Redirect
183-
fmt.Printf("[6/6] Testing for open redirects... ")
184+
// Test 5: Open Redirect
185+
fmt.Printf("[5/5] Testing for open redirects... ")
184186
redirectFindings := testOpenRedirect(ctx, session, log)
185187
allFindings = append(allFindings, redirectFindings...)
186188
printTestResult(len(redirectFindings))
@@ -201,6 +203,7 @@ func printTestResult(count int) {
201203

202204
func testMailDefaultCredentials(ctx context.Context, session *discovery.DiscoverySession, log *logger.Logger) []types.Finding {
203205
var findings []types.Finding
206+
foundPanels := make(map[string]bool) // Track already found admin panels to avoid duplicates
204207

205208
// Most common default credentials for mail servers (reduced for speed)
206209
defaultCreds := []struct {
@@ -243,30 +246,34 @@ func testMailDefaultCredentials(ctx context.Context, session *discovery.Discover
243246

244247
// Skip credential testing for now to avoid hanging
245248
// TODO: Fix the TestCredentials method that seems to hang
246-
// For now, just report that we found an admin panel
249+
// For now, just report that we found an admin panel (avoid duplicates)
247250
if statusCode == 200 && (strings.Contains(path, "admin") || strings.Contains(path, "webmail")) {
248-
// Report the finding without testing credentials
249-
findings = append(findings, types.Finding{
250-
ID: fmt.Sprintf("mail-admin-%s-%d", session.ID, len(findings)+1),
251-
ScanID: session.ID,
252-
Tool: "mail-scanner",
253-
Type: "ADMIN_PANEL_FOUND",
254-
Severity: types.SeverityMedium,
255-
Title: "Mail Admin Panel Accessible",
256-
Description: fmt.Sprintf("Found accessible mail admin panel at %s", path),
257-
Evidence: fmt.Sprintf("Admin panel found at %s (Status: %d)", url, statusCode),
258-
Solution: "Ensure admin panel is properly secured with strong authentication",
259-
References: []string{
260-
"https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/04-Authentication_Testing/",
261-
},
262-
Metadata: map[string]interface{}{
263-
"url": url,
264-
"status_code": statusCode,
265-
"path": path,
266-
},
267-
CreatedAt: time.Now(),
268-
UpdatedAt: time.Now(),
269-
})
251+
// Check if we've already reported this URL to avoid duplicates
252+
if !foundPanels[url] {
253+
foundPanels[url] = true
254+
// Report the finding without testing credentials
255+
findings = append(findings, types.Finding{
256+
ID: fmt.Sprintf("mail-admin-%s-%d", session.ID, len(findings)+1),
257+
ScanID: session.ID,
258+
Tool: "mail-scanner",
259+
Type: "ADMIN_PANEL_FOUND",
260+
Severity: types.SeverityMedium,
261+
Title: "Mail Admin Panel Accessible",
262+
Description: fmt.Sprintf("Found accessible mail admin panel at %s", path),
263+
Evidence: fmt.Sprintf("Admin panel found at %s (Status: %d)", url, statusCode),
264+
Solution: "Ensure admin panel is properly secured with strong authentication",
265+
References: []string{
266+
"https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/04-Authentication_Testing/",
267+
},
268+
Metadata: map[string]interface{}{
269+
"url": url,
270+
"status_code": statusCode,
271+
"path": path,
272+
},
273+
CreatedAt: time.Now(),
274+
UpdatedAt: time.Now(),
275+
})
276+
}
270277
}
271278

272279
// Test the credentials (disabled for now to prevent hanging)

0 commit comments

Comments
 (0)