Forums / Other Business Topics / PCI Fail - Session-Fixation Social Engineered Session Hijacking

PCI Fail - Session-Fixation Social Engineered Session Hijacking

Views: 269

Results 1 to 8 of 8
7 Jan 2020, 3:25 PM
#1
lindasdd avatar

lindasdd

Zen Follower

Join Date:
Jun 2007
Posts:
474
Plugin Contributions:
0

PCI Fail - Session-Fixation Social Engineered Session Hijacking

I had a PCI fail due to 'Session-Fixation Social Engineered Session Hijacking'.

Before I go mucking things up, is there a quick admin setting change or file change to prevent this fail.

Admin session settings:
Cookie Domain: True
Force Cookie Use: False
Check SSL Session ID: False
Check User Agent: False
Check IP Address: False
Prevent Spider Sessions: True
Recreate Session: True
IP to Host Conversion Status: true
Use root path for cookie path: False
Add period prefix to cookie domain: True

Details of the fail are below:
Threat: The scanner found a Web application on the target that uses cookies. The application seems to use cookies (likely, session IDs) in an insecure way. Specifically, the scanner created a web session with the target using a session ID specified by the scanner itself. The target application simply started a new session with this specified session ID. This issue is generally called "session-fixation" and is vulnerable to session-hijacking attacks.
One scenario where this could be used to hijack an unsuspecting user's Web session is as follows. Assuming an online store, https://www.examplestore.com, has this security issue. If an attacker uses social engineering techniques to make a target user click on a link (in an email or on a malicious Web site) like http://www.examplestore.com/?PHPSESSID=12345, where PHPSESSID is the cookie used for identifying the session, the store will start a new session for the unsuspecting user with the session ID 12345. Then, since the attacker knows the session ID already, the attacker can simply hijack the session moments after the user has visited the store.

Impact: By exploiting this vulnerability, an attacker could use the hijacked session for information gathering, invasion of privacy, property theft, or credit-card theft.
For more information about the way session-fixation attacks can be performed and the possible consequences of such attacks, read this paper.

Solution: This is a common issue web-developers come across, and many application-specific solutions exist.
The PHP package itself provides a "php.ini" based global configuration option called "session.use_only_cookies" (introduced in PHP Version 4.3.0). This is disabled by default for backward compatibility. When enabled, this allows PHP session IDs to be set only via HTTP cookies. This makes GET/POST based hijack attacks possible only when there is significant activity by an unsuspecting user.
For more information, read the Sessions and Security description provided on PHP's Web site.
For solutions in other web packages, check the relevant documentation.

7 Jan 2020, 3:57 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: PCI Fail - Session-Fixation Social Engineered Session Hijacking

To apply the offered solution would be to change the setting for Force Cookie Use from false to true.

This will require a cookie to be present to support maintaining session data and there should no longer be a zenID when initiating a new session with the store. It will however have a negative effect for those that have disabled all cookies instead of say just third party cookies as a privacy setting.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

8 Jan 2020, 4:25 PM
#3
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,305
Plugin Contributions:
39

Re: PCI Fail - Session-Fixation Social Engineered Session Hijacking

Wait before you do that... What version of Zen Cart & PHP. Most likely this is a false positive and you should have them check it manually. I just manually tested 1.5.6C & PHP 7.3 and the session was not activated much less carried forward.

~Melanie

9 Jan 2020, 8:14 PM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: PCI Fail - Session-Fixation Social Engineered Session Hijacking

Further to @Mprough's remarks, I have seen this kind of behavior in PHP 5.6 but never in PHP 7+.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

23 Jan 2020, 10:11 PM
#5
lindasdd avatar

lindasdd

Zen Follower

Join Date:
Jun 2007
Posts:
474
Plugin Contributions:
0

Re: PCI Fail - Session-Fixation Social Engineered Session Hijacking

PHP 7.1.33
Zen-Cart 1.5.5f

Might need to upgrade the cart the rest of the way prior to making any changes.

27 Jan 2020, 4:21 PM
#6
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,973
Plugin Contributions:
8

Re: PCI Fail - Session-Fixation Social Engineered Session Hijacking

i tend to agree with @mprough. i am not sure who is doing your vulnerability scan; as the info they have provided seems inaccurate and misleading.

from your server info page, what is the value of:

session.use_only_cookies

this should be set to 1 to prevent the kind of hijacking mentioned in the scan. as of php 5.3, the default is 1. see:

https://www.php.net/manual/en/session.configuration.php#ini.session.use-only-cookies

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

4 Apr 2022, 4:33 PM
#7
lsamdahl avatar

lsamdahl

New Zenner

Join Date:
Apr 2022
Location:
Samdahl
Posts:
2
Plugin Contributions:
0

Re: PCI Fail - Session-Fixation Social Engineered Session Hijacking

I received the same PCI scan vulnerability for my shop. I have manually confirmed the vulnerability is present.

I have v1.5.7c running on PHP 7.3.20, and I have set "Force Cookie Use" to true but the test still succeeds. Here's how it works:

If I access my shop with the following URL: "https://shop.example.com/?zenid=0123456789abcdef0123456789abcdef" a new session is created using the supplied id. (Note that we actually use a custom session name rather than "zenid".) This can be confirmed by checking the session cookie in the developer tools. I have also confirmed the behavior in an older shop that we have running v1.5.0.

I have traced this behavior to line 65 in /init_includes/init_sessions.php "zen_session_id($_GET[zen_session_name()]);". A quick fix would be to disable this line (and the conditional before it) so that session id's are never set from GET but only from POST. What I want to know is what side effects would this have for my shop?

Our PCI scanning provider, Sysnet Global Solutions, considers this a high risk vulnerability. I can't mark it as a false positive since I can reproduce it myself. They say that it is vulnerable to social engineering attacks where the session can be hijacked.

23 May 2022, 5:28 PM
#8
sagelogic avatar

sagelogic

New Zenner

Join Date:
May 2022
Location:
So. Cal
Posts:
1
Plugin Contributions:
0

Re: PCI Fail - Session-Fixation Social Engineered Session Hijacking

I have traced this behavior to line 65 in /init_includes/init_sessions.php, which is "zen_session_id($_GET[zen_session_name()]);". A quick fix would be to disable this line (and the conditional before it) so that session id's are never set from GET but only from POST. What I want to know is what side effects would this have for my shop?

Hoping that DrByte can confirm whether or not this is a safe work-around. Seems straight-forward enough but a bit afraid to try it without confirmation from DrByte or someone else that has successfully implemented this fix.