<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Taku Kanaya</title>
    <description>The latest articles on DEV Community by Taku Kanaya (@lopal_info_b25363b0db09e).</description>
    <link>https://dev.to/lopal_info_b25363b0db09e</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4183254%2F20e9dda1-43d6-498f-bf08-ff57d12f099a.png</url>
      <title>DEV Community: Taku Kanaya</title>
      <link>https://dev.to/lopal_info_b25363b0db09e</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lopal_info_b25363b0db09e"/>
    <language>en</language>
    <item>
      <title>A 301 instead of a 302 made Loomio mark new sign-ups as Gravatar users</title>
      <dc:creator>Taku Kanaya</dc:creator>
      <pubDate>Tue, 17 Nov 2026 05:06:03 +0000</pubDate>
      <link>https://dev.to/wolfboy_ai/a-301-instead-of-a-302-made-loomio-mark-new-sign-ups-as-gravatar-users-1f4o</link>
      <guid>https://dev.to/wolfboy_ai/a-301-instead-of-a-302-made-loomio-mark-new-sign-ups-as-gravatar-users-1f4o</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;The method is eleven lines long, in &lt;code&gt;app/models/concerns/has_avatar.rb&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;has_gravatar?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nc"&gt;Rails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;test?&lt;/span&gt;
  &lt;span class="n"&gt;hash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Digest&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;MD5&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hexdigest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;to_s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;downcase&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;:rating&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'x'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:timeout&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;merge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;http&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Net&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;HTTP&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'www.gravatar.com'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read_timeout&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:timeout&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;request_head&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/avatar/#{hash}?rating=#{options[:rating]}&amp;amp;default=http://gravatar.com/avatar"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s1"&gt;'302'&lt;/span&gt;
&lt;span class="k"&gt;rescue&lt;/span&gt; &lt;span class="nc"&gt;StandardError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Timeout&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Error&lt;/span&gt;
  &lt;span class="kc"&gt;false&lt;/span&gt;  &lt;span class="c1"&gt;# Don't show "gravatar" if the service is down or slow&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h2&gt;
  
  
  Reading it properly
&lt;/h2&gt;

&lt;p&gt;I read the code around it and three things stood out before I ran anything.&lt;/p&gt;

&lt;p&gt;The first was the transport. The port is 80 and &lt;code&gt;use_ssl&lt;/code&gt; is never set, so the MD5 of the address travels in the request path, in cleartext.&lt;/p&gt;

&lt;p&gt;The second was the caller. &lt;code&gt;has_gravatar?&lt;/code&gt; runs from &lt;code&gt;before_create :set_default_avatar_kind&lt;/code&gt;, 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.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Running it
&lt;/h2&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ruby 3.3.9, net-http 0.4.1, 2026-10-20 08:08:10 UTC
nobody-1@example.invalid md5=bbcdd833ef228897b40575bcd6f25cf5
  port 80 -&amp;gt; response.code="301" (String) location=https://www.gravatar.com/avatar/bbcdd833ef228897b40575bcd6f25cf5?rating=x&amp;amp;default=http://gravatar.com/avatar
  has_gravatar? as written (port 80) =&amp;gt; true
  port 443 -&amp;gt; response.code="302"
  same check over HTTPS              =&amp;gt; false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

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

&lt;h2&gt;
  
  
  What that does to people
&lt;/h2&gt;

&lt;p&gt;On a server that reaches &lt;a href="http://www.gravatar.com" rel="noopener noreferrer"&gt;www.gravatar.com&lt;/a&gt; directly on port 80, accounts created by sign-up, SSO or trial without an uploaded picture end up with &lt;code&gt;avatar_kind = 'gravatar'&lt;/code&gt;. Their avatar URL becomes &lt;code&gt;https://secure.gravatar.com/avatar/&amp;lt;md5&amp;gt;.png?d=retro&amp;amp;r=pg&amp;amp;s=128&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  An MD5 of an email address is not anonymous
&lt;/h2&gt;

&lt;p&gt;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].&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  The report and the fix
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;They did what I had put first in my suggestions and deleted the lookup. The fix commit removes &lt;code&gt;has_gravatar?&lt;/code&gt; and leaves this [2]:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;set_default_avatar_kind&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;uploaded_avatar&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;attached?&lt;/span&gt;
    &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;avatar_kind&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="ss"&gt;:uploaded&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;avatar_kind&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="ss"&gt;:initials&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;It does not touch existing accounts. The release notes say existing Gravatar selections are preserved [7], and nothing in the &lt;code&gt;users&lt;/code&gt; 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.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to check in your own code
&lt;/h2&gt;

&lt;p&gt;Search for comparisons against a single status code from someone else's server, especially negated ones. &lt;code&gt;!= '302'&lt;/code&gt; and &lt;code&gt;== 200&lt;/code&gt; 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.&lt;/p&gt;

&lt;p&gt;Search for &lt;code&gt;Net::HTTP.new(host, 80)&lt;/code&gt; and for &lt;code&gt;http://&lt;/code&gt; 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.&lt;/p&gt;

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

&lt;p&gt;Check, too, whether the code is skipped under test, as this method was by its first line.&lt;/p&gt;

&lt;h2&gt;
  
  
  The advisory
&lt;/h2&gt;

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

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

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

&lt;p&gt;&lt;em&gt;This is a developer's account of a published advisory, not legal advice.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was written with AI assistance and checked against the official sources listed above.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;More cases like this, from the decision down to the code: &lt;a href="https://innit-llc.github.io/blog/" rel="noopener noreferrer"&gt;our blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>security</category>
      <category>ruby</category>
      <category>rails</category>
      <category>privacy</category>
    </item>
  </channel>
</rss>
