Skip to content

Commit edca3b0

Browse files
committed
Add GHSA reference type support for GitHub Security Advisories
1 parent 3576e2b commit edca3b0

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

docs/metasploit-framework.wiki/Module-Reference-Identifiers.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ US-CERT-VU | kb.cert.org | ```['US-CERT-VU', '800113']```
1818
ZDI | zerodayinitiative.com | ```['ZDI', '10-123']```
1919
WPVDB | wpvulndb.com | ```['WPVDB', '7615']```
2020
PACKETSTORM | packetstormsecurity.com | ```['PACKETSTORM', '132721']```
21+
GHSA | github.com/advisories | ```['GHSA', 'xxxx-xxxx-xxxx']```
2122
URL | anything | ```['URL', 'http://example.com/blog.php?id=123']```
2223
AKA (_deprecated_*) | anything | ~~`['AKA', 'shellshock']`~~
2324

lib/msf/core/module/reference.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ def initialize(in_ctx_id = 'Unknown', in_ctx_val = '')
114114
self.site = "https://wpscan.com/vulnerability/#{in_ctx_val}"
115115
elsif in_ctx_id == 'PACKETSTORM'
116116
self.site = "https://packetstormsecurity.com/files/#{in_ctx_val}"
117+
elsif in_ctx_id == 'GHSA'
118+
# Handle both formats: with or without GHSA- prefix
119+
ghsa_id = in_ctx_val.start_with?('GHSA-') ? in_ctx_val : "GHSA-#{in_ctx_val}"
120+
self.site = "https://github.com/advisories/#{ghsa_id}"
117121
elsif in_ctx_id == 'URL'
118122
self.site = in_ctx_val.to_s
119123
elsif in_ctx_id == 'LOGO'

tools/dev/msftidy.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ def check_ref_identifiers
270270
warn("Invalid WPVDB reference") if value !~ /^\d+$/ and value !~ /^[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}?$/
271271
when 'PACKETSTORM'
272272
warn("Invalid PACKETSTORM reference") if value !~ /^\d+$/
273+
when 'GHSA'
274+
# Allow both formats: with or without GHSA- prefix
275+
# Format: GHSA-xxxx-xxxx-xxxx or xxxx-xxxx-xxxx (where xxxx is 4 alphanumeric chars)
276+
ghsa_pattern = /^(?:GHSA-)?[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}$/i
277+
warn("Invalid GHSA reference") if value !~ ghsa_pattern
273278
when 'URL'
274279
if value =~ /^https?:\/\/cvedetails\.com\/cve/
275280
warn("Please use 'CVE' for '#{value}'")
@@ -289,6 +294,8 @@ def check_ref_identifiers
289294
warn("Please use 'WPVDB' for '#{value}'")
290295
elsif value =~ /^https?:\/\/(?:[^\.]+\.)?packetstormsecurity\.(?:com|net|org)\//
291296
warn("Please use 'PACKETSTORM' for '#{value}'")
297+
elsif value =~ /^https?:\/\/github\.com\/(?:advisories|[\w\-]+\/[\w\-]+\/security\/advisories)\/GHSA-/
298+
warn("Please use 'GHSA' for '#{value}'")
292299
end
293300
when 'AKA'
294301
warn("Please include AKA values in the 'notes' section, rather than in 'references'.")

tools/modules/module_missing_reference.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def types
2424
'ZDI',
2525
'WPVDB',
2626
'PACKETSTORM',
27+
'GHSA',
2728
'URL'
2829
]
2930
end

tools/modules/module_reference.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def types
3434
'ZDI' => 'http://www.zerodayinitiative.com/advisories/ZDI-#{in_ctx_val}',
3535
'WPVDB' => 'https://wpscan.com/vulnerability/#{in_ctx_val}',
3636
'PACKETSTORM' => 'https://packetstormsecurity.com/files/#{in_ctx_val}',
37+
'GHSA' => 'https://github.com/advisories/#{in_ctx_val}',
3738
'URL' => '#{in_ctx_val}'
3839
}
3940
end

0 commit comments

Comments
 (0)