Unauthenticated Remote Code Execution (RCE) vulnerability in Hikvision IP camera/NVR firmware (CVE-2021-36260)

bashis

IPCT Contributor
Joined
May 27, 2017
Messages
87
Reaction score
118
Your "P" user is deleted on my cam after a system reboot so does not really matter about having multiple entries in the password file. The cam also seems to handle the duplicate entries ok.
Thx for info, same with mine, but you know 'aesthetic' ;)
 

SamM

Pulling my weight
Joined
Mar 29, 2020
Messages
245
Reaction score
109
Location
SA
Hi,

1. Is the DS-2CD2T25FWD-I5 with firmware version V5.5.61 build 180718 and web version V4.0.1 build 180626 vulnerable? I have tried the above by @bashis but results are:
[*] Hikvision CVE-2021-36260
[*] PoC by bashis <mcw noemail eu> (2021)
[*] Checking remote "10.0.0.245:80"
ETag: "ab2-1e0-5b441478"
[-] Could not verify if vulnerable (Code: 500)


2. What are the error codes that are presented in the parenthesis?
 

SamM

Pulling my weight
Joined
Mar 29, 2020
Messages
245
Reaction score
109
Location
SA
@alastairstevenson Thank you. I have got exploitable results from the others but not from "check". Was a bit confused about the error being an internal server error.

Interesting how Hikvision excludes this model from its CVE list 2CD2X25 is excluded.
 

montecarlo

n3wb
Joined
Dec 11, 2021
Messages
3
Reaction score
0
Location
internet
Wonderful amazing works when I read your blog watchful_ip!
Thank you very much for sharing this.

I have one question:
In your original advisory you mentioned about
"Disable web authentication and login to target camera admin web pages with any password."
Can you please explain how one can do this?

I thought you can only add new user root on /etc/passwd but it does not reflect immediately by the camera.
I have been trying to open my camera for public but in the end I just add new user with password with viewer role..

Thanks
 

rearanger

Getting the hang of it
Joined
Feb 10, 2016
Messages
224
Reaction score
96
Location
Scottish Borders
Wonderful amazing works when I read your blog watchful_ip!
Thank you very much for sharing this.



I have one question:
In your original advisory you mentioned about
"Disable web authentication and login to target camera admin web pages with any password."
Can you please explain how one can do this?

I thought you can only add new user root on /etc/passwd but it does not reflect immediately by the camera.
I have been trying to open my camera for public but in the end I just add new user with password with viewer role..

Thanks
There are many ways.

you could edit the user file, you can actually have multiple admins in the user file.(there is a database containing web gui users/admin info)
 

montecarlo

n3wb
Joined
Dec 11, 2021
Messages
3
Reaction score
0
Location
internet
There are many ways.

you could edit the user file, you can actually have multiple admins in the user file.(there is a database containing web gui users/admin info)
I tried to modify /devinfo/ipc_db and /devinfo/ipc_db_backup files by adding new admins users but even after reboot password is wrong.
can you point me where is the user file? (database containing web gui users/admin info)

my camera is DS-2CD2120F firmware V5.4.3 build 160729.

Thanks
 

iTuneDVR

Pulling my weight
Joined
Aug 23, 2014
Messages
846
Reaction score
153
Location
Россия
I tried to modify /devinfo/ipc_db and /devinfo/ipc_db_backup files by adding new admins users but even after reboot password is wrong.
can you point me where is the user file? (database containing web gui users/admin info)

my camera is DS-2CD2120F firmware V5.4.3 build 160729.

Thanks
Send me you ipc_db file
In old version it possible decrypt password from database
 

rearanger

Getting the hang of it
Joined
Feb 10, 2016
Messages
224
Reaction score
96
Location
Scottish Borders
I tried to modify /devinfo/ipc_db and /devinfo/ipc_db_backup files by adding new admins users but even after reboot password is wrong.
can you point me where is the user file? (database containing web gui users/admin info)

my camera is DS-2CD2120F firmware V5.4.3 build 160729.

Thanks
i Pm'd regarding having 2 admins. Also there are security issues in the web gui. You can get it to alter the ipc_db in ways that it should not allow. (i only stressed tested it to see if it would allow root access.)

Certain functions and restriction regarding users can be overridden from the web interface.(tests were done on a G3 with newest firmware previous to CVE vulnerability fix)
 
Last edited:

trempa92

Pulling my weight
Joined
Mar 26, 2020
Messages
724
Reaction score
221
Location
Croatia,Zagreb
how do you add user?

I cant use commands such as adduser or vi to edit files. Anyone got workaround?
 

trempa92

Pulling my weight
Joined
Mar 26, 2020
Messages
724
Reaction score
221
Location
Croatia,Zagreb
ah couldn't manage to add user to login, but managed to reset to inactive so i can add new user
 

montecarlo

n3wb
Joined
Dec 11, 2021
Messages
3
Reaction score
0
Location
internet
ah couldn't manage to add user to login, but managed to reset to inactive so i can add new user
when reset to inactive then your camera become offline.
I did it accidentally when I deleted both ipc_db and ipc_db_backup files. I guess davinci recreate both files automatically.

Did you figure out how to add users without Web?
I have access to ssh as root but couldn't figure out how to modify the db files to add new users.
 

trempa92

Pulling my weight
Joined
Mar 26, 2020
Messages
724
Reaction score
221
Location
Croatia,Zagreb
when reset to inactive then your camera become offline.
I did it accidentally when I deleted both ipc_db and ipc_db_backup files. I guess davinci recreate both files automatically.

Did you figure out how to add users without Web?
I have access to ssh as root but couldn't figure out how to modify the db files to add new users.
I was testing on 3x G2 cameras and succesfully ran script in cd bin called paramReset. It put my cameras in inactibvate state and let me add new password. This way i am not adding any new user, i am resetting camera.
 

trempa92

Pulling my weight
Joined
Mar 26, 2020
Messages
724
Reaction score
221
Location
Croatia,Zagreb
install fully loaded busybox.

or cat > /etc/passwd

(add a script to make permanent if its for root)
Can u send me full busybox in PM? Id be greatfull

cat passwd gives HASH which is meaningless to me. If Im correct there is no reversing but just comparing the results with brute force
 

rearanger

Getting the hang of it
Joined
Feb 10, 2016
Messages
224
Reaction score
96
Location
Scottish Borders
Can u send me full busybox in PM? Id be greatfull

cat passwd gives HASH which is meaningless to me. If Im correct there is no reversing but just comparing the results with brute force
G3 family busybox Fully loaded

 

skjom

Young grasshopper
Joined
Jul 3, 2015
Messages
88
Reaction score
4
Do you know if they are OEMd R0 series Hikvision cubes?
If so - there is a mysterious firmware update here, in the same version and build date format as the vulnerable devices in other series :

@bashis PoC comes up with this for a DS-2CD2432-IW on that same version of firmware :
Code:
alastair@PC-I5 ~/coding_stuff/bashis_disclosures $ ./Hikvision_CVE-2021-36260_RCE_POC.py --rhost 192.168.1.105  --check
[*] Hikvision CVE-2021-36260
[*] PoC by bashis <mcw noemail eu> (2021)
[*] Checking remote "192.168.1.105:80"
[i] ETag: "8f6-1e0-587ec5e1"
[-] Could not verify if vulnerable (Code: 500)
alastair@PC-I5 ~/coding_stuff/bashis_disclosures $ ./Hikvision_CVE-2021-36260_RCE_POC.py --rhost 192.168.1.105  --reboot
[*] Hikvision CVE-2021-36260
[*] PoC by bashis <mcw noemail eu> (2021)
[*] Checking remote "192.168.1.105:80" with "reboot"
[+] Remote is not vulnerable
alastair@PC-I5 ~/coding_stuff/bashis_disclosures $
How would I tell if they were OEMd R0?
 
Top