top | item 30557256

Heap memory corruption in GitHub's Markdown table parsing extension

83 points| hyfen | 4 years ago |github.com | reply

42 comments

order
[+] esprehn|4 years ago|reply
This seems like a good opportunity to use wasm on the server to sandbox the processing of user provided content. Of course they could also try rewriting in a safer language, but given that this already exists and handles all their content, wasm might be a simple defense in depth protection.
[+] staticassertion|4 years ago|reply
What Dropbox did for this sort of thing is ideal. You spawn a child process that has two file handles piped to/from the parent - stdin, stdout.

That child process does the scary stuff - parsing. Parsing requires zero system calls. Reading to/from the parent requires only read and write, but not open, so they can only read and write to those file descriptors.

And exit.

That's it. Seccomp v1 is trivial to apply, gives 4 system calls, and makes the process virtually useless to an attacker. If you want to get fancy and allow for multithreading you can use seccomp v2 and create your threadpool before you drop privs, and probably add futex and memmap.

You pay a latency cost but the security win is huge.

[+] pjmlp|4 years ago|reply
WASM doesn't protect against heap corruption, because bounds checking doesn't apply inside a linear memory segment.
[+] pjmlp|4 years ago|reply
Another integer overflow bites the dust.
[+] tines|4 years ago|reply
I am a C++ fanatic---template metaprogramming is a beautiful thing---but I've come to believe that software that handles untrusted user input should never be written in C or C++. It's too difficult to write correct software by hand, memory safe languages are really the only way.
[+] bob1029|4 years ago|reply
Does there actually exist any practical way to ensure user input does not cause mischief when authoring C/C++ programs at scale? Are memory-safe languages the only answer?
[+] endorphine|4 years ago|reply
Is this a vulnerability that would be impossible kn6, let's say, Rust?