<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://busolbuse.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://busolbuse.github.io/" rel="alternate" type="text/html" /><updated>2026-11-27T07:12:46+00:00</updated><id>https://busolbuse.github.io/feed.xml</id><title type="html">Buse Berren ÜNAL</title><subtitle>Vulnerability research, CVE write-ups and security tooling.</subtitle><author><name>Buse Berren ÜNAL</name></author><entry xml:lang="en"><title type="html">SSRF in Pinry pin creation (fixed in v2.1.15)</title><link href="https://busolbuse.github.io/2026/11/27/ssrf-in-pinry-pin-creation/" rel="alternate" type="text/html" title="SSRF in Pinry pin creation (fixed in v2.1.15)" /><published>2026-11-27T00:00:00+00:00</published><updated>2026-11-27T00:00:00+00:00</updated><id>https://busolbuse.github.io/2026/11/27/ssrf-in-pinry-pin-creation</id><content type="html" xml:base="https://busolbuse.github.io/2026/11/27/ssrf-in-pinry-pin-creation/"><![CDATA[<p>Pinry’s “create a pin from a URL” feature fetched the user-supplied address server-side with no validation
at all. Any signed-in user — and, because registration is open by default, effectively anyone — could make
the Pinry server send requests to <code class="language-plaintext highlighter-rouge">localhost</code>, hosts on its private network, or cloud metadata services.
This was a <strong>Server-Side Request Forgery (SSRF)</strong>. I reported it privately and the project fixed it in
<strong>v2.1.15</strong>.</p>

<h2 id="summary">Summary</h2>

<table>
  <thead>
    <tr>
      <th> </th>
      <th> </th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Project</td>
      <td><a href="https://github.com/pinry/pinry">pinry/pinry</a></td>
    </tr>
    <tr>
      <td>Affected versions</td>
      <td>&lt;= 2.1.14</td>
    </tr>
    <tr>
      <td>Fixed version</td>
      <td>2.1.15</td>
    </tr>
    <tr>
      <td>Type</td>
      <td>CWE-918 Server-Side Request Forgery</td>
    </tr>
    <tr>
      <td>Severity</td>
      <td>Medium (CVSS 3.1 ~4.3)</td>
    </tr>
    <tr>
      <td>Fix</td>
      <td>commit <code class="language-plaintext highlighter-rouge">e2acdb6</code>, new <code class="language-plaintext highlighter-rouge">core/fetch.py</code></td>
    </tr>
    <tr>
      <td>Advisory</td>
      <td><a href="https://github.com/pinry/pinry/releases/tag/v2.1.15">v2.1.15 release notes</a></td>
    </tr>
  </tbody>
</table>

<h2 id="what-is-pinry-and-what-does-this-feature-do">What is Pinry, and what does this feature do?</h2>

<p>Pinry is a self-hosted image board (Pinterest-like). You can add a pin either by uploading a file or by
giving a <strong>URL</strong>. In the second case the server downloads the image from that address itself. That is where
the bug lived.</p>

<h2 id="root-cause">Root cause</h2>

<p>Pin creation passed the <code class="language-plaintext highlighter-rouge">url</code> field straight into an HTTP request. The relevant code (<code class="language-plaintext highlighter-rouge">core/models.py</code>):</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">def</span> <span class="nf">create_for_url</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">url</span><span class="p">,</span> <span class="n">referer</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">owner</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
    <span class="n">file_name</span> <span class="o">=</span> <span class="n">url</span><span class="p">.</span><span class="n">split</span><span class="p">(</span><span class="s">"/"</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">].</span><span class="n">split</span><span class="p">(</span><span class="s">'#'</span><span class="p">)[</span><span class="mi">0</span><span class="p">].</span><span class="n">split</span><span class="p">(</span><span class="s">'?'</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
    <span class="n">buf</span> <span class="o">=</span> <span class="n">BytesIO</span><span class="p">()</span>
    <span class="n">headers</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">_default_ua</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">referer</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
        <span class="n">headers</span><span class="p">[</span><span class="s">"Referer"</span><span class="p">]</span> <span class="o">=</span> <span class="n">referer</span>
    <span class="n">response</span> <span class="o">=</span> <span class="n">requests</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span><span class="p">)</span>   <span class="c1"># &lt;-- no validation
</span>    <span class="p">...</span>
</code></pre></div></div>

<p>The call path was:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>POST /api/v2/pins/            (PinViewSet)
  -&gt; PinSerializer.create()   url = validated_data['url']
  -&gt; Image.objects.create_for_url(url, ...)
  -&gt; requests.get(url)        # SINK
</code></pre></div></div>

<p><code class="language-plaintext highlighter-rouge">requests.get()</code> was called with defaults, which means:</p>

<ul>
  <li><strong>no check</strong> on the scheme or the target IP;</li>
  <li><code class="language-plaintext highlighter-rouge">requests</code> <strong>follows redirects</strong> by default.</li>
</ul>

<p>If the response wasn’t a valid image, no pin was created, so the issue was blind in the classic sense: the
attacker couldn’t read the response body directly. But the difference between “image returned” and “error”
is observable, which is enough to probe internal services and ports (semi-blind).</p>

<p>One detail widened the impact: Pinry ships with <strong>registration open by default</strong>
(<code class="language-plaintext highlighter-rouge">ALLOW_NEW_REGISTRATIONS = True</code>) and <code class="language-plaintext highlighter-rouge">PUBLIC = True</code>. So the attacker needs no special role — they can
register their own account and trigger the flow.</p>

<h2 id="verification-local-only">Verification (local only)</h2>

<p>I tested this only against a Pinry instance running on my own machine, with a listener also on my own
machine. No third-party system was touched.</p>

<p>Creating a pin as a test user with the <code class="language-plaintext highlighter-rouge">url</code> field pointing at my listener produced a request whose
User-Agent matched the hardcoded value in Pinry’s code exactly:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>HIT ... path=/ssrf-probe.png ua=Mozilla/5.0 (Windows NT 5.1) ...
</code></pre></div></div>

<p>That proved the request came from the <strong>Pinry server process</strong>, not from my test client.</p>

<p>I then checked redirect behaviour: my listener returned a <code class="language-plaintext highlighter-rouge">302</code> to a second local endpoint, and Pinry,
having received only the first address, followed the redirect and requested the second one too. This
matters, because a fix that validated only the user-submitted URL would not have been enough.</p>

<h2 id="the-fix">The fix</h2>

<p>The maintainer (winkidney) confirmed it quickly and shipped a thorough fix in v2.1.15, closely following
my suggestions. The new <code class="language-plaintext highlighter-rouge">core/fetch.py</code> now:</p>

<ul>
  <li>allows only <code class="language-plaintext highlighter-rouge">http</code> and <code class="language-plaintext highlighter-rouge">https</code>;</li>
  <li>refuses a host if any address it resolves to is not public (loopback, private, link-local, CGNAT and
IPv4-mapped IPv6 included);</li>
  <li>re-checks <strong>every redirect hop</strong>;</li>
  <li>checks the address actually connected to (against DNS rebinding);</li>
  <li>caps each fetch at 20 seconds and 50 MB.</li>
</ul>

<p>Admins who need to fetch from their own network (a NAS, say) can allow specific networks with the new
<code class="language-plaintext highlighter-rouge">IMAGE_FETCH_ALLOWED_NETWORKS</code> setting, which is empty by default. A refused fetch now returns a generic
<code class="language-plaintext highlighter-rouge">400</code>.</p>

<p>I tested the fix locally against v2.1.15: the same request is now refused with <code class="language-plaintext highlighter-rouge">HTTP 400</code> (“Cannot fetch
image from this URL.”), and no request reaches my listener — the server never opens the connection.</p>

<h2 id="takeaways">Takeaways</h2>

<ul>
  <li>Any feature that takes a URL from the user and fetches it server-side is a potential SSRF, including
innocent-looking ones like “download an image.”</li>
  <li>You can’t fix SSRF by validating only the input (the first URL). The right place is an IP check <strong>right
before connecting</strong>, applied on <strong>every redirect hop</strong>, and ideally enforced at connection time to defeat
DNS rebinding.</li>
  <li>Defaults decide the impact: open registration turns “any user” into “anyone on the internet.”</li>
</ul>

<h2 id="timeline">Timeline</h2>

<ul>
  <li>2026-11-26: Reported privately to the maintainer.</li>
  <li>2026-11-26: Maintainer confirmed and released v2.1.15.</li>
  <li>2026-11-27: Fix verified locally; this write-up published.</li>
</ul>

<p>Thanks to the Pinry maintainer for the quick and careful response.</p>]]></content><author><name>Buse Berren ÜNAL</name></author><summary type="html"><![CDATA[Pinry’s “create a pin from a URL” feature fetched the user-supplied address server-side with no validation at all. Any signed-in user — and, because registration is open by default, effectively anyone — could make the Pinry server send requests to localhost, hosts on its private network, or cloud metadata services. This was a Server-Side Request Forgery (SSRF). I reported it privately and the project fixed it in v2.1.15.]]></summary></entry><entry xml:lang="tr"><title type="html">Pinry’de Pin Oluştururken SSRF (v2.1.15’te düzeltildi)</title><link href="https://busolbuse.github.io/tr/2026/11/27/pinry-ssrf-pin-olustururken/" rel="alternate" type="text/html" title="Pinry’de Pin Oluştururken SSRF (v2.1.15’te düzeltildi)" /><published>2026-11-27T00:00:00+00:00</published><updated>2026-11-27T00:00:00+00:00</updated><id>https://busolbuse.github.io/tr/2026/11/27/pinry-ssrf-pin-olustururken</id><content type="html" xml:base="https://busolbuse.github.io/tr/2026/11/27/pinry-ssrf-pin-olustururken/"><![CDATA[<p>Pinry’nin “URL’den pin oluştur” özelliği, kullanıcının verdiği adresi sunucu tarafında hiçbir kontrol
yapmadan indiriyordu. Giriş yapmış herhangi bir kullanıcı (ve kayıt varsayılan olarak açık olduğu için
pratikte herkes) Pinry sunucusunu <code class="language-plaintext highlighter-rouge">localhost</code>‘a, iç ağdaki hostlara veya bulut metadata servislerine
istek atmaya zorlayabiliyordu. Bu bir <strong>Server-Side Request Forgery (SSRF)</strong> açığıydı. Sorumlu bildirimle
raporladım; proje <strong>v2.1.15</strong> ile düzeltti.</p>

<h2 id="özet">Özet</h2>

<table>
  <thead>
    <tr>
      <th> </th>
      <th> </th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Proje</td>
      <td><a href="https://github.com/pinry/pinry">pinry/pinry</a></td>
    </tr>
    <tr>
      <td>Etkilenen sürümler</td>
      <td>&lt;= 2.1.14</td>
    </tr>
    <tr>
      <td>Düzeltilen sürüm</td>
      <td>2.1.15</td>
    </tr>
    <tr>
      <td>Tür</td>
      <td>CWE-918 Server-Side Request Forgery</td>
    </tr>
    <tr>
      <td>Ciddiyet</td>
      <td>Medium (CVSS 3.1 ~4.3)</td>
    </tr>
    <tr>
      <td>Düzeltme</td>
      <td>commit <code class="language-plaintext highlighter-rouge">e2acdb6</code>, yeni <code class="language-plaintext highlighter-rouge">core/fetch.py</code></td>
    </tr>
    <tr>
      <td>Duyuru</td>
      <td><a href="https://github.com/pinry/pinry/releases/tag/v2.1.15">v2.1.15 sürüm notları</a></td>
    </tr>
  </tbody>
</table>

<h2 id="pinry-nedir-bu-özellik-ne-yapıyor">Pinry nedir, bu özellik ne yapıyor?</h2>

<p>Pinry, kendi sunucunda barındırdığın bir görsel panosu (Pinterest benzeri). Bir pin’i iki şekilde
ekleyebiliyorsun: ya bir dosya yükleyerek ya da bir <strong>URL vererek</strong>. İkinci yolda sunucu o adresteki
görseli kendisi indirip kaydediyor. İşte zafiyet buradaydı.</p>

<h2 id="kök-neden">Kök neden</h2>

<p>Pin oluşturma akışı, <code class="language-plaintext highlighter-rouge">url</code> alanını doğrudan bir HTTP isteğine veriyordu. İlgili kod (<code class="language-plaintext highlighter-rouge">core/models.py</code>):</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">def</span> <span class="nf">create_for_url</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">url</span><span class="p">,</span> <span class="n">referer</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">owner</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
    <span class="n">file_name</span> <span class="o">=</span> <span class="n">url</span><span class="p">.</span><span class="n">split</span><span class="p">(</span><span class="s">"/"</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">].</span><span class="n">split</span><span class="p">(</span><span class="s">'#'</span><span class="p">)[</span><span class="mi">0</span><span class="p">].</span><span class="n">split</span><span class="p">(</span><span class="s">'?'</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
    <span class="n">buf</span> <span class="o">=</span> <span class="n">BytesIO</span><span class="p">()</span>
    <span class="n">headers</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">_default_ua</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">referer</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
        <span class="n">headers</span><span class="p">[</span><span class="s">"Referer"</span><span class="p">]</span> <span class="o">=</span> <span class="n">referer</span>
    <span class="n">response</span> <span class="o">=</span> <span class="n">requests</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span><span class="p">)</span>   <span class="c1"># &lt;-- doğrulama yok
</span>    <span class="p">...</span>
</code></pre></div></div>

<p>Çağrı zinciri şöyleydi:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>POST /api/v2/pins/            (PinViewSet)
  -&gt; PinSerializer.create()   url = validated_data['url']
  -&gt; Image.objects.create_for_url(url, ...)
  -&gt; requests.get(url)        # SINK
</code></pre></div></div>

<p><code class="language-plaintext highlighter-rouge">requests.get()</code> varsayılan ayarlarla çağrılıyordu. Yani:</p>

<ul>
  <li>Şema (scheme) veya hedef IP için <strong>hiçbir kontrol yok</strong>.</li>
  <li><code class="language-plaintext highlighter-rouge">requests</code> varsayılan olarak <strong>yönlendirmeleri (redirect) takip eder</strong>.</li>
</ul>

<p>Dönen içerik geçerli bir görsel değilse pin oluşmuyordu. Bu yüzden açık klasik anlamda “blind”di:
saldırgan yanıtın gövdesini doğrudan okuyamıyordu. Ama “görsel döndü / hata döndü” farkı gözlemlenebildiği
için iç servisleri ve portları yoklamak mümkündü (semi-blind).</p>

<p>Bir ayrıntı etkiyi büyütüyordu: Pinry’de <strong>kayıt varsayılan olarak açık</strong> (<code class="language-plaintext highlighter-rouge">ALLOW_NEW_REGISTRATIONS = True</code>)
ve <code class="language-plaintext highlighter-rouge">PUBLIC = True</code>. Yani saldırganın özel bir yetkiye ihtiyacı yok; kendi hesabını açıp bu akışı tetikleyebilir.</p>

<h2 id="doğrulama-yalnızca-lokal">Doğrulama (yalnızca lokal)</h2>

<p>Açığı yalnızca kendi makinemde kurduğum bir Pinry örneğine ve yine kendi makinemdeki bir dinleyiciye karşı
test ettim. Üçüncü taraf hiçbir sisteme dokunmadım.</p>

<p>Bir test kullanıcısıyla pin oluştururken <code class="language-plaintext highlighter-rouge">url</code> alanına kendi dinleyicimin adresini verdim. Dinleyicinin
log’una düşen istek, Pinry’nin kodundaki sabit User-Agent değeriyle birebir aynıydı:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>HIT ... path=/ssrf-probe.png ua=Mozilla/5.0 (Windows NT 5.1) ...
</code></pre></div></div>

<p>Bu, isteği test istemcimin değil, <strong>Pinry sunucu sürecinin</strong> attığını kanıtlıyordu.</p>

<p>Ardından redirect davranışını ölçtüm: dinleyicim <code class="language-plaintext highlighter-rouge">302</code> ile ikinci bir lokal adrese yönlendirdi ve Pinry
yalnızca ilk adresi aldığı halde yönlendirmeyi takip edip ikinci adrese de gitti. Bu önemli, çünkü sadece
kullanıcının gönderdiği ilk URL’yi kontrol eden bir düzeltme yeterli olmazdı.</p>

<h2 id="düzeltme">Düzeltme</h2>

<p>Bakımcı (winkidney) açığı hızlıca doğruladı ve v2.1.15’te, önerdiğim yönde kapsamlı bir düzeltme yayınladı.
Yeni <code class="language-plaintext highlighter-rouge">core/fetch.py</code> artık:</p>

<ul>
  <li>yalnızca <code class="language-plaintext highlighter-rouge">http</code> ve <code class="language-plaintext highlighter-rouge">https</code> şemalarına izin veriyor;</li>
  <li>bir host’un çözümlendiği adreslerden herhangi biri public değilse (loopback, özel ağ, link-local,
CGNAT, IPv4-mapped IPv6 dahil) isteği reddediyor;</li>
  <li><strong>her yönlendirme adımını</strong> yeniden kontrol ediyor;</li>
  <li>gerçekten bağlanılan adresi de kontrol ediyor (DNS rebinding’e karşı);</li>
  <li>her indirmeyi 20 saniye ve 50 MB ile sınırlıyor.</li>
</ul>

<p>Kendi ağından (ör. bir NAS) görsel çekmesi gereken yöneticiler için varsayılanı boş olan yeni bir
<code class="language-plaintext highlighter-rouge">IMAGE_FETCH_ALLOWED_NETWORKS</code> ayarı eklendi. Reddedilen bir indirme artık genel bir mesajla <code class="language-plaintext highlighter-rouge">400</code> dönüyor.</p>

<p>Düzeltmeyi lokalde v2.1.15’e karşı test ettim: aynı istek artık <code class="language-plaintext highlighter-rouge">HTTP 400</code> (“Cannot fetch image from this
URL.”) ile reddediliyor ve dinleyicime hiçbir istek ulaşmıyor; yani sunucu bağlantıyı hiç kurmuyor.</p>

<h2 id="çıkarımlar">Çıkarımlar</h2>

<ul>
  <li>Kullanıcıdan URL alıp onu sunucu tarafında çeken her özellik potansiyel bir SSRF’tir. “Görsel indirme”
gibi masum görünen özellikler de buna dahil.</li>
  <li>SSRF’i yalnızca girdiyi (ilk URL’yi) kontrol ederek çözemezsin. Doğru yer, <strong>adresi çözümleyip bağlanmadan
hemen önce</strong> ve <strong>her redirect adımında</strong> IP kontrolü yapmaktır; ideal olarak bağlantı anında (DNS
rebinding’e karşı).</li>
  <li>Varsayılan ayarlar etkiyi belirler: açık kayıt, “herhangi bir kullanıcı” ile “herhangi bir internet
kullanıcısı”nı aynı şeye çevirir.</li>
</ul>

<h2 id="zaman-çizelgesi">Zaman çizelgesi</h2>

<ul>
  <li>2026-11-26: Bakımcıya özel olarak bildirildi.</li>
  <li>2026-11-26: Bakımcı doğruladı ve v2.1.15’i yayınladı.</li>
  <li>2026-11-27: Düzeltme lokalde doğrulandı, bu yazı yayınlandı.</li>
</ul>

<p>Hızlı ve özenli yanıtı için Pinry bakımcısına teşekkürler.</p>]]></content><author><name>Buse Berren ÜNAL</name></author><category term="tr" /><summary type="html"><![CDATA[Pinry’nin “URL’den pin oluştur” özelliği, kullanıcının verdiği adresi sunucu tarafında hiçbir kontrol yapmadan indiriyordu. Giriş yapmış herhangi bir kullanıcı (ve kayıt varsayılan olarak açık olduğu için pratikte herkes) Pinry sunucusunu localhost‘a, iç ağdaki hostlara veya bulut metadata servislerine istek atmaya zorlayabiliyordu. Bu bir Server-Side Request Forgery (SSRF) açığıydı. Sorumlu bildirimle raporladım; proje v2.1.15 ile düzeltti.]]></summary></entry></feed>