ID

VAR-201510-0226


CVE

CVE-2015-7392


TITLE

FreeSWITCH of libs/esl/src/esl_json.c of parse_string Heap-based buffer overflow vulnerability in functions

Trust: 0.8

sources: JVNDB: JVNDB-2015-005082

DESCRIPTION

Heap-based buffer overflow in the parse_string function in libs/esl/src/esl_json.c in FreeSWITCH before 1.4.23 and 1.6.x before 1.6.2 allows remote attackers to execute arbitrary code via a trailing \u in a json string to cJSON_Parse. FreeSWITCH is prone to a heap-based buffer-overflow vulnerability because it fails to perform adequate boundary checks on user-supplied data. A remote attacker may exploit this issue to execute arbitrary code in the context of the affected application. Failed attempts will likely cause a denial-of-service condition. Versions prior to FreeSWITCH 1.6.2 and 1.4.23 are vulnerable. FreeSWITCH is a set of free and open source communication software developed by American software developer Anthony Minesale. The software can be used to create audio, video and short message products and applications. There is a heap-based buffer overflow vulnerability in the 'parse_string' function in the libs/esl/src/esl_json.c file of FreeSWITCH 1.4.21 and earlier versions and 1.6.0. The vulnerability stems from the fact that the cJSON_Parse structure does not sufficiently filter' json' character at the end of the string. 1. Advisory Information Title: Heap overflow in freeswitch json parser < 1.6.2 & < 1.4.23 Submitter: Marcello Duarte (marcello@cybersightgroup.com) Product: freeswitch Product URL: http://freeswitch.org Affected Versions: freeswitch < 1.6.2 & < 1.4.23 Fixed Versions: 1.6.2 , 1.4.23 Link to source code diff: https://freeswitch.org/stash/projects/FS/repos/freeswitch/commits/cf892528a1a107ed6eb67fb98ed22533e27778fd CVE Status: CVE-2015-7392 2. Vulnerability Information Impact: Code execution Remotely Exploitable: Yes Locally Exploitable: No 3. Vulnerability Description Product Information: FreeSWITCH is a scalable open source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text or any other form of media. It was created in 2006 to fill the void left by proprietary commercial solutions. FreeSWITCH also provides a stable telephony platform on which many applications can be developed using a wide range of free tools. Vulnerability: A carefully crafted json string supplied to cJSON_Parse will trigger a heap overflow with user controlled data. The underlying vulnerability occurs in the parse_string function. This confuses the code responsible for copying the string. Since it doesn't detect the NULL in this situation, it will keep copying until it hits a null in memory. This leads to a heap overflow with user controlled data. Any modules or core code which allows user supplied json to enter the json parser will be vulnerable. Vulnerable Source Code: static const char *parse_string(cJSON *item, const char *str) { ... /* HACKLOG The length of string is determined here, it will stop counting when it hits a null */ while (*ptr != '\"' && *ptr && ++len) if (*ptr++ == '\\') ptr++; /* Skip escaped quotes. */ /* HACKLOG The buffer is alloced with the length obtained from the previous section */ out = (char *)cJSON_malloc( len + 1); /* This is how long we need for the string, roughly. */ if (!out) return 0; /* HACKLOG the following code will copy the string into the alloced buffer taking into account utf16 to utf8 conversion */ ptr = str + 1; ptr2 = out; /* 1 */ while (*ptr != '\"' && *ptr) { if (*ptr != '\\') *ptr2++ = *ptr++; else { ptr++; switch (*ptr) { case 'b': *ptr2++ = '\b'; break; case 'f': *ptr2++ = '\f'; break; case 'n': *ptr2++ = '\n'; break; case 'r': *ptr2++ = '\r'; break; case 't': *ptr2++ = '\t'; break; case 'u': /* transcode utf16 to utf8. */ if (sscanf(ptr + 1, "%4x", &uc) < 1) break; ptr += 4; /* get the unicode char. */ if ((uc >= 0xDC00 && uc <= 0xDFFF) || uc == 0) break; // check for invalid. if (uc >= 0xD800 && uc <= 0xDBFF) // UTF16 surrogate pairs. { if (ptr[1] != '\\' || ptr[2] != 'u') break; // missing second-half of surrogate. if (sscanf(ptr + 3, "%4x", &uc2) < 1) break; ptr += 6; if (uc2 < 0xDC00 || uc2 > 0xDFFF) break; // invalid second-half of surrogate. uc = 0x10000 | ((uc & 0x3FF) << 10) | (uc2 & 0x3FF); } len = 4; if (uc < 0x80) len = 1; else if (uc < 0x800) len = 2; else if (uc < 0x10000) len = 3; ptr2 += len; switch (len) { case 4: *--ptr2 = ((uc | 0x80) & 0xBF); uc >>= 6; case 3: *--ptr2 = ((uc | 0x80) & 0xBF); uc >>= 6; case 2: *--ptr2 = ((uc | 0x80) & 0xBF); uc >>= 6; case 1: *--ptr2 = (char)(uc | firstByteMark[len]); } ptr2 += len; break; default: *ptr2++ = *ptr; break; } /* HACKLOG INCREMENTS past null here, causing the while loop to not detect the end of the buffer so it keeps copying past the end of the alloced buffer */ ptr++; } 4. Vendor Information, Solutions Freeswitch has released versions 1.6.2 , 1.4.23 which fix the issue. 5. Credits This vulnerability was discovered and researched by Marcello Duarte ( marcello@cybersightgroup.com ) from CYBERSIGHT GROUP Vulnerability Research Labs. 6. Report Timeline 2015-09-02 - Vulnerability found 2015-09-13 - Freeswitch developers contacted 2015-09-14 - Freeswitch developers verified bug and patched in master 2015-09-25 - Freeswitch releases fixed packages. 2015-09-20 - CVE requested 2015-09-29 - CVE issued, Advisory released 7. About CYBERSIGHT GROUP CYBERSIGHT GROUP is an organization of security professionals specializing in several areas of offensive computer security research. We specialize in vulnerability research, exploit development, reverse engineering and cyber attack planning. http://cybersightgroup.com , contact@cybersightgroup.com 8. Disclaimer The information provided in the advisory is provided as is without any warranty. CYBERSIGHT GROUP and it's members are not liable in any case of damage, direct or indirect. Permission to redistribute the advisory in it's unmodified form is granted. -- Marcello Duarte Chief Research Officer CYBERSIGHT GROUP

Trust: 2.07

sources: NVD: CVE-2015-7392 // JVNDB: JVNDB-2015-005082 // BID: 76976 // VULHUB: VHN-85353 // PACKETSTORM: 133781

AFFECTED PRODUCTS

vendor:freeswitchmodel:freeswitchscope:eqversion:1.6.0

Trust: 1.6

vendor:freeswitchmodel:freeswitchscope:lteversion:1.4.21

Trust: 1.0

vendor:freeswitchmodel:freeswitchscope:eqversion:1.6.2

Trust: 0.8

vendor:freeswitchmodel:freeswitchscope:ltversion:1.6.x

Trust: 0.8

vendor:freeswitchmodel:freeswitchscope:eqversion:1.4.21

Trust: 0.6

vendor:freeswitchmodel:freeswitchscope:eqversion:1.6

Trust: 0.3

vendor:freeswitchmodel:freeswitchscope:eqversion:1.4

Trust: 0.3

vendor:freeswitchmodel:freeswitchscope:neversion:1.6.2

Trust: 0.3

vendor:freeswitchmodel:freeswitchscope:neversion:1.4.23

Trust: 0.3

sources: BID: 76976 // JVNDB: JVNDB-2015-005082 // CNNVD: CNNVD-201510-018 // NVD: CVE-2015-7392

CVSS

SEVERITY

CVSSV2

CVSSV3

nvd@nist.gov: CVE-2015-7392
value: HIGH

Trust: 1.0

NVD: CVE-2015-7392
value: HIGH

Trust: 0.8

CNNVD: CNNVD-201510-018
value: HIGH

Trust: 0.6

VULHUB: VHN-85353
value: HIGH

Trust: 0.1

nvd@nist.gov: CVE-2015-7392
severity: HIGH
baseScore: 7.5
vectorString: AV:N/AC:L/AU:N/C:P/I:P/A:P
accessVector: NETWORK
accessComplexity: LOW
authentication: NONE
confidentialityImpact: PARTIAL
integrityImpact: PARTIAL
availabilityImpact: PARTIAL
exploitabilityScore: 10.0
impactScore: 6.4
acInsufInfo: NONE
obtainAllPrivilege: NONE
obtainUserPrivilege: NONE
obtainOtherPrivilege: NONE
userInteractionRequired: NONE
version: 2.0

Trust: 1.8

VULHUB: VHN-85353
severity: HIGH
baseScore: 7.5
vectorString: AV:N/AC:L/AU:N/C:P/I:P/A:P
accessVector: NETWORK
accessComplexity: LOW
authentication: NONE
confidentialityImpact: PARTIAL
integrityImpact: PARTIAL
availabilityImpact: PARTIAL
exploitabilityScore: 10.0
impactScore: 6.4
acInsufInfo: NONE
obtainAllPrivilege: NONE
obtainUserPrivilege: NONE
obtainOtherPrivilege: NONE
userInteractionRequired: NONE
version: 2.0

Trust: 0.1

sources: VULHUB: VHN-85353 // JVNDB: JVNDB-2015-005082 // CNNVD: CNNVD-201510-018 // NVD: CVE-2015-7392

PROBLEMTYPE DATA

problemtype:CWE-119

Trust: 1.9

sources: VULHUB: VHN-85353 // JVNDB: JVNDB-2015-005082 // NVD: CVE-2015-7392

THREAT TYPE

remote

Trust: 0.6

sources: CNNVD: CNNVD-201510-018

TYPE

buffer overflow

Trust: 0.6

sources: CNNVD: CNNVD-201510-018

CONFIGURATIONS

sources: JVNDB: JVNDB-2015-005082

EXPLOIT AVAILABILITY

sources: VULHUB: VHN-85353

PATCH

title:Top Pageurl:https://freeswitch.org/

Trust: 0.8

title:FS-8160: properly handle malformed json when parsing json with \u at the end of a json stringurl:https://freeswitch.org/stash/projects/FS/repos/freeswitch/commits/cf8925

Trust: 0.8

sources: JVNDB: JVNDB-2015-005082

EXTERNAL IDS

db:NVDid:CVE-2015-7392

Trust: 2.9

db:PACKETSTORMid:133781

Trust: 1.8

db:JVNDBid:JVNDB-2015-005082

Trust: 0.8

db:CNNVDid:CNNVD-201510-018

Trust: 0.7

db:BIDid:76976

Trust: 0.4

db:VULHUBid:VHN-85353

Trust: 0.1

sources: VULHUB: VHN-85353 // BID: 76976 // JVNDB: JVNDB-2015-005082 // PACKETSTORM: 133781 // CNNVD: CNNVD-201510-018 // NVD: CVE-2015-7392

REFERENCES

url:https://freeswitch.org/stash/projects/fs/repos/freeswitch/commits/cf8925

Trust: 1.7

url:http://packetstormsecurity.com/files/133781/freeswitch-heap-overflow.html

Trust: 1.7

url:http://www.securityfocus.com/archive/1/536569/100/0/threaded

Trust: 1.1

url:http://cve.mitre.org/cgi-bin/cvename.cgi?name=cve-2015-7392

Trust: 0.8

url:http://web.nvd.nist.gov/view/vuln/detail?vulnid=cve-2015-7392

Trust: 0.8

url:http://www.securityfocus.com/archive/1/archive/1/536569/100/0/threaded

Trust: 0.6

url:https://freeswitch.org/stash/projects/fs/repos/freeswitch/commits/cf892528a1a107ed6eb67fb98ed22533e27778fd

Trust: 0.4

url:http://www.freeswitch.org/

Trust: 0.3

url:http://seclists.org/bugtraq/2015/sep/137

Trust: 0.3

url:http://freeswitch.org

Trust: 0.1

url:http://cybersightgroup.com

Trust: 0.1

url:https://nvd.nist.gov/vuln/detail/cve-2015-7392

Trust: 0.1

sources: VULHUB: VHN-85353 // BID: 76976 // JVNDB: JVNDB-2015-005082 // PACKETSTORM: 133781 // CNNVD: CNNVD-201510-018 // NVD: CVE-2015-7392

CREDITS

Marcello Duarte

Trust: 0.4

sources: BID: 76976 // PACKETSTORM: 133781

SOURCES

db:VULHUBid:VHN-85353
db:BIDid:76976
db:JVNDBid:JVNDB-2015-005082
db:PACKETSTORMid:133781
db:CNNVDid:CNNVD-201510-018
db:NVDid:CVE-2015-7392

LAST UPDATE DATE

2025-04-13T23:34:03.248000+00:00


SOURCES UPDATE DATE

db:VULHUBid:VHN-85353date:2018-10-09T00:00:00
db:BIDid:76976date:2015-09-29T00:00:00
db:JVNDBid:JVNDB-2015-005082date:2015-10-07T00:00:00
db:CNNVDid:CNNVD-201510-018date:2015-10-09T00:00:00
db:NVDid:CVE-2015-7392date:2025-04-12T10:46:40.837

SOURCES RELEASE DATE

db:VULHUBid:VHN-85353date:2015-10-05T00:00:00
db:BIDid:76976date:2015-09-29T00:00:00
db:JVNDBid:JVNDB-2015-005082date:2015-10-07T00:00:00
db:PACKETSTORMid:133781date:2015-09-30T03:03:33
db:CNNVDid:CNNVD-201510-018date:2015-10-09T00:00:00
db:NVDid:CVE-2015-7392date:2015-10-05T14:59:01.703