Jump to content

Recommended Posts

... Accidentally "hacked".

 

 

I built this tool for my job, and it used by me and some workers in another office in California (I'm in Florida). The tool saves session variables for data manipulation but I won't go into too much details.

 

Basically users can submit a form with data and it gets manipulated and produces output.

 

On my form I had submitted "Miami" and "Florida" for city and state, so the session variables would have been set using:

$_SESSION['city'] = "Miami";
$_SESSION['state'] = "Florida;

 

However, a coworker in California, submitted "Mount Holly" and "New Jersey" on the form - but on the output screen the city and state showed as "Miami" and "Florida" ???

 

It's like somehow her session picked up my session variables? Sorry if this sounds confusing I'm trying to explain best I can.

 

Do you know how I can fix something like this from happening again? This is the first time I've heard of this happening. I've added this:

session_regenerate_id();

 

... after session_start(); to see if maybe that would help.

 

 

My guess is that somehow the session ID that was generated for her was the exact same as mine or something, and the data crossed over. Just guessing, I'm still newbie to PHP

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/186042-php-sessions-getting-hacked-into/
Share on other sites

probably a stupid question, but I assume when you say you have this:

 

$_SESSION['city'] = "Miami";
$_SESSION['state'] = "Florida;

 

you really have something more like this, right?

 

$_SESSION['city'] = $_POST['city'];
$_SESSION['state'] = $_POST['state'];

 

because if you have the former...well you are using hardcoded values...

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.