Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
is it possible to write java code that could be exploited using a buffer overflow? also, are there other ways to exploit higher level languages? i understand the concept of smashing the stack with something like c or c++ but, does the jvm handle this? thanks
The ability to exploit languages that run in interpreters usually boils down to security issues with the interpreter. A search on Google will show you that Sun's JVM (as an example) has had a `colourful' history, to say the least. However, though the end aim of the exploitation is often shared (to run some arbitrary code), the method of achieving it is often different -- for example, in Java it could be tricking the JVM into loading malicious classes (I think Last Stage of Delirium found a vulnerability along those lines in Java). As for whether you could write Java that could be exploited by a buffer overflow, I think it is unlikely -- unless you can switch off the bounds detections and work around the exceptions mechanisms you would most likely trigger (I am not a Java programmer, thank God). The problem has always been security versus performance, are you willing to take a 40% or greater performance hit (Java versus C, the GC in Java alone is about 30% overhead) to aid security? Consider this in a programming environment, whereby most people like to think they are good programmers and could never, themselves, end up with exploitable software. Another thing to think of with the interpreted language is, usually, they are programmed in the `vulnerable' languages.
Originally posted by another2 thanx about the info, how do you check c code for buffer overflows btw?
thanx
A buffer overflow, by definition, occurs when a user is able to write past the end of (overflow) a contiguous section of memory (buffer). This issue mainly arises in two forms: 1) static buffers accepting dynamic length arguments, 2) a lack of knowledge of how buffers need to function (this could be forgetting that an array is numbered exclusively (though exploiting this in stack overflows does not work since GCC 3.something added padding to the stack frame), forgetting that to be a ascii zero string a character array needs a null termination character, not realising that an array is of a set length and different types fit different amounts into a given array). This becomes most dangerous when coupled with the data arriving at the program from an `untrusted' source (ie, the user and the environment). There are many tools around to automate the process of checking for overflows, but nothing is fool proof. In general, you should look at any piece of code you write with a view towards what will happen given any input not just the input you desire. This is far from a tutorial for avoiding or finding buffer overflows, but hopefully it helped.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.