News for hackers. Stuff that matters.
Re:Companies must stop using Google Analytics by TekMol on Tuesday July 04, 2023 @06:48AM (#36584886)
One could still use Google Analytics by proxying the tracking events. Afaik only the IP is considered private data. So one could mask or (non-reversibly) hash the IP, remove anything else which might be considered private data and then send the event to Google. A simple PHP script with a few lines of code could do that.

But Google lost me by:

A) Making it impossible to convert your old data into the new Analytics version

B) Abandoning the API which allowed you to code your own reports. Over the years, I wrote a ton of code that talks to the API. This is all worthless now.

I recently switched to self-hosted Matomo. At first I did not think much about it, but now after I got used to it, I have to say it is much better than GA. The interface is so much nicer and snappier. And more logical.

Apart from that, I like that it is open source. If there ever is a point in the road where the makers of Matomo decide on a non-compatible fork, I'm sure the community will write a converter that converts the old data into the new format.

And after using it for a while, it hit me: You can write your own reporting tools by just querying the MariaDB database! Using SQL is so much better than it was to fight the insanely complex and unintuitive Google Analytics API.

If I really wanted to still use Google Analytics, I would just write a converter, which pumps all the Matomo events into Google Analytics. That would be a GDPR-compliant way to use Google's tools. But I don't. I'm done with Google Analytics forever. Matomo is the promised land for me.

Re:Companies must stop using Google Analytics by berkes on Tuesday July 04, 2023 @07:26AM (#36585208)
Last time we had a privacy officer make a report on our setup, we were (unknowingly) sending much more PI data to Google than the IP. The fact that you e.g. clicked the "like button" on profiles/xxx, leaks that you have access to xxx, can like it, and have liked it. There were many more like this. Ours was a business tool.

The data we were leaking was e.g. the fact Foo was employee at ACME, simply because we sent events occurring on the estate of Acme for user Foo.

It's not as straightforward as proxying. Or, as we did, removing some bits from the IP.

Re:Companies must stop using Google Analytics by bunnyfoofoo on Tuesday July 04, 2023 @07:18AM (#36585147)
You can’t hash an ipv4 address. It’s trivial to brute force all possibilities given the limited problem space.
Re:Companies must stop using Google Analytics by leononame on Tuesday July 04, 2023 @07:24AM (#36585185)
But you could use a salt, right?
Re:Companies must stop using Google Analytics by wyufro on Tuesday July 04, 2023 @07:41AM (#36585346)
Only if the salt is kept secret. There also needs to be a different salt value per ip, obviously. But given those conditions, it works.
Re:Companies must stop using Google Analytics by Qwertious on Tuesday July 04, 2023 @07:38AM (#36585317)
A salt will render rainbow tables useless, but AIUI will not prevent brute-forcing after the fact. IPv4 has ~4 billion addresses, which would be too expensive for data analytics but could be brute-forced if someone really wants this one piece of data in particular.
Re:Companies must stop using Google Analytics by worksonmine on Tuesday July 04, 2023 @07:34AM (#36585277)
That's why you use a salt, which is what I assume is meant by "non-reversibly".
Re:Companies must stop using Google Analytics by sweetjuly on Tuesday July 04, 2023 @08:57AM (#36586045)
Salts provide resistance against bulk bruteforce by making it so that you can't identify which hashes are the same plaintext without actually computing all of them. The issue is still that there are not that many IPv4 addresses and so even with very heavy algorithms it would be trivial to break.
Re:Companies must stop using Google Analytics by worksonmine on Tuesday July 04, 2023 @09:17AM (#36586249)
But there are infinite numbers of salts. Please explain how this could be brute-forced as long as the salt is used correctly? What am I missing?
Re:Companies must stop using Google Analytics by ericpauley on Tuesday July 04, 2023 @09:36AM (#36586458)
No matter what strategy you use to hash IPs, if you can correlate to an IP you can find the original IP by just trying all options. It doesn’t matter what you do because 4B unique possibilities is just too low to prevent brute forcing while maintaining utility.

If you use a random salt, then you need to store it or else the stored value has no utility. However you implement retrieval of that salt it can just be brute forced.

Re:Companies must stop using Google Analytics by worksonmine on Tuesday July 04, 2023 @11:28AM (#36587949)
The salt could be stored as a cookie and you can follow the session but never be able to reverse the hash yourself. Any match you get in the brute-force attempt might as well be a collision.

The entropy can be in the salt, you're all making it sound way too easy. The requirement is "non-reversible". Given infinite time everything can be brute-forced, but this is the mossad/not-mossad problem.

It's good enough for storing passwords, where the salt is plain-text.

Re:Companies must stop using Google Analytics by ericpauley on Thursday July 06, 2023 @10:19AM (#36616208)
That’s just unique identifiers with extra steps.
Re:Companies must stop using Google Analytics by 3np on Tuesday July 04, 2023 @09:45AM (#36586569)
Could you be more precise with what envision by "correctly"? If you use a shared salt for all or a significant portion of rows, then it's a realistic matter of bruteforcing to cover your entire table, given that the attacker has been able to recover the salt.

Even without any cracking at all, shared salt would mean that rows can be correlated if the attacker can identify a single row and correlate that to the target.

Let's say you use up the game and use per-row salts, like here: https://stackoverflow.com/questions/4159827/another-question...

Given an attacker wanting to pull out information about a specific user, and they have on their hands your salted dataset, the salts, and a handful of IP addresses that the target is known to be associated with from other datasets, it's still trivial to brute-force.

Even increasing it to a set of a few thousand IP addresses (say, a handful of /24s) it should be perfectly realistic, assuming you don't use enough rounds that your infrastructure is spending a majority of its CPU-time only performing psuedoanonymizing hashing.

Oh, and if you use per-row salts, is any of that data still usable in the first place?

The above is besides the point of the IPv4 address space being small enough to exhaust and shows why this is an issue for IPv6 addresses as well.

Re:Companies must stop using Google Analytics by jameshart on Tuesday July 04, 2023 @11:12AM (#36587737)
If it's shared, it's not a salt.

The term of art in that case is 'pepper'.

Re:Companies must stop using Google Analytics by 3np on Tuesday July 04, 2023 @01:09PM (#36589536)
First time I hear this interpretation. A shared salt is still a (very poor) salt. A pepper would not be stored alongside the ciphertexts, if at all.
Re:Companies must stop using Google Analytics by antod on Tuesday July 04, 2023 @06:33PM (#36593367)
Isn't it the other way around? Most salted hash implementations share the salt by embedding it in the hash. It's pepper that isn't shared.

After rereading, I suspect by 'shared' you meant 'non unique' rather than 'public'?

Re:Companies must stop using Google Analytics by jameshart on Thursday July 06, 2023 @09:03AM (#36615120)
Why would ‘shared’ mean ‘public’? And in most password hashing contexts the salt and hash are not ‘public’ either.
Re:Companies must stop using Google Analytics by michaelcampbell on Wednesday July 05, 2023 @08:57AM (#36599780)
That's backwards.

> In cryptography, a pepper is a secret added to an input such as a password during hashing with a cryptographic hash function. This value differs from a salt in that it is not stored alongside a password hash, but rather the pepper is kept separate in some other medium, such as a Hardware Security Module.

https://en.wikipedia.org/wiki/Pepper_(cryptography)

Re:Companies must stop using Google Analytics by jameshart on Wednesday July 05, 2023 @05:21PM (#36607330)
Apparently we understand words differently.

A salt is a unique random value added to each value when hashing. Obviously, such a salt needs to be stored alongside each value because it’s random and unique. If you don’t store it how could you possibly ever figure out what it is?

A pepper is a shared value added to lots of different things before they are hashed. It isn’t unique to each value, so it doesn’t need to be stored alongside them. Although it still needs to be stored somewhere. But hey, you could also store it alongside every value you store. This is a thing sometimes done when you do ‘per user’ pepper, where for example the pepper is itself a a username or something - so your pepper is also in the database alongside the passwords - but that doesn’t make it a salt.

If you are using the same piece of data to season multiple things before hashing, you are using ‘pepper’ not ‘salt’.

Re:Companies must stop using Google Analytics by 3np on Wednesday July 05, 2023 @07:44PM (#36608857)
I think you may be alone in understanding the words "pepper" and "salt" this way.
Re:Companies must stop using Google Analytics by jameshart on Thursday July 06, 2023 @09:08AM (#36615174)
Try reading the rest of the Wikipedia article beyond the first paragraph. Particularly the section on ‘shared-secret pepper’ and ‘unique pepper per user’.
Re:Companies must stop using Google Analytics by tjoff on Tuesday July 04, 2023 @10:01AM (#36586804)
You need to protect it from yourself.

If you know the salt then you can trivially brute-force it yourself and now you are not GDPR-compliant.

If you don't know the salt then you'll have to use a new salt for each IP and then all hashed IPs will be unique and you have no way of correlating them so it is all completely worthless.

Re:Companies must stop using Google Analytics by sweetjuly on Tuesday July 04, 2023 @10:52AM (#36587517)
The salt is stored in plaintext alongside the hash and simply concatenated. If your scheme, for example, is h := H(ip, salt) := sha256(ip :: salt), bruteforcing is simply a matter of trying all values of ip:

    for i in 0..<(1<<32):
        if H(i, salt) == h:
            return i
Re:Companies must stop using Google Analytics by worksonmine on Tuesday July 04, 2023 @11:32AM (#36588030)
The salt doesn't have to be plain-text, that's an implementation detail in the common password hashing algorithms for obvious reasons. The requirement was that the hash should be non-reversible. Store the salt in a (http-only) session cookie and concatenate it to the IP before the hashing rounds. Put your entropy in the salt and any brute-force attempt is theoretical. For every session you need to compute the exact combination of IP + salt (which isn't even known to the server).
Re:Companies must stop using Google Analytics by 3np on Tuesday July 04, 2023 @01:13PM (#36589591)
At that point, what value does the salted+hashed IP address give you over a randomly generated number (say, a UUID) per session?
Re:Companies must stop using Google Analytics by worksonmine on Tuesday July 04, 2023 @01:44PM (#36590067)
None, I'm not arguing for the solution. Proxying through a PHP script just to keep using Google Analytics is overkill when private self-hosted solutions exist. I'm simply showing how you can anonymize IPs even from yourself, if the goal is to anonymize from only Google and not the server it could be useful across sessions.

The solution being overkill does not mean my first comment 'That's why you use a salt, which is what I assume is meant by "non-reversibly"' is wrong.

Re:Companies must stop using Google Analytics by jeltz on Tuesday July 04, 2023 @08:42AM (#36585909)
I have not researched it but I wonder if you can even hash IPv6 addresses. The issue I see is that allocations could be too regular so even if the full space is huge most addresses may occupy a small and predictable part of it.
Re:Companies must stop using Google Analytics by pixl97 on Tuesday July 04, 2023 @11:23AM (#36587890)
Depends how you define IP in this sense. Each full individual IPv6, unlikely as most consumer devices are getting a somewhat random internal address on their network.

Now, with IPv6 for most consumers the first 64 bits is generally enough to define the edge network device that would be covered by a single IPv4 these days.

Re:Companies must stop using Google Analytics by marcosdumay on Tuesday July 04, 2023 @01:24PM (#36589777)
> the first 64 bits is generally enough to define the edge network

One complication is that hashing removes this structure. If you use any good algorithm, you will need to test the entire address to recover any part of it.

I am very wary of IPv6 addresses being so heavily biased into 00 or ff segments that the address space doesn't actually add much entropy. So, I'd go with no, it's not safe to hash them. But if you get some random ones, I am really not sure.

Re:Companies must stop using Google Analytics by zyx321 on Tuesday July 04, 2023 @11:32AM (#36588034)
How about this:

Server-wide salt. Randomly generated every 24h or server reboot (whichever is sooner).

The salt is not saved alongside the hashed IP, it is not saved anywhere whatsoever. There is no log of previous salts.

You can still track a user session across multiple page calls, but the hash can not track them across different sites.

Re:Companies must stop using Google Analytics by jonasb on Tuesday July 04, 2023 @09:30AM (#36586382)
Hashing the IP is not enough by IMY's decisions, none of the companies are allowed to use GA going forward.

CDON used GA's IP anonymization through truncation, it was not deemed enough. [1] The IP itself becomes is not personal data after truncation but it's unclear if the truncation happens before it leaves the country. And combined with the other personal data (e.g. cookies), it is considered personal data. [2]

Coop proxied all calls to GA and use the same generic IP address for all users. [3] They don't get a fine but have to stop using GA.

[1] "1.3.15 Effektiviteten hos vidtagna skyddsåtgärder av Google och CDON" https://www.imy.se/globalassets/dokument/beslut/2023/beslut-...

[2] "2.2.2 Integritetsskyddsmyndighetens bedömning" https://www.imy.se/globalassets/dokument/beslut/2023/beslut-...

[3] "1.3.14.2 Coops implementering av server side container" https://www.imy.se/globalassets/dokument/beslut/2023/beslut-...

Re:Companies must stop using Google Analytics by jefftk on Tuesday July 04, 2023 @11:47AM (#36588253)
Automated translation of 1.3.14.2:

1.3.14.2 Coop's implementation of the server side container The purpose of the server side container that Coop has implemented is to improve the security related to the data sent. More specifically, the aim is to on a good and safely be able to protect the personal privacy of those registered. Server side the container acts as a proxy between the registrant's browser and the Tool where Coop has chosen to implement the server side container in a way that makes them the registered browser's public IP address is never transmitted to the Tool. Implementation can be described as follows. A registrant visits the website www.coop.se in your browser. The Google Analytics script is downloaded from the server side container instead of being downloaded directly from Google Analytics servers. This results in the registrant's IP address as well as information about user behavior, device information, customer status, online identifiers and transaction data (according to points 1–5 above under section 1.3.10) are transferred to the server side container, instead directly to Google Analytics. Once the Google Analytics script has been downloaded from the server side container, a new call is made from the server side container to Google Analytics servers. Since the call is made from the server side container, no transfer of the registrant's public IP address to Google Analytics. Coop has configured the server side container in such a way that all data as above, except it was recorded public IP address, passes through the server side container to Google Analytics. Google Analytics receives data sent from the server side container and that data (information) that has been sent is popularized in reports by the measurement set up on the website www.coop.se. The treatments that take place through the aforementioned – i.e. to receive, convert and forward the call - takes place in the working memory of the server side container. It means all processing takes place in real time and that no data is permanently stored. In other words, stored public IP addresses were not registered in the server side container and they are not exposed rather against Google Analytics servers. All communication from the browser, via server side container, to The tool is also encrypted.

This process cannot be reversed as the information is not stored and the conversion not based on a one-to-one relationship that enables the use of a "key" to recreate the public IP addresses. Coop has activated Google's function for IP anonymization. It means that the IP address sent to the Tool is truncated. This is done by Google removing one part of the IP address before the IP address is stored on disk. For an IPv4 address, last is replaced the octet in the address with a zero. For an IPv6 address, the last 80 bits are replaced with zeros. The action cannot be reversed but as this action is done by Google i Coop has also chosen to implement the tool as a server side container. In Coop's case, the IP anonymization feature is enabled and applied to the generic IP address sent via the server side container. In context, however, the function is redundant considering that the server side container prevents the public of the registered IP addresses from being sent to the Tool. Coop's assessment is that server side the container as a measure is a sufficient protective measure, but that it does not harm that even have the IP anonymization function activated in the Tool.

Do you happen to know which section of the ruling it is where they discuss why Coop needs to stop doing this? It's a PDF and the translation tool I'm using on my phone is a pain.

Re:Companies must stop using Google Analytics by otippat on Tuesday July 04, 2023 @03:44PM (#36591665)
In section 2.2.2 they expand on their reasoning. The claim is basically that unique identifiers stored in cookies ("_gads", "_ga" and "_gid") (they also mention more unique identifiers in the same context in section 2.4.2.3.2) together with information about the page that was visited, the visitors browser fingerprint and the generic IP address can be used to identify individual users.
Re:Companies must stop using Google Analytics by jhpacker on Tuesday July 04, 2023 @09:36AM (#36586457)
One of the sites (coop.se) in this decision did use a server-side GTM container to mask the IP before it was sent to Google, but they were still told to stop using GA, but they weren't fined. The DPA said that the _gads, _ga, and _gid cookies were enough to be identifiable. I don't follow the logic there, but that rules out using a proxy for compliance (at least done as coop did it).
Re:Companies must stop using Google Analytics by nazka on Tuesday July 04, 2023 @02:19PM (#36590612)
My company is Matomo too and wanted to use it to track how the user uses the WebApp. But Custom Actions are deprecated and Custom Dimensions are not made for that. Do you use any analytic tool to track what the users are doing that is GRPD compliant?

I am looking for something where I can track which button he pressed, how many times, which part of the app are the most used and underused, do some funnel of the happy paths, things like that. Like not to know who is the user but really app based and how the user uses the app. Before I used to use Google Tag Manager for that. But it’s not GRPD compliant so I can’t use it.

Re:Companies must stop using Google Analytics by pyrale on Tuesday July 04, 2023 @04:53PM (#36592389)
Depending on your knowledge of the browser, it's not extremely hard to rollout your own barebone analytics.

If you're only interested in session data without collecting any cross-session knowledge, all you have to do, basically, is tag your page and listen to dom events.

Re:Companies must stop using Google Analytics by ukuina on Wednesday July 05, 2023 @03:14AM (#36596718)
A, especially, is atrocious and caused multiple small companies I know to ditch GA entirely. They had years of GA data that is impossible to export without BigQuery shenanigans.

It is impossible to believe a team as well-funded as Analytics could/would not find a way to automatically migrate gtag.js to GA4. They should have made the upgrade transparent by simply converting requests behind the scenes so legacy analytics properties could exist perpetually, while forcing new property registrations to use GA4.