search engine optimization   Programming blog
        SEO        Link Building        Services        Genie Magic        Web Design        Contact Us        SEO Tools
 
   
Code Injection, Tuesday, March 17, 2009
   
 

When software permits the input of user to contain code syntax, it may be possible for a hacker to craft the code in such a way that it will change the proposed control flow of the software. Such a modification possibly will show the way to arbitrary code execution.

An injection problem covers a wide range of issues in different ways. The most significant problem to note is that each and every injection problems share one thing in common -- i.e., they permit for the injection of control plane data into the user-controlled data plane. This means that the execution of the process may be misused by transferring the code through genuine data channels, using no other mechanism. While buffer overflows, and many other flaws, engage the use of some further issue to gain execution, injection problems require only for the data to be parsed. SQL injection and format string vulnerabilities are the most typical instantiations of this kind of weakness.

This illustration try to write user messages to a message file and let users to view them.

PHP Example:

$InfoFile = "seo/codeinject.out";
If ($_GET ["action"] == "Message to write")
{
$name = $_GET ["name"];
$message = $_GET ["message"];
$handle = fopen ($InfoFile, "a+");
fwrite($handle, "$name says '$message'\n");
Fclose ($handle);
Echo "Message Saved Successfully! \n";
}

Else if ($_GET ["action"] == "ViewMessages")

{

Include ($InfoFile);

}
While the programmer proposes for the InfoFile to only include data, an attacker can supply a message such as:
name=h4x0rmessage=%3C?php%20system(%22/bin/ls%20-l%22);?%3E

which will decode as given below:

within php tag type the command given below

system("/bin/ls -l");

The programmer thought they were just including the contents of a regular data file, but PHP parsed it and executed the code. Now, this code is executed any time people view messages.

How to overcome

Your code should run in a "jail" or similar sandbox atmospheres that impose firm limitations between the process and the operating system. This may efficiently put a ceiling on code executed by your software.(Ex) Unix chroot jail and AppArmor. On the whole, managed code must be in some protected area.

Imagine all input is malicious. Use good input validation strategy. Decline any input that does not strictly conform to specifications, or transform it into something that does. Use a blacklist to reject any unexpected inputs and detect potential attacks.

To diminish the chances of code injection, use strict whitelists that set boundary which constructs are allowed. If you are dynamically constructing code that invokes a function, then verifying that the input is alphanumeric might be insufficient. An attacker can reference a dangerous function that you did not intend to allow, such as system(), exec(), or exit().

                                Earthlink Netscape Netvouz RawSugar Shadows Sphinn StumbleUpon Yahoo MyWeb

 
   
 

posted by power @ 3:59 AM permanent link   |

Post a Comment

|

 

0 Comments:

Home

 

Categories
 

 
Archives
 
Previous posts
 
 
PageRank 10 sites
Search Engine Optimization SEO Blog
Search Engine
Optimization SEO News
SEO Copywriting Blog
Web Design Blog
Link Building Blog
Pay Per Click (PPC) Blog
Programming Blog
Search EngineGenie Blog
Lara's Personnal Blog
Search Engine
Optimization SEO Forum
SEO Comics
Webmaster & Search Events
 
search engine optimization
search engine marketing
SEO consulting
SEO plans
SEO services USA
search engine optimization SEO forum
SEO comics
Webmaster & Search Events
SEO Faqs
link popularity
strategies of link building
link building services
link cost
link request quote
link building blog
search engine genie company
our team
our celebrations
our experience
SEO
why us

web design
web designing services
dynamic website
web design and marketing
simple e-commerce website
complex e-commerce website
search engine friendly site
web design blog
web design
link building
internet marketing
ecommerce implementation
pay per click services
shopping feeds optimization
shopping cart customization
product development
online forms & database integration
programming services
PHP programming services
programming services Java,J2EE
.NET application development programming services
business process outsourcing
offshore outsourcing
Google Products(froogle feeds)
search engine optimization articles
google articles
yahoo articles
miscellenous articles
search engine optimization SEO blog
search engine optimization SEO news
SEO copywriting blog
web design blog
link building blog
pay per click (PPC) blog
programming blog
lara personnal blog
Search Engine Genie Blog
Google Tools
Yahoo Tools
MSN Tools
Comparison Tools
Link Popularity Tools
Search Engines Tools
Site Tools
Keyword tools

contact us
support
our guarantee
events