Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 1159586: Split browsing context groups by top-level site #322

Open
uazo opened this issue Aug 8, 2023 · 17 comments
Open

Issue 1159586: Split browsing context groups by top-level site #322

uazo opened this issue Aug 8, 2023 · 17 comments
Labels

Comments

@uazo uazo added wip work in progress privacy upstream labels Aug 8, 2023
@uazo
Copy link
Owner Author

uazo commented Aug 10, 2023

@PF4Public if you have time, try checking this too.

if I understand correctly, basically today a first party can communicate with itself via postmessage when it is a third party even between different partitions.
a slap in the face to partitioning by default. :)

@PF4Public
Copy link

if I understand correctly, basically today a first party can communicate with itself via postmessage when it is a third party even between different partitions.

@uazo Could you please rephrase your statement above? I'm not sure I completely understand you.

From what I read, in order to send a message over window.postMessage(), caller needs to somehow obtain a handle of the target window, where it wants to send the message. This could be only obtained by opening another window or having an iframe in DOM. This indeed could be abused, but it is technically very difficult to exploit on third-party webpages.

@uazo
Copy link
Owner Author

uazo commented Aug 15, 2023

Could you please rephrase your statement above? I'm not sure I completely understand you.

you must excuse me, I thought I could do it but I have not yet had time to double check the code, but simply reading it:

PostMessageType GetPostMessageType(
    const blink::StorageKey& source_storage_key,
    const blink::StorageKey& target_storage_key) {
  // We want these storage keys to behave as though storage partitioning is on
  // for convenience.
  const blink::StorageKey source_3psp_key = source_storage_key.CopyWithForceEnabledThirdPartyStoragePartitioning();
  const blink::StorageKey target_3psp_key = target_storage_key.CopyWithForceEnabledThirdPartyStoragePartitioning();
....
  } else if (source_3psp_key.IsFirstPartyContext() &&
             target_3psp_key.IsThirdPartyContext()) {
    // If the source is first party and the target is third party . . .
    if (source_3psp_key.origin() == target_3psp_key.origin()) {
      // . . . we note if their origins are identical . . .
      return PostMessageType::kFirstPartyToThirdPartyDifferentBucketSameOrigin;         <---------
....

kFirstPartyToThirdPartyDifferentBucketSameOrigin means precisely the same site but the sender is first-party and the receiver is third-party, but there are also kThirdPartyToFirstPartyDifferentBucketSameOrigin and kThirdPartyToThirdPartyDifferentBucketSameOrigin

From what I read, in order to send a message over window.postMessage() caller needs to somehow obtain a handle of the target window, where it wants to send the message

a window.top.opener might be sufficient, but tests could indicate exactly how.
I'll have a better look when I get back, thanks for taking the time!

@PF4Public
Copy link

kFirstPartyToThirdPartyDifferentBucketSameOrigin means precisely the same site but the sender is first-party and the receiver is third-party, but there are also kThirdPartyToFirstPartyDifferentBucketSameOrigin and kThirdPartyToThirdPartyDifferentBucketSameOrigin

Yes, but how could first party be third-party at the same time?

@uazo
Copy link
Owner Author

uazo commented Aug 22, 2023

Yes, but how could first party be third-party at the same time?

In different browsing context, by simplifying, different tabs.

1) top frame site A
    |
     ---- contains iframe site B
          |
          ------ opens a new tab with the B
                  |
2)                 ---- contains iframe site A

(1) and (2) are first party and third-party at the same time

@PF4Public
Copy link

This won't go unnoticed by user though!

@uazo
Copy link
Owner Author

uazo commented Aug 23, 2023

This won't go unnoticed by user though!

My example is just to make you understand how it is possible, I haven't checked yet.
If it was only as I wrote, the various actors don't need to exchange messages to pass information, they could do it through urls.

@PF4Public
Copy link

I wonder if it would be possible to create a simple proof of concept to verify if this woks or not :)

@uazo
Copy link
Owner Author

uazo commented Aug 23, 2023

should not be necessary, I think I saw an associated Ukm, tomorrow I will tell you

@uazo
Copy link
Owner Author

uazo commented Aug 24, 2023

I saw an associated Ukm

nothing, I just don't understand how you can read that information.
I asked for help https://groups.google.com/a/chromium.org/g/chromium-dev/c/wKSDHEkGVFo

@uazo
Copy link
Owner Author

uazo commented Aug 26, 2023

I asked for help

they replied: nothing, I guess it won't be possible to tell if sites exploit that possibility and how.
I think I'll activate that flag regardless, although I don't like doing it without fully understanding why, I'll add optional logs.

@PF4Public
Copy link

I don't like doing it without fully understanding why

Creating proof-of-concept could help with that

@uazo
Copy link
Owner Author

uazo commented Aug 26, 2023

it's a lot of work... I don't know, I think about it.

@PF4Public
Copy link

it's a lot of work

It is, but it should give you 100% confidence on whether it is exploitable and whether your solution fixes this issue.

@uazo
Copy link
Owner Author

uazo commented Aug 26, 2023

It is, but it should give you 100% confidence on whether it is exploitable and whether your solution fixes this issue.

But I would reach the same goal if I blocked it and produced a log, exactly as google does.
and once you find the site, check how it does it.

@PF4Public
Copy link

Programmers would call this a Probabilistic Solution. You don't know when you catch it and you don't even know if you catch it at all. In addition to that you'll later have no way of telling whether your solution works or not. Probabilistic Solutions are not regarded well by programmers as far as I know.

I'm not telling you that you are wrong, but it can take some (unpredictable) time before you have any results.

PS: I'm not a programmer btw :)

@uazo
Copy link
Owner Author

uazo commented Aug 28, 2023

but it can take some (unpredictable) time before you have any results.

Yeah, especially without any log!
I guess something should be done first to warn me uazo/cromite#323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants