Jump to content

Recommended Posts

This is my first big project with PHP (big being a completely subjective term, as it's currently ~650 lines long), and I don't want any huge security holes. I have to deal with a MySQL database, and I know how abundant SQL injections are... and I'd hate to fall prey to one.

 

I think that I have every hole closed up (that I know of, obviously), but I'd just like to make sure I've gone through the checklist.

 

I have a few $_POST and $_GETS, all sanitized. Upon login, a session is created, but I sanitize the session variable on each page, before it's allowed to make any calls to the database.

 

Alphanumerics, periods, and hyphens are allowed. Nothing else.

 

Anything I need to do before I throw my baby into production?

Link to comment
https://forums.phpfreaks.com/topic/169850-pentesting-my-program/
Share on other sites

Sessions work by creating a unique id (UID) for each visitor and store variables based on this UID. The UID is either stored in a cookie or is propagated in the URL.

 

From what I can understand, that means that sessions are saved client-side, and therefore unreliable. Maybe? 'Session tampering' also sounds familiar, which I thought to mean 'changing session variables client-side'. Am I wrong?

All data in your $_SESSION variables are stored server side , unlike cookies which are stored on the client. Sessions do use cookies but it only stores the session id. This id cannot be tampered with it is unique to each user.

 

No one can get hold of your session data, unless they manage to find an exploit in your code which allows them to gain access, this is why it is important to always sanitize data from the user.

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.