473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

eval?

Thekid
145 100+
Hi,
How can I set arg to execute /etc/bin/thekid?

Expand|Select|Wrap|Line Numbers
  1. $store = "thk".'f'; $y = $_GET['arg']; eval("\$store = \$y;"); 
  2.  
Aug 19 '08 #1
2 1441
Atli
5,058 Expert 4TB
What?
That code make absolutely no sense...
It just creates two variables, and then sets the first one like the second one.

What are you trying to do?
Please explain in more (any) detail.

As a full member now, I would expect you to know at least the most basic of our forum rules.
Please review the Posting Guidelines, especially the parts about How to ask a question and Use a good thread title.

I will be changing the title of the thread into something more suitable as soon as I know what it is you are asking about.

MODERATOR
Aug 19 '08 #2
Thekid
145 100+
Sorry for any confusion over the lack of information in the original post but this is what I've been given:

A user codes this PHP code. Set arg to execute /etc/bin/thekid.
$store = "thk".'f'; $y = $_GET['arg']; eval("\$store = \$y;");

The goal is to recognize problems with simple lines of code and be able to correct or prevent them. Apparantly this is an old eval injection vulnerability and I found this online:

Expand|Select|Wrap|Line Numbers
  1. An eval injection vulnerability occurs when someone can control 
  2. all or part of an input string that is fed into an eval() function 
  3. call. Eval will execute the argument as code. The security 
  4. implications for this are obvious. This issue has been known for 
  5. years [2]:
  6.  
  7.  
  8. Example: 
  9.  
  10.  
  11.   $myvar = "varname"; 
  12.   $x = $_GET['arg']; 
  13.   eval("\$myvar = \$x;"); 
  14.  
  15.  
  16.   What happens if arg is set to "10 ; system(\"/bin/echo uh-oh\");" ? 
  17.  
  18.  
I don't have to get the code to actually work or do anything, I just needed the proper syntax to submit it. I initially didn't think it was an eval() problem but I found the above example today and see that it is.
Aug 19 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Reply Via Newsgroup | last post by:
This might sound sad... someone requesting a disertation on the 'eval' statement... but... I've been reading someone else's post - they had a huge calander like script and a handful of folk cursed...
11
by: sneill | last post by:
I have read a number of posts on the use of eval() in Javascript, and I agree that its use is questionable. But it does beg the following question: "How arbitrary does a string need to be before...
0
by: Michelle Keys | last post by:
Subject: DataBinder.Eval Error! Server Error in '/MSPOS' Application. ------------------------------------------------------------------------ -------- DataBinder.Eval:...
18
by: Joe Fallon | last post by:
I have some complex logic which is fairly simply to build up into a string. I needed a way to Eval this string and return a Boolean result. This code works fine to achieve that goal. My...
15
by: manstey | last post by:
Hi, I have a text file called a.txt: # comments I read it using this:
3
by: Pauljh | last post by:
Hi All, I'm running some javascript over a server side generated web page and have multiple generated empty select statements, that I want to populate when the page is loaded. As HTML doesn't do...
4
by: Jm lists | last post by:
Hello members, I want to know does the "eval" in python have the same features as in Perl (capture errors)? For example,in perl I can wrote: $re = eval { 1 / 0 }; Though 1/0 is a fatal...
6
by: RandomElle | last post by:
Hi there I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with...
5
by: wendallsan | last post by:
Hi all, I'm running into a situation where it seems that JS stops executing as soon as I call an eval in my script. I have an Ajax.Request call to a PHP page that builds a JS object and returns...
10
by: Gordon | last post by:
I have a script that creates new objects based on the value of a form field. Basically, the code looks like this. eval ('new ' + objType.value + '(val1, val2, val3'); objType is a select with...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.