Skip to content

Commit 6a77c2e

Browse files
committed
Final tweaks in check method
1 parent 0e3471d commit 6a77c2e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

modules/exploits/linux/http/netis_unauth_rce_cve_2024_22729.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,15 @@ def check
112112
# trying to get the model and version number
113113
# unfortunately JSON parsing fails, so we need to use this ugly REGEX :-(
114114
version = res.body.match(/.?(version).?\s*:\s*.?((\\|[^,])*)/)
115+
# when found, remove whitespaces and make all uppercase to avoid suprises in string splitting and comparison
115116
unless version.nil?
116-
version_number = version[2].split('-V')[1].chop
117-
model_number = version[2].split('-V')[0][/\(([^(]+)/, 1].chop
117+
version_number = version[2].upcase.split('-V')[1].gsub(/[[:space:]]/, '').chop
118+
# The model number part is usually something like Netis(NC63), but occassionally you see things like Stonet-N3D
119+
if version[2].upcase.split('-V')[0].include?('-')
120+
model_number = version[2].upcase.split('-V')[0][/-([^-]+)/, 1].gsub(/[[:space:]]/, '')
121+
else
122+
model_number = version[2].upcase.split('-V')[0][/\(([^)]+)/, 1].gsub(/[[:space:]]/, '')
123+
end
118124
# Check if target is model MW5360 and running firmware 1.0.1.3442 (newest release 2024-04-24) or lower
119125
if version_number && model_number == 'MW5360' && (Rex::Version.new(version_number) <= Rex::Version.new('1.0.1.3442'))
120126
return CheckCode::Appears(version[2].chop.to_s)

0 commit comments

Comments
 (0)