81 points · by guillaumebort · 10y ago · 20 comments
http://video.fosdem.org/2016/h2214/amd64-assembly-programmin...
Allowing a string in your program to be dynamically converted to assembly code, copied to executable memory and be executed is a remote code execution security hole just waiting to happen.
I'm wondering what the use cases for this were, and if they couldn't be achieved in another way.
I find it completely baffling than in 2016, people can still refer to writing secure code as "fearmongering".
Being able to dynamically inject code into your process and run it is indeed very powerful. But i'll cliche quote spiderman about great power, and insist that if you're going to execute "mprotect" or "VirtualProtect", make sure the code you're about to execute is signed and verified. Not doing so, would be user-hostile.
"Hey kid, nice treehouse, but what about burglars?"
Could you please show me a person who'd like being the subject of remote code execution?
There was no real use case for trying this. Just to see if it would be possible. As you say it is just a proof of concept.
I suggest you click on the link and read the words written on that page.
The hotspot compiler will generate the same code anyway (perhaps even more optimised if it is possible I don't know). Worse, this code would probably be inlined while the `native` version won't.