Writing a dynamic x86_64 assembler in Scala
github.com
github.com
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.
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 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?"
To be fair to your point, however, by not constantly practicing secure coding techniques, regardless of context, I could get out of the habit of secure coding as a default. I may simply not think about it at a time when I should be. By always considering, even in my bullshit toy project, I stick to my good practices and more consistently apply them when it counts. But the argument that security coding can be interesting and fun is not a good enough argument to care about it all the time.
Obviously, security is always a tradeoff. I'm not suggesting you implement 2 factor authentication for your wedding invite website. But it does always help to consider: 1. How can this code break, if someone accidentally misuses it? 2. How can this code break, if someones intentionally misuses it?
Very often, thinking about #2 can help resolve a lot of things overlooked in #1.
Also building code, fire code, ADA accessibility requirements and permits and sign off.
Could you please show me a person who'd like being the subject of remote code execution?
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.