Re:Show HN: Online C/C++ to assembly visualizer [Weekend Pro...
by __alexs on Sunday September 23, 2012 @06:28AM
(#4560550)
chroot would probably be sufficient. Barring some sort of code execution vuln in the compiler you can only load stuff off of the filesystem.
Having the actual CPP available is nice because some bits of libc are only macros.
Re:Show HN: Online C/C++ to assembly visualizer [Weekend Pro...
by ynh on Sunday September 23, 2012 @06:45AM
(#4560573)
I have now added some basic macro detection
Re:Show HN: Online C/C++ to assembly visualizer [Weekend Pro...
by yonilevy on Sunday September 23, 2012 @07:12AM
(#4560611)
#define x "/etc/passwd"
#include x
Re:Show HN: Online C/C++ to assembly visualizer [Weekend Pro...
by ynh on Sunday September 23, 2012 @07:27AM
(#4560643)
I have now fixed it. But I think there must be an other way to make it safe. Maybe a sandbox
Re:Show HN: Online C/C++ to assembly visualizer [Weekend Pro...
by dzorz on Sunday September 23, 2012 @08:37AM
(#4560759)
This is part of your /etc/shadow file:
root:censored
We can still read /etc/ssh/ssh_host_rsa_key, etc.Edit: removed hash, sorry
Re:Show HN: Online C/C++ to assembly visualizer [Weekend Pro...
by daeken on Sunday September 23, 2012 @08:46AM
(#4560774)
Saying "you can read /etc/shadow by doing X, Y, and Z" is okay -- it's a permanent record there was a flaw. Saying "here's your root password hash" is not ok; even once the flaw is fixed, that hash is still floating around out there. I'd take advantage of the edit period and remove that from your comment; it's just not cool. The OP should definitely change the root password on the box regardless.
Re:Show HN: Online C/C++ to assembly visualizer [Weekend Pro...
by wulczer on Sunday September 23, 2012 @10:48AM
(#4561053)
Well one easy way to increase security would for this to stop running as root.
Please, don't ever run your application code as root. Less so when it's facing the Internet.
Re:Show HN: Online C/C++ to assembly visualizer [Weekend Pro...
by ynh on Sunday September 23, 2012 @08:58AM
(#4560806)
No problem I think I could fix it.
Can you show us how you read the content of the file. Just want to learn more
Re:Show HN: Online C/C++ to assembly visualizer [Weekend Pro...
by espes on Sunday September 23, 2012 @08:26AM
(#4560737)
If it's a server used for other things, definitely a sandbox. gcc's not exactly security hardend.
Best one (novel solution, though the code's old and shit) I've come across: https://pts-mini-gpl.googlecode.com/svn/trunk/uevalrun/doc/u...
Re:Show HN: Online C/C++ to assembly visualizer [Weekend Pro...
by ynh on Sunday September 23, 2012 @08:56AM
(#4560800)
I have now used a the wrapper by gcc-explorer https://github.com/mattgodbolt/gcc-explorer/blob/master/c-pr...
- doing an include #include "/dev/random" will block the thread. - including "/etc/passwd" is also possible although I don't see a direct way to turn this into password disclosure.
Seriously; even if it's a weekend project, letting people run all kinds of potentially bad code on your machine is never a good idea. Even though you don't run the binaries yourself there's so many ways to mess around with a compiler. You just don't know what's going to happen.