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

arbitrary code execution when formating json #63

Open
hundan2020 opened this issue Jun 26, 2019 · 5 comments
Open

arbitrary code execution when formating json #63

hundan2020 opened this issue Jun 26, 2019 · 5 comments

Comments

@hundan2020
Copy link

poc:

(function(){confirm(1)})()

image

image

when the web with single js content, it may result code execution. (it shouldn't be executed when broswe a single js file without any html tag).

I discovered the insecure code in https://github.com/zxlie/FeHelper/blob/master/apps/json-format/automatic.js , line 199 to line 206

additionally, I understand the code is compatibilized for bad json content like {a:1}, but as a result, it's insecure.

@zxlie
Copy link
Owner

zxlie commented Jun 26, 2019

非常感谢你的反馈!不过,这个工具是用来进行JSON格式化的,如果本身就不是一个JSON,再好的工具其实也没法格式化出来。如果工具需要升级的话,也是在格式化之前,做一个JSON合法性校验。

@hundan2020
Copy link
Author

i got your point, and there is some supplementary explanation

the first poc i sent was executed manually, in fact, i mean, the code will execute automaticly , look at this new poc

{
    "a":(function(){
        confirm(1)
    })()
}

now i open the chrome extension, you can see the source code, and the code was executed.

image

@zxlie
Copy link
Owner

zxlie commented Jun 26, 2019

Got ~ 我做个兼容吧

@zxlie
Copy link
Owner

zxlie commented Jun 26, 2019

Btw:这种情况,应该用这个工具更加合适:https://www.baidufe.com/fehelper/codebeautify.html

@OS-WS
Copy link

OS-WS commented Jan 3, 2021

Hi, is there a fix for CVE-2019-12966?
If so, in what commit?

thanks in advance!

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

3 participants