LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-13-2004, 01:27 AM   #1
another2
Member
 
Registered: Jun 2003
Distribution: Debian sid
Posts: 69

Rep: Reputation: 15
security question regarding programming languages


okay, from the top:

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
 
Old 02-13-2004, 03:10 AM   #2
cjcuk
Member
 
Registered: Dec 2003
Distribution: Openwall, ~LFS
Posts: 128

Rep: Reputation: 15
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.

Sorry, I just started typing and it got long =/.
 
Old 02-13-2004, 11:59 PM   #3
another2
Member
 
Registered: Jun 2003
Distribution: Debian sid
Posts: 69

Original Poster
Rep: Reputation: 15
thanx about the info, how do you check c code for buffer overflows btw?
thanx
 
Old 02-14-2004, 07:14 AM   #4
cjcuk
Member
 
Registered: Dec 2003
Distribution: Openwall, ~LFS
Posts: 128

Rep: Reputation: 15
Quote:
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Statistical programming languages Nerox Programming 1 03-17-2005 12:01 PM
What programming languages do you know? ugoff General 24 12-13-2004 06:01 PM
How many programming languages do you know? MikeZila Programming 4 07-25-2004 01:26 PM
Programming languages on Linux? Imek Programming 6 01-04-2004 03:07 AM
Programming languages and Linux healfdeane Linux - Software 1 09-10-2003 09:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration