Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp433697lqh; Tue, 7 May 2024 03:55:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUsp3m65UaoBswBdb602uK2E2ZtA4QIwiQUtyLS6tLcvU0Jlfw9hZmK3uQuEUCpF3p/rPiJ50Sl+wv4nPkAlpxJurYYVzxkyEazrD0f5Q== X-Google-Smtp-Source: AGHT+IHRJZGQyaqV0GDCw/KI29fQ34iUbPRV/M8y6BmLOazrtxgtrWYLqzAT6OB5fCp0dexSX9MJ X-Received: by 2002:a05:622a:2994:b0:43a:b1e4:245 with SMTP id hd20-20020a05622a299400b0043ab1e40245mr15782547qtb.17.1715079316207; Tue, 07 May 2024 03:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715079316; cv=none; d=google.com; s=arc-20160816; b=i9b2jvUNKpvGetl5pkCP2tdLhxNuHMA+OwRx0exi3QbHH0pBDQIMzU6YD/35cWKgTm 9kBMslAuTL5elf/6efiaVvUTR2iKqcpQJ/Cke6B/TTngrCai8DvhW1zl6dFOU+DDZ5f0 DiC/3gXvOyfi9ZFIMu1+N5z+FD9I4l1MJSAoFrMMD4iBjF3hiObSc2M4FKRngMVFlGH5 tWk+l5qnQU1fA9GUpIWAvan3wYuH2R2mcb+95fE6i+lldLzQsVtpaZ7+7ZbPnhSmARRw y6ArDram6dRTAFpRcprW/G2D97tdK91fVNJ8J9ulSB+ICLy1AGK12DfF17AU7C2JL+Qo nXRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:to:message-id:date:from:mime-version:delivered-to :delivered-to:reply-to:list-id:list-subscribe:list-unsubscribe :list-help:list-post:precedence:mailing-list; bh=q9KiTdMCfZ19PopuXMV+DzNsfs8UD7LqNc9qm9Ua1qM=; fh=jBHMvxdyHmiUH6s7CYd9l+p8TNc30s2CM8CRnywmnPw=; b=b27b6FekYPhYskuVTJs7znZtUNEe9OCjx1155HP5MHTbq9es0WbOmnu4TCvKwXeFaD DjdV/yd9Y5ZRBTc6Hbe1fthLbukVyFDI2WjkQP0u7S/kvj4MG/ZfafpPkf6sAFq5SAUj 5gXYV1y/LE4dq4Z5CsvRwBXbA+wbxvjkkvG0KwTHzMqdYYKa9J9O6TDq96nRfGxeQuQP 8G5s5Ueci+56bIsT+j1P2S9CL99C46CCM4gL6OT/tomqyFkDowhXt4YOaRWqYH7/J/JU RhLPJvvT3vIvZ4mvf5fq6K+4GrE8uNStdz2OmKqaQMmQoD3L74Otm2V9R2zHScapoD5l adUQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of oss-security-return-30126-linux.lists.archive=gmail.com@lists.openwall.com designates 193.110.157.125 as permitted sender) smtp.mailfrom="oss-security-return-30126-linux.lists.archive=gmail.com@lists.openwall.com"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=0xdeadbeef.info Return-Path: Received: from second.openwall.net (second.openwall.net. [193.110.157.125]) by mx.google.com with SMTP id b15-20020a05622a020f00b0043709c6ab8fsi8757129qtx.535.2024.05.07.03.55.15 for ; Tue, 07 May 2024 03:55:16 -0700 (PDT) Received-SPF: pass (google.com: domain of oss-security-return-30126-linux.lists.archive=gmail.com@lists.openwall.com designates 193.110.157.125 as permitted sender) client-ip=193.110.157.125; Authentication-Results: mx.google.com; spf=pass (google.com: domain of oss-security-return-30126-linux.lists.archive=gmail.com@lists.openwall.com designates 193.110.157.125 as permitted sender) smtp.mailfrom="oss-security-return-30126-linux.lists.archive=gmail.com@lists.openwall.com"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=0xdeadbeef.info Received: (qmail 30245 invoked by uid 550); 7 May 2024 10:49:55 -0000 Mailing-List: contact oss-security-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: oss-security@lists.openwall.com Delivered-To: mailing list oss-security@lists.openwall.com Delivered-To: moderator for oss-security@lists.openwall.com Received: (qmail 8134 invoked from network); 7 May 2024 08:57:38 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715072249; x=1715677049; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=q9KiTdMCfZ19PopuXMV+DzNsfs8UD7LqNc9qm9Ua1qM=; b=n4uKwyczTLA5eGhDtEIIK/NyYSUHSHZ5XEIsfDw6wU8Grx89+BmMurNcgCuXHmapzd JRHI3/cyi/hiUP7oyPFMjlFUaPcQltuijoewtcW3S4PF0lv4uoizAzIw4j8xwFg4nz95 MSmGDFIyo/wLc++PztoxqnVt9hljzYlHmp9K3/iha/KhcSIIA8Kzi6IkvUUOg7nbMmdV d7raydbPmE8tkS7gPxIOsSCR4IJvIQvVeMeerQDnLTeBi0DqvWyFkr9Kp5RYtUP2w5vz GCr0mz6p0pFe+9xierIexBMbuWJevtu+yv3CHFWhJPHI4s3hA67Bfexgzn4Z3VQUd3yl PbYQ== X-Forwarded-Encrypted: i=1; AJvYcCWTnSiTsr4GL3dk/DfBhWEvtOGYmQ4zJoecKjhpyVlMQrr+byGJaC0ROQ0LWWCA/45KR0FwrmTl020Y+eVc9ijQuoJGrsdMA1j1kaJAKHjj X-Gm-Message-State: AOJu0YyfTQbsd/BRvTQ1Q0BB/oKCv0MJTCWrNvpvfI6EMEE2hKUD1ocF NOuTZaltXQHx9vjRMX5epQlqR7EwHR/aQITX62JJhCSRWkJeRLcHRWwrfVJH X-Received: by 2002:a05:6830:120c:b0:6eb:7b6f:150d with SMTP id r12-20020a056830120c00b006eb7b6f150dmr13604177otp.8.1715072248842; Tue, 07 May 2024 01:57:28 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCU5NAPUazsuAWvqRkpA/2uxNoXbKaoIgRiyMWqQzuaCSq8PhFnXU3EXzsJumXltD1bwKf94qIqJdj5ByBEMSg8AtpRSZt2CBCHiZ5HDISTm X-Received: by 2002:a05:6870:2195:b0:23b:d7ce:476b with SMTP id l21-20020a056870219500b0023bd7ce476bmr14073318oae.8.1715072248454; Tue, 07 May 2024 01:57:28 -0700 (PDT) MIME-Version: 1.0 From: Marco Ivaldi Date: Tue, 7 May 2024 10:57:02 +0200 X-Gmail-Original-Message-ID: Message-ID: To: fulldisclosure@seclists.org, oss-security@lists.openwall.com, submissions@packetstormsecurity.com Content-Type: multipart/mixed; boundary="0000000000002245d20617d960ae" Subject: [oss-security] HNS-2024-07 - HN Security Advisory - Multiple vulnerabilities in RIOT OS --0000000000002245d20617d960ae Content-Type: text/plain; charset="UTF-8" Hi, Please find attached a security advisory that describes multiple vulnerabilities we discovered in RIOT OS. * Title: Multiple vulnerabilities in RIOT OS * OS: RIOT <= 2024.01 * Author: Marco Ivaldi * Date: 2024-05-07 * CVE ID and severity: * CVE-2024-31225 - High * CVE-2024-32017 - Critical * CVE-2024-32018 - High (low-severity vulnerabilities were not assigned a CVE ID) * Vendor URL: https://www.riot-os.org/ * Advisory URLs: * https://github.com/RIOT-OS/RIOT/security/advisories/GHSA-2572-7q7c-3965 * https://github.com/RIOT-OS/RIOT/security/advisories/GHSA-v97j-w9m6-c4h3 * https://github.com/RIOT-OS/RIOT/security/advisories/GHSA-899m-q6pp-hmp3 * https://github.com/RIOT-OS/RIOT/security/advisories/GHSA-x3j5-hfrr-5x6q * https://github.com/RIOT-OS/RIOT/security/advisories/GHSA-pw2r-pp35-xfmj * https://github.com/RIOT-OS/RIOT/security/advisories/GHSA-c4p4-vv7v-3hx8 * https://github.com/RIOT-OS/RIOT/security/advisories/GHSA-r87w-9vw9-f7cx * https://github.com/RIOT-OS/RIOT/security/advisories/GHSA-2hx7-c324-3rxv * https://github.com/RIOT-OS/RIOT/security/advisories/GHSA-frp5-4gfp-84j3 * https://github.com/RIOT-OS/RIOT/security/advisories/GHSA-x27v-gqp4-7jq3 The advisory is also available at: https://github.com/hnsecurity/vulns/blob/main/HNS-2024-07-riot.txt For additional information, please refer to our vulnerability writeup: https://security.humanativaspa.it/multiple-vulnerabilities-in-riot-os/ Regards, -- Marco Ivaldi https://0xdeadbeef.info/ "When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl." --0000000000002245d20617d960ae Content-Type: text/plain; charset="US-ASCII"; name="HNS-2024-07-riot.txt" Content-Disposition: attachment; filename="HNS-2024-07-riot.txt" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lvw5lr330 LS1bIEhOUy0yMDI0LTA3IC0gSE4gU2VjdXJpdHkgQWR2aXNvcnkgLSBodHRwczovL3NlY3VyaXR5 Lmh1bWFuYXRpdmFzcGEuaXQvCgoqIFRpdGxlOiBNdWx0aXBsZSB2dWxuZXJhYmlsaXRpZXMgaW4g UklPVCBPUwoqIE9TOiBSSU9UIDw9IDIwMjQuMDEKKiBBdXRob3I6IE1hcmNvIEl2YWxkaSA8bWFy Y28uaXZhbGRpQGhuc2VjdXJpdHkuaXQ+CiogRGF0ZTogMjAyNC0wNS0wNwoqIENWRSBJRCBhbmQg c2V2ZXJpdHk6CiAgKiBDVkUtMjAyNC0zMTIyNSAtIEhpZ2gKICAqIENWRS0yMDI0LTMyMDE3IC0g Q3JpdGljYWwKICAqIENWRS0yMDI0LTMyMDE4IC0gSGlnaAogIChsb3ctc2V2ZXJpdHkgdnVsbmVy YWJpbGl0aWVzIHdlcmUgbm90IGFzc2lnbmVkIGEgQ1ZFIElEKQoqIFZlbmRvciBVUkw6IGh0dHBz Oi8vd3d3LnJpb3Qtb3Mub3JnLwoqIEFkdmlzb3J5IFVSTHM6IAogICogaHR0cHM6Ly9naXRodWIu Y29tL1JJT1QtT1MvUklPVC9zZWN1cml0eS9hZHZpc29yaWVzL0dIU0EtMjU3Mi03cTdjLTM5NjUK ICAqIGh0dHBzOi8vZ2l0aHViLmNvbS9SSU9ULU9TL1JJT1Qvc2VjdXJpdHkvYWR2aXNvcmllcy9H SFNBLXY5N2otdzltNi1jNGgzCiAgKiBodHRwczovL2dpdGh1Yi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Y3Rpb24gaW4gdGhlIHNhbWUgZmls ZSBkb2VzIGltcGxlbWVudCBzdWNoIGFuCmV4cGxpY2l0IHNpemUgY2hlY2s6CmBgYGMKc3RhdGlj IHZvaWQgX29uX2xvb2t1cChjb25zdCBnY29hcF9yZXF1ZXN0X21lbW9fdCAqbWVtbywgY29hcF9w a3RfdCAqcGR1LAogICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNvY2tfdWRwX2VwX3QgKnJl bW90ZSkKewogICAgKHZvaWQpcmVtb3RlOwoKICAgIHRocmVhZF9mbGFnc190IGZsYWcgPSBGTEFH X0VSUjsKCiAgICBpZiAobWVtby0+c3RhdGUgPT0gR0NPQVBfTUVNT19SRVNQKSB7CiAgICAgICAg dW5zaWduZWQgY3QgPSBjb2FwX2dldF9jb250ZW50X3R5cGUocGR1KTsKICAgICAgICBpZiAoY3Qg IT0gQ09BUF9GT1JNQVRfTElOSykgewogICAgICAgICAgICBERUJVRygiY29yZF9sYzogdW5zdXBw b3J0ZWQgY29udGVudCBmb3JtYXQ6ICV1XG4iLCBjdCk7CiAgICAgICAgICAgIHRocmVhZF9mbGFn c19zZXQoX3dhaXRlciwgZmxhZyk7CiAgICAgICAgfQogICAgICAgIGlmIChwZHUtPnBheWxvYWRf bGVuID09IDApIHsKICAgICAgICAgICAgZmxhZyA9IEZMQUdfTk9SU0M7CiAgICAgICAgICAgIHRo cmVhZF9mbGFnc19zZXQoX3dhaXRlciwgZmxhZyk7CiAgICAgICAgfQogICAgICAgIGlmIChwZHUt PnBheWxvYWRfbGVuID49IF9yZXN1bHRfYnVmX2xlbikgeyAvLyBDSEVDSwogICAgICAgICAgICBm bGFnID0gRkxBR19PVkVSRkxPVzsKICAgICAgICAgICAgdGhyZWFkX2ZsYWdzX3NldChfd2FpdGVy LCBmbGFnKTsKICAgICAgICB9CiAgICAgICAgbWVtY3B5KF9yZXN1bHRfYnVmLCBwZHUtPnBheWxv YWQsIHBkdS0+cGF5bG9hZF9sZW4pOwogICAgIC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M7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAg ICAgICAgICBzdHJjcHkocHJveHksIF9wcm94eSk7IC8vIFZVTE46IHBvdGVudGlhbCBidWZmZXIg b3ZlcmZsb3cKICAgICAgICB9CiAgICB9CiAgICBtdXRleF91bmxvY2soJl9jbGllbnRfbXV0ZXgp OwogICAgcmV0dXJuIHJlczsKfQpgYGAKClRoZSBgX2djb2FwX2ZvcndhcmRfcHJveHlfY29weV9v cHRpb25zKClgIGZ1bmN0aW9uIGRvZXMgbm90IGltcGxlbWVudCBhbgpleHBsaWNpdCBzaXplIGNo ZWNrIGJlZm9yZSBjb3B5aW5nIGRhdGEgdG8gdGhlIGBjZXAtPnJlcV9ldGFnYCBidWZmZXIgdGhh dCBpcwpgQ09BUF9FVEFHX0xFTkdUSF9NQVhgIGJ5dGVzIGxvbmcuIElmIGFuIGF0dGFja2VyIGNh biBjcmFmdCBpbnB1dCBzbyB0aGF0Cm9wdGxlbiBiZWNvbWVzIGxhcmdlciB0aGFuIGBDT0FQX0VU QUdfTEVOR1RIX01BWGAsIHRoZXkgY2FuIGNhdXNlIGEgYnVmZmVyCm92ZXJmbG93LgoKU2VlIHRo ZSBtYXJrZWQgbGluZSBiZWxvdzoKYGBgYwpzdGF0aWMgaW50IF9nY29hcF9mb3J3YXJkX3Byb3h5 X2NvcHlfb3B0aW9ucyhjb2FwX3BrdF90ICpwa3QsCiAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIGNvYXBfcGt0X3QgKmNsaWVudF9wa3QsCiAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudF9lcF90ICpjZXAsCiAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVyaV9wYXJzZXJfcmVzdWx0X3Qg KnVyaXApCnsKICAgIC8qIGNvcHkgYWxsIG9wdGlvbnMgZnJvbSBjbGllbnRfcGt0IHRvIHBrdCAq LwogICAg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V4dCk7CiAgICB3YWl0b25pZCA9IGlkX25leHQrKzsKICAgIG1lbWNweSgmdGJ1 Zls1XSwgc3ViLT50b3BpYy5uYW1lLCBzdHJsZW4oc3ViLT50b3BpYy5uYW1lKSk7IC8vIFZVTE46 IGxhY2sgb2Ygc2l6ZSBjaGVjayBhbmQgcG90ZW50aWFsIGJ1ZmZlciBvdmVyZmxvdwoKICAgIGlu dCByZXMgPSBzeW5jc2VuZChVTlNVQkFDSywgKHNpemVfdCl0YnVmWzBdLCBmYWxzZSk7CiAgICBp ZiAocmVzID09IEVNQ1VURV9PSykgewogICAgICAgIGlmIChzdWJzID09IHN1YikgewogICAgICAg ICAgICBzdWJzID0gc3ViLT5uZXh0OwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAg ICAgZW1jdXRlX3N1Yl90ICpzOwogICAgICAgICAgICBmb3IgKHMgPSBzdWJzOyBzOyBzID0gcy0+ bmV4dCkgewogICAgICAgICAgICAgICAgaWYgKHMtPm5leHQgPT0gc3ViKSB7CiAgICAgICAgICAg ICAgICAgICAgcy0+bmV4dCA9IHN1Yi0+bmV4dDsKICAgICAgICAgICAgICAgICAgICBicmVhazsK ICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICBtdXRl eF91bmxvY2soJnR4bG9jayk7CiAgICByZXR1cm4gcmVzOwp9CmBgYAoKSWYgdGhlIHVuY2hlY2tl ZCBpbnB1dCBhYm92ZSBpcyBhdHRhY2tlci1jb250cm9sbGVkIGFuZCBjcm9zc2VzIGEgc2VjdXJp dHkKYm91bmRhcnksIHRoZSBpbXBhY3Qgb2YgdGhlIGJ1ZmZlciBvdmVyZmxvdyB2dWxuZXJhYmls aXRpZXMgY291bGQgcmFuZ2UgZnJvbQpkZW5pYWwgb2Ygc2VydmljZSB0byBhcmJpdHJhcnkgY29k ZSBleGVjdXRpb24uCgpUaGVyZSBpcyBjdXJyZW50bHkgbm8gZml4IGZvciB0aGVzZS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