<?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: Ileana Barrionuevo</title>
    <description>The latest articles on DEV Community by Ileana Barrionuevo (@acciobugs).</description>
    <link>https://dev.to/acciobugs</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%2F395378%2F71f379ab-c8f0-4976-9485-1ce429a31cb3.jpeg</url>
      <title>DEV Community: Ileana Barrionuevo</title>
      <link>https://dev.to/acciobugs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/acciobugs"/>
    <language>en</language>
    <item>
      <title>🐛 The bug: Improper Access Control (IDOR) in Calibre-Web</title>
      <dc:creator>Ileana Barrionuevo</dc:creator>
      <pubDate>Tue, 04 Aug 2026 18:17:23 +0000</pubDate>
      <link>https://dev.to/acciobugs/the-bug-improper-access-control-idor-in-calibre-web-1395</link>
      <guid>https://dev.to/acciobugs/the-bug-improper-access-control-idor-in-calibre-web-1395</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/bugsmash"&gt;DEV's Summer Bug Smash: Smash Stories&lt;/a&gt; powered by &lt;a href="https://sentry.io/" rel="noopener noreferrer"&gt;Sentry&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;While auditing &lt;strong&gt;janeczku/calibre-web&lt;/strong&gt;, an open-source web application for browsing, reading, and downloading eBooks stored in a Calibre database, I identified an Insecure Direct Object Reference (IDOR) vulnerability (CWE-284) rated &lt;strong&gt;High Severity (CVSS 8.1)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The issue allowed any authenticated user to edit the titles of bookshelf collections owned by other users across the application.&lt;/p&gt;




&lt;h2&gt;
  
  
  🏆 Bounty milestone
&lt;/h2&gt;

&lt;p&gt;I'm excited to share that this report earned &lt;strong&gt;both disclosure and fix bounties&lt;/strong&gt; on the &lt;a href="https://huntr.com/" rel="noopener noreferrer"&gt;Huntr&lt;/a&gt; bug bounty platform!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Discovery &amp;amp; disclosure bounty:&lt;/strong&gt; awarded for uncovering and detailing the initial IDOR vulnerability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Fix bounty:&lt;/strong&gt; awarded for authoring and submitting the patch directly upstream to resolve the issue in the codebase.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🕵️‍♂️ Technical deep dive &amp;amp; discovery
&lt;/h2&gt;

&lt;p&gt;The vulnerability existed within the shelf routing logic inside &lt;code&gt;cps/shelf.py&lt;/code&gt; (specifically at line 237).&lt;/p&gt;

&lt;p&gt;When a user submitted an edit for a shelf, the &lt;code&gt;edit_shelf&lt;/code&gt; route queried the database strictly using the &lt;code&gt;shelf_id&lt;/code&gt; passed directly from the URL path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@shelf.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/shelf/edit/&amp;lt;int:shelf_id&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;methods&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GET&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;POST&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nd"&gt;@login_required&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;edit_shelf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;shelf_id&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;shelf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ub&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ub&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Shelf&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ub&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Shelf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;shelf_id&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;create_edit_shelf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;shelf&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;_&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;u&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Edit a shelf&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;shelfed&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the application failed to verify whether the logged-in user actually owned the queried &lt;code&gt;shelf_id&lt;/code&gt; before passing it to &lt;code&gt;create_edit_shelf()&lt;/code&gt;, authorization checks were bypassed completely.&lt;/p&gt;

&lt;h3&gt;
  
  
  Proof of Concept (PoC)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Log in as User A.&lt;/li&gt;
&lt;li&gt;Navigate to your own shelf at &lt;code&gt;/shelf/edit/2&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Intercept the outbound &lt;code&gt;POST&lt;/code&gt; request and modify the path parameter from &lt;code&gt;/shelf/edit/2&lt;/code&gt; to &lt;code&gt;/shelf/edit/1&lt;/code&gt; (which belongs to User B).&lt;/li&gt;
&lt;li&gt;Submit the request. The server accepts the payload and overwrites User B's shelf title.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🛠️ The fix
&lt;/h2&gt;

&lt;p&gt;To remediate the vulnerability, a proper ownership check needed to be enforced before any shelf modification logic executed.&lt;/p&gt;

&lt;p&gt;In &lt;a href="https://www.google.com/search?q=https://github.com/janeczku/calibre-web/commit/c7b057ec5179c1436c26464023e599b2f85c7cd7" rel="noopener noreferrer"&gt;Commit `c7b057e&lt;/a&gt;`, the routing logic was updated to validate that either:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The currently authenticated user is the owner of the shelf (&lt;code&gt;shelf.user_id == current_user.id&lt;/code&gt;), OR&lt;/li&gt;
&lt;li&gt;The shelf is public/the user holds administrative privileges allowing edits.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Updated authorization check enforcing ownership validation
&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;shelf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_public&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;shelf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;current_user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;current_user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;role_admin&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="nf"&gt;flash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;_&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;u&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Sorry you are not allowed to edit this shelf&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;error&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;url_for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;web.index&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If an unauthorized user attempts to manipulate the path parameter, the request is denied, an error notification is flashed, and the user is redirected safely.&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Never trust path parameters for access control:&lt;/strong&gt; resource identifiers passed via parameters must always be validated against the active session user's permissions backend-side.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Full-cycle security contributions:&lt;/strong&gt; uncovering security flaws is impactful, but submitting valid code patches to open-source maintainers—and earning a fix bounty along the way—makes the open-source ecosystem far more resilient.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Associated links
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Repository:&lt;/strong&gt; &lt;a href="https://github.com/janeczku/calibre-web" rel="noopener noreferrer"&gt;janeczku/calibre-web&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Fix commit:&lt;/strong&gt; &lt;a href="https://www.google.com/search?q=https://github.com/janeczku/calibre-web/commit/c7b057ec5179c1436c26464023e599b2f85c7cd7" rel="noopener noreferrer"&gt;Commit c7b057e&lt;/a&gt; - merged from &lt;a href="https://github.com/acciobugs/calibre-web/commit/c8ebaee0f76d5b404cd2d5fd17df9f27795abc49" rel="noopener noreferrer"&gt;Ileana's commit&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Huntr bounty report:&lt;/strong&gt; &lt;a href="https://www.google.com/search?q=https://huntr.com/bounties/458c313f-77d4-4f09-aef4-d42edd04494c" rel="noopener noreferrer"&gt;Bounty #458c313f&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devchallenge</category>
      <category>bugsmash</category>
      <category>bugbounty</category>
      <category>hacking</category>
    </item>
  </channel>
</rss>
