Cross domain sessions

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Cross domain sessions

    Hi,

    I'm building a shopping cart system, which is almost complete if it wasn't
    for this bug (grrr). The site has about 10 domains pointing to it, one
    domain example-secure.com has the SSL cert, when the customer goes to the
    buy form, they're transfered to the secure domain... When this happens the
    session data is lost... I presume this is because of the domain transfer?
    However, I was under the impression that PHP sets the session cookie to be
    non domain specific by default?

    Has anybody encountered this problem before, and if so, can suggest a
    workaround?
    I've thought of a fudge, but I don't really want to be introducing fudges to
    a CC handling cart, if at all possible. ;o)

    Thanks,

    Nathan


    Treefrog Guest

  2. Similar Questions and Discussions

    1. CROSS DOMAIN POLICY
      Flex 1.5 HI anyone told me why to use the crossdomain policy and where to put the crossdomain.xml file in an webapplication(Web Server) is it in...
    2. cross domain policy issues
      I am attempting to communicate with a web service via flash across sub domains. All works fine and dandy on my local machine, but when i upload to...
    3. Cross domain CF access
      'lo all, I'm trying to host my .swf file on one domain, but have the flash remoting call CF on another domain (ie totally separate web servers)....
    4. Cross domain xml loading
      I?m trying to get some xml data loaded into flash across domain. I have the crossdomain.xml file in place and everything works fine in flash player...
    5. Cross domain webservice
      Hi, We have developed a webservice that retrieves Free/Busy information from the Exchange Server and returns it to the client. The webservice...
  3. #2

    Default Re: Cross domain sessions

    Treefrog wrote:
    > Hi,
    >
    > I'm building a shopping cart system, which is almost complete if it wasn't
    > for this bug (grrr). The site has about 10 domains pointing to it, one
    > domain example-secure.com has the SSL cert, when the customer goes to the
    > buy form, they're transfered to the secure domain... When this happens the
    > session data is lost... I presume this is because of the domain transfer?
    > However, I was under the impression that PHP sets the session cookie to be
    > non domain specific by default?
    AFAIK cookies are exclusively either domain or host specifik. And the
    only thing you would get from a session cookie is the session-id, which
    would mean nothing to other servers.

    > Has anybody encountered this problem before, and if so, can suggest a
    > workaround?
    Behavior by design :). You would need other mechanism to transfer
    session data. Could be through server to server connections or via
    client in formdata. Possibly many ways to do it. Perhaps companies like
    Gator has a readymade solution for you, they seem to be sometimes
    annoyingly resourceful in that area.

    > I've thought of a fudge, but I don't really want to be introducing fudges to
    > a CC handling cart, if at all possible. ;o)
    As long as its only shopping-cart items, I think it would be ok to slack
    on security without calling it a fudge, provided to customer has
    opportunity to confirm the transfered items.


    /Bent
    Bent Stigsen Guest

  4. #3

    Default Re: Cross domain sessions

    Treefrog wrote:
    > I'm building a shopping cart system, which is almost complete if it wasn't
    > for this bug (grrr). The site has about 10 domains pointing to it, one
    > domain example-secure.com has the SSL cert, when the customer goes to the
    > buy form, they're transfered to the secure domain... When this happens the
    > session data is lost... I presume this is because of the domain transfer?
    > However, I was under the impression that PHP sets the session cookie to be
    > non domain specific by default?
    Cookies are domain specific by design. A cookie set on one domain will not
    be passed to another. However, you can pass cookies across subdomains eg
    foo.domain.com and bar.domain.com
    > Has anybody encountered this problem before, and if so, can suggest a
    > workaround?
    > I've thought of a fudge, but I don't really want to be introducing fudges
    > to a CC handling cart, if at all possible. ;o)
    This is a common issue, as many shopping cart sites have a different domain
    for the secure portion (because they're using a shared/virtual hosting
    solution and their provider provides the secure cert).

    Generally the way around it is whenever you pass from the non secure part of
    the site to the secure part and vice-versa you pass the session code in the
    url string eg [url]www.domain.com/foo.php?id=session-code-here[/url]

    You can either continue to pass the session code in the url for all secure
    pages, or set a cookie for the secure domain as well if one is not already
    set. It's generally safer to keep passing the session code while in the
    secure part of the site to ensure they don't lose their shopping cart due
    to cookie conflicts.

    --
    Chris Hope - The Electric Toolbox - [url]http://www.electrictoolbox.com/[/url]
    Chris Hope Guest

  5. #4

    Default Re: Cross domain sessions

    Chris Hope wrote:
    > Treefrog wrote:
    >
    >> I'm building a shopping cart system, which is almost complete if it
    >> wasn't for this bug (grrr). The site has about 10 domains pointing to it,
    >> one domain example-secure.com has the SSL cert, when the customer goes to
    >> the buy form, they're transfered to the secure domain... When this
    >> happens the session data is lost... I presume this is because of the
    >> domain transfer? However, I was under the impression that PHP sets the
    >> session cookie to be non domain specific by default?
    >
    >
    > Generally the way around it is whenever you pass from the non secure part
    > of the site to the secure part and vice-versa you pass the session code in
    > the url string eg [url]www.domain.com/foo.php?id=session-code-here[/url]
    >
    But doesn't this leave the door wide open to session fixation amd other
    exploits?

    If you control both ends then a better solution might be to pass the session
    id (with some time varying data - e.g. time - to allow for expiry) in an
    encrypted format (symmetric or asymmetric) then decrypt & validate at the
    receiving end before reinstating the session using a cookies only policy.
    I'm just talking off the cuff here - it needs a lot more thought to make
    sure it's secure.

    HTH

    C.

    Colin McKinnon Guest

  6. #5

    Default Re: Cross domain sessions


    "Chris Hope" <blackhole@electrictoolbox.com> wrote in message
    news:1097780476_21010@216.128.74.129...
    > Treefrog wrote:
    >
    >> I'm building a shopping cart system, which is almost complete if it
    >> wasn't
    >> for this bug (grrr). The site has about 10 domains pointing to it, one
    >> domain example-secure.com has the SSL cert, when the customer goes to the
    >> buy form, they're transfered to the secure domain... When this happens
    >> the
    >> session data is lost... I presume this is because of the domain transfer?
    >> However, I was under the impression that PHP sets the session cookie to
    >> be
    >> non domain specific by default?
    >
    > Cookies are domain specific by design. A cookie set on one domain will not
    > be passed to another. However, you can pass cookies across subdomains eg
    > foo.domain.com and bar.domain.com
    >
    >> Has anybody encountered this problem before, and if so, can suggest a
    >> workaround?
    >> I've thought of a fudge, but I don't really want to be introducing fudges
    >> to a CC handling cart, if at all possible. ;o)
    >
    > This is a common issue, as many shopping cart sites have a different
    > domain
    > for the secure portion (because they're using a shared/virtual hosting
    > solution and their provider provides the secure cert).
    >
    > Generally the way around it is whenever you pass from the non secure part
    > of
    > the site to the secure part and vice-versa you pass the session code in
    > the
    > url string eg [url]www.domain.com/foo.php?id=session-code-here[/url]
    >
    pass a temporary session id between the servers.

    Original session id: ABCD [url]www.domain1.com[/url]
    -> Generate a temp ID: transer_bbc that has a value of
    original session ABCD
    Secure server recieves temp ID. transfrer_bbc -> reads the ABCD session
    ID and destroys the temporary transfrer_bbc.

    This way the session fixation will be minimized since the ID that you just
    passed in the url gets destroyed as soon as secure server grabs it.

    ?? Any thoughts on this

    > You can either continue to pass the session code in the url for all secure
    > pages, or set a cookie for the secure domain as well if one is not already
    > set. It's generally safer to keep passing the session code while in the
    > secure part of the site to ensure they don't lose their shopping cart due
    > to cookie conflicts.
    >
    > --
    > Chris Hope - The Electric Toolbox - [url]http://www.electrictoolbox.com/[/url]
    >

    Ninjaboy Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139