3 ms·
> Yes. > Although the insecure design of C and C++ (thanks to its C underpinnings) are just an attack vector from many possible ones, it is quite easy to get ex
by jokoon 13y ago
> Yes.
> Although the insecure design of C and C++ (thanks to its C underpinnings) are just an attack vector from many possible ones, it is quite easy to get exploited thanks to the skills of many people writing applications on those languages.
You can't have both performance AND remove the chances programmers will make mistakes. A tool is a tool with its compromises, you can't have all the advantages.
> Removing away the possibility of out of bounds errors and pointer misuse, not possible in other safer systems programming languages, already removes away many of those attacks.
Then don't use pointers, or learn how to use them properly. You should not hack into pointers anyway, there are never good reason to do so, both for risks of bugs and reduced code re-usability. STL containers make pointer use already quite almost irrelevant.
And if it's only C, not C++, I'd argue that C is quite an old system language. Security is an expensive feature, and you're free to code faster without minding security if the business you're doing allows it.
The better solution in all this, is using solutions like Cython, or make tools that allows easier bindings with C++ libraries. It doesn't change the fact that often, you'll need to optimize a part of your code, and you'll need to make a C/C++ library out of it, which you'll link against. All this process is quite not standard, and will cost time and learning, because it's quite painful. Security is often not worth the effort. Often it's much more easier to make sure users are using secure applications and securing your network and teaching users about security, than hire a security expert to review your code.
And by the way, if someone hack into your system and steal stuff, it's still a criminal act, it's not the fault of the guy who decided to use C++ because he needed speed.
- pjmlp 13y ago> You can't have both performance AND remove the chances programmers will make mistakes. A tool is a tool with its compromises, you can't have all the advantages. Ada is a possible compromise. Modula-2 used to be one as well, before C got spread outside of UNIX. > And if it's only C, not C++, I'd argue that C is quite an old system language. Security is an expensive feature, and you're free to code faster without minding security if the business you're doing allows it. Yes, it is about C. C++ security flaws are a consequence of its C compatibility. Nowadays security is a must for everything except toy programs.
- jokoon 13y agoYou won't be very productive with ada... > Nowadays security is a must for everything except toy programs. I disagree. A program can be quite secure enough if you follow simple guidelines and/or use secure libraries, and you'll save a huge amount of money not hiring someone to inspect and approve your code. It also depend how your program is designed and what it does, design plays a huge part in security. There are many ways to avoid vulnerabilities like not connecting the hardware to the internet, disable USB connectivity, compartmentalize user lands, and so on. If you're making an internet browser, an internet payment solution, a government website, of course you will try to pay a lot of money trying to reduce vectors the most you can, and try to not use C, but those project are specific and security is 90% of the work. If you're making an industrial robot, a car computer, a GPS-only device, a home thermostat, a cashier computer, it's not the programming language that will make a difference in security, it's the tools require to connect to those hardware that will make hacking it difficult. A system will only be interesting to hack if it's both a mainstream device and if the infection vectors are easy to deal with. For example, ATM machine are never connected to the internet, they use dedicated communication lines.
- pjmlp 13y ago> You won't be very productive with ada... My experience shows otherwise. > For example, ATM machine are never connected to the internet, they use dedicated communication lines. Yep, it really helps. http://www.bubblews.com/news/353683-usa-atm039s-remotly-hacked-by-russian-hackers http://www.bubblews.com/news/353683-usa-atm039s-remotly-hack... Right now I am coding a graphics algorithm in C++. So although I have this opinion, I am also pragmatic and use whatever tooling my customers ask for. As for the rest, I guess we have to agree to disagree. :)
- jokoon 13y agoIn this case, yes they were connected, but I guess that was an isolated case. Banks don't make credit card transaction over the net. Security is not about programming languages. Security is mostly about infrastructure, OS and design. I honestly don't care about security at all. Arguing a language is not secure, is like saying you can cut yourself with a knife, and still people are stupid enough to hurt themselves with butter knives. The only language that is truly secure is javascript, and you can't really do everything with it, one time or another, you need to access the hardware and write file. C/C++ is a tradeoff, it's quite easy to teach, so you're very productive with it, that's one of the most important thing about a language, and it's still fast, but you need to use it carefully. Security has always been a costly, luxury feature that is really better to have in some cases, but if you're a small company and need to get something done, C/C++ is just great. And if you get hacked, most of the time, the guys who did it get caught, so I don't see why the industry should shift to ada or VM languages (which have been showed to have still many vulnerabilities).