Reputation: 8941
I am developing a small C# application, that acts as a handler for a certain web-protocol (myprotocol://blafoobar). Thus whenever the user clicks on such a web link, the handler is invoked by Windows. It then parses the URI and performs certain actions.
This of could of course be a security risk. One possible attack vector would be, that an attacker provides a malicious link to the user: "myprotocol://someevilstuff". Then the parsing of the URI would cause my application to expose some unexpected behavior, due to buffer overflows etc. (<- I'm no expert on this).
So I have a bunch of questions:
Upvotes: 3
Views: 481
Reputation: 62101
Is C# in general more robust against buffer overflows
It is, AS IS GOOD WRITTEN C# code - basically you MUST check allocated memory all the time. That said, unless your app explicitly violates trust boundaries (unsafe code, calls into native libraries) you are QUITE safe. 100% is not likely, but a lot of people work on fixing every bug there.
Is the C# string class rather safe (splitting etc.)?
Yes.
Is there some general advice what I should look out for/avoid?
Not really on a technical level. On a logical level - make the possible attack vector as small as possible, i.e. do not JUST delete things etc. and validate the input makes sense.
Upvotes: 4