Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return of Stack Address Vulnerability (CWE-562) in lj_cconv_ct_ct and cdata_setptr Functions #548

Open
awusan125 opened this issue Nov 15, 2024 · 0 comments

Comments

@awusan125
Copy link

I have identified a potential "Return of Stack Address" issue (CWE-562) in the project, and I would like to bring it to your attention as it may pose a serious risk. This issue could lead to undefined behavior or security vulnerabilities by exposing a stack variable address. Such a bug may result in program instability, memory corruption, or potential security breaches. Could you please help me check it? Thank you for your effort and patience!

Issue Description:

The bug is located in the file third_party\luajit\tmp\luajit\src\lj_cconv.c andthird_party\luajit\tmp\luajit\src\lj_cdata.h, involving the functions cdata_setptr and lj_cconv_ct_ct. The specific code flow is as follows:

1.In the cdata_setptr function, there is a possibility for the value of v to be copied to the value pointed to by p.
2.The function lj_cconv_ct_ct calls cdata_setptr to assign the value of sp to the value pointed to by dp.
3.However, sp is a stack address and should not be assigned to the value pointed to by an input parameter pointer.
4.This results in a "Return of Stack Variable Address" vulnerability (CWE-562), as the dp pointer in the input function parameter will return this stack address.
The relevant code segments that may trigger this bug are highlighted in the attached image.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant