DEV Community

Cover image for A 301 instead of a 302 made Loomio mark new sign-ups as Gravatar users
Taku Kanaya for WolfBoy

Posted on Edited on Originally published at innit-llc.github.io

A 301 instead of a 302 made Loomio mark new sign-ups as Gravatar users

TL;DR: Until 3.12.0, Loomio sent an MD5 hash of each new sign-up's email address to Gravatar over plain HTTP, to ask whether the person had a picture, and treated any answer but a 302 as "yes". Loomio's check hadn't changed since 2012; Gravatar's server had. Sometime in 2023 it began answering plain HTTP with a 301 redirect to HTTPS, so from then on instances reaching it directly on port 80 marked new sign-ups as Gravatar users and put their hashes, which can be cracked by guessing, in avatar URLs seen by other members and, in non-private discussions, by logged-out visitors. I reported it on 20 October 2026, and 3.12.0 removed the lookup two days later.

In late September I ran a static-analysis and LLM review tool I'm building on Loomio v3.9.0. Loomio is an open-source app for group decisions. The tool flagged one method as sending a hash of an email address to a third party that isn't disclosed.

The method is eleven lines long, in app/models/concerns/has_avatar.rb:

def has_gravatar?(options = {})
  return false if Rails.env.test?
  hash = Digest::MD5.hexdigest(email.to_s.downcase)
  options = { :rating => 'x', :timeout => 2 }.merge(options)
  http = Net::HTTP.new('www.gravatar.com', 80)
  http.read_timeout = options[:timeout]
  response = http.request_head("/avatar/#{hash}?rating=#{options[:rating]}&default=http://gravatar.com/avatar")
  response.code != '302'
rescue StandardError, Timeout::Error
  false  # Don't show "gravatar" if the service is down or slow
end
Enter fullscreen mode Exit fullscreen mode

It asks Gravatar whether this email address has a picture. A redirect to the default image (a 302) means no. The port-80 request and the '302' comparison date from a 2012 commit.

Reading it properly

I read the code around it and three things stood out before I ran anything.

The first was the transport. The port is 80 and use_ssl is never set, so the MD5 of the address travels in the request path, in cleartext.

The second was the caller. has_gravatar? runs from before_create :set_default_avatar_kind, which means it runs when a user row is created: self sign-up, first SSO login, trial sign-up. For self sign-up the row is created when the address is submitted on the form, before anyone has verified it.

The third was the last line of the method, response.code != '302', which counts everything that isn't a 302 as "has a Gravatar".

Running it

I copied the method body into a script, removed the test-environment guard, added two puts lines, and put the same request over HTTPS next to it. I used two addresses on the reserved .invalid TLD (the first is shown). I didn't touch loomio.com or any other live instance.

ruby 3.3.9, net-http 0.4.1, 2026-10-20 08:08:10 UTC
nobody-1@example.invalid md5=bbcdd833ef228897b40575bcd6f25cf5
  port 80 -> response.code="301" (String) location=https://www.gravatar.com/avatar/bbcdd833ef228897b40575bcd6f25cf5?rating=x&default=http://gravatar.com/avatar
  has_gravatar? as written (port 80) => true
  port 443 -> response.code="302"
  same check over HTTPS              => false
Enter fullscreen mode Exit fullscreen mode

The method returned true for an address that cannot exist. Over HTTPS, Gravatar still answers 302 for "no picture". Over port 80 it answers 301 and points at the same URL on HTTPS. Net::HTTP#request_head doesn't follow redirects, so the code sees the string "301", and "301" != "302" is true.

The Internet Archive has a plain-HTTP avatar URL returning 200 on 2023-04-13 and a 301 to HTTPS on 2023-10-04, with nothing captured in between. Somewhere in that window the check started answering yes.

What that does to people

On a server that reaches www.gravatar.com directly on port 80, accounts created by sign-up, SSO or trial without an uploaded picture end up with avatar_kind = 'gravatar'. Their avatar URL becomes https://secure.gravatar.com/avatar/<md5>.png?d=retro&r=pg&s=128.

That URL then goes wherever the avatar goes: other members, notification emails, Microsoft Teams webhooks, Matrix chatbot messages. For authors and commenters in non-private discussions it goes to logged-out visitors too, in the JSON and in the server-rendered HTML. Every browser or mail client that loads the image sends Gravatar the viewer's IP address along with the member's hash. None of these people chose Gravatar, and there was no setting to turn it off.

An MD5 of an email address is not anonymous

You can't reverse a hash, but you can guess the input, and email addresses are guessable. At Hack.lu in 2013, Dominique Bongard crawled Gravatar hashes from a French political forum and recovered 70% of the addresses behind them [3]. Have I Been Pwned's Gravatar entry says 167 million MD5 hashes were scraped after a technique was published in October 2020, and 114 million of them cracked [4].

Gravatar's docs now ask for SHA-256 [6]. I don't think that changes much. A message on the oss-security list about a similar CVE makes the same point: both functions are fast to compute over guessed addresses [5]. That is why my report was about the cleartext request and about publishing hashes for people who never opted in, and not about the hash function.

How much this matters depends on who runs the instance, because Loomio is used by political parties and trade unions. Where the server's IP address identifies the instance, a network observer who knows, guesses or cracks the address learns that it was submitted there. It doesn't show that its owner submitted it, or that the sign-up was ever completed.

The report and the fix

I reported it privately through GitHub on 20 October. The maintainers committed the fix the next day and released 3.12.0 with the advisory on the 22nd, two days after the report.

They did what I had put first in my suggestions and deleted the lookup. The fix commit removes has_gravatar? and leaves this [2]:

def set_default_avatar_kind
  if uploaded_avatar.attached?
    self.avatar_kind = :uploaded
  else
    self.avatar_kind = :initials
  end
end
Enter fullscreen mode Exit fullscreen mode

New accounts get initials, and Gravatar is something you select in your profile settings. The same commit stops the profile form from loading a Gravatar preview in the browser, and adds tests asserting that no request goes to gravatar.com.

It does not touch existing accounts. The release notes say existing Gravatar selections are preserved [7], and nothing in the users table distinguishes a real selection from one the old check made. I had no good answer for this in my report either: re-checking every account would send every hash to Gravatar again. If you ran an instance before 3.12.0, that part is still yours to decide.

What to check in your own code

Search for comparisons against a single status code from someone else's server, especially negated ones. != '302' and == 200 are different bets. The second fails towards "no" when the other side changes, and for a privacy decision I think that is the only acceptable direction.

Search for Net::HTTP.new(host, 80) and for http:// in URLs your server requests. A redirect to HTTPS does not protect you, because the path has already gone out by the time the redirect comes back.

Look at what runs in before_create and similar callbacks. In Loomio, the call to Gravatar went out as soon as an address was submitted on the sign-up form.

Check, too, whether the code is skipped under test, as this method was by its first line.

The advisory

  • Project: Loomio (loomio/loomio)
  • Affected versions: 3.11.1 and earlier
  • Fixed in: 3.12.0
  • Advisory: GHSA-55qv-f272-488r [1]
  • Severity as published: Medium (CVSS 4.0 base score 6.9)
  • Published: 22 October 2026

Sources

  1. Loomio security advisory GHSA-55qv-f272-488r, published 22 October 2026: https://github.com/loomio/loomio/security/advisories/GHSA-55qv-f272-488r
  2. Loomio, fix commit 9ad26cd: https://github.com/loomio/loomio/commit/9ad26cd089805461ae45d07cfbfb8d697f73a5e3
  3. Dominique Bongard, "De-anonymizing Users of French Political Forums", Hack.lu 2013 (slides): https://archive.hack.lu/2013/dbongard_hacklu_2013.pdf
  4. Have I Been Pwned, Gravatar entry (added 5 December 2021): https://haveibeenpwned.com/Breach/Gravatar
  5. oss-security, 25 September 2024, on CVE-2024-40761: https://www.openwall.com/lists/oss-security/2024/09/25/5
  6. Gravatar documentation, "Creating identifier (hash)": https://docs.gravatar.com/rest/hash/
  7. Loomio v3.12.0 release notes: https://github.com/loomio/loomio/releases/tag/v3.12.0

This is a developer's account of a published advisory, not legal advice.

This article was written with AI assistance and checked against the official sources listed above.

More cases like this, from the decision down to the code: our blog.

Top comments (0)