Jump to content

securing $_GET


Rick_

Recommended Posts

hey I'm new to this site, so I hope this is the right area to post this.

 

I'm using a php file, where there are variables added to the URL, and i need it so they cannot be changed:

 

for example, the url is:

 

http://localhost/index.php?username=User1

 

is there a way to stop people just changing this to User2 for example?  this data is to do with login credentials so I dont want people logging in under other people's account.

 

I think masking the URL will only hide the information and doesnt protect it.

I hope my problem is clear, and i hope you guys can help

 

thanks

Rick_

Link to comment
Share on other sites

here is an example of what im using:

 

<script type="text/javascript" language="javascript">

 

var userName = "User1";

 

window.location = "user.php?userName=" + userName;

 

</script>

<?php

$userName = $_GET['userName'];

//do stuff with $userName

?>

}

 

Link to comment
Share on other sites

actually, now that I['m thinking about it.....even if you hashed it, all someone would have to do is copy the complete URL with querystring, and bang...they become that user....

^-- correct answer

 

No amount of hashing will secure the url.  I would suggest using a different method just as premiso suggested.

Link to comment
Share on other sites

actually, now that I['m thinking about it.....even if you hashed it, all someone would have to do is copy the complete URL with querystring, and bang...they become that user....

^-- correct answer

 

No amount of hashing will secure the url.  I would suggest using a different method just as premiso suggested.

 

any suggestions? i really need information from javascript securely sent to php which i see is a huge problem :(

Link to comment
Share on other sites

im trying to get the novell username off of the client (which i can do in javascript using an activex control)

then i want that username to be sent to our local intranet which uses php.  so i need the data obtained from JS to be able to communicate with php, and the only way I could personally think of was the $_GET method which clearly has massive security flaws.

Link to comment
Share on other sites

$_GET isn't flawed lol, just your implementation.

 

The easiest way to go with your current implementation is to require the user to type in their password again when they are taken to the "assumed" page based of the username.

 

I'm not familiar with Novell stuffs, so you may think about reposting a question about getting the novell login credentials to hook in with your intranet site..

 

But anyway, you can keep your method, just require the person to re-enter their password to confirm it's them... create a session from there etc.  It will be annoying having to do it all the time, but unless you can pull the data another way, you can't guarantee it's the user you think.

Link to comment
Share on other sites

actually, now that I['m thinking about it.....even if you hashed it, all someone would have to do is copy the complete URL with querystring, and bang...they become that user....

^-- correct answer

 

No amount of hashing will secure the url.  I would suggest using a different method just as premiso suggested.

 

any suggestions? i really need information from javascript securely sent to php which i see is a huge problem :(

 

Well, really they could only get that url with the querystring if they were sniffing your network....

I think......

 

I'm no hacker, but i don't think thats an easy thing to do.  Or at least for an average joe like me.

 

The only thing I can think of, is to get SSL.....and encrypt it

which would take money....

 

other than that.....redesigning is the only way. 

Link to comment
Share on other sites

If this is an intranet application your only worry is someone on the intranet sniffing your packets. If it is out in the open via the internet you have worries as the amount of hops you have to go through to get to the website can be a ton. Especially if that person travels. Do a tracert on the ip of your host and it will tell you how many times your connection has to be bounced off another node to reach it's destination. Each bounce could have a potential sniffer. Especially if a hacker looks at the javascript and realizes what it is doing he can easily sniff out the data.

 

Now you could try passing it via POST over GET which is a bit more secure. I mean for the most part about 85% of webpages with a login system only use post to verify a user without SSL locked up. Rarely that data gets out. But, if you are only checking a username, post is flawed cause anyone can create a form to post to your page and be logged in.

 

The real key is to have a verification system. As I always see, convenience for the user is 2nd to security of the user/company. If they have to type in a password to identify themselves it is worth it to secure the system that much more. At least that is my 2cents.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.