<?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://pranavhivarekar.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://pranavhivarekar.com/" rel="alternate" type="text/html" /><updated>2026-04-30T11:42:45+00:00</updated><id>https://pranavhivarekar.com/feed.xml</id><title type="html">Pranav Hivarekar</title><subtitle>Pranav Hivarekar&apos;s blog</subtitle><author><name>Pranav Hivarekar</name></author><entry><title type="html">Threat Modeling a Web Application With STRIDE — My Step-by-Step Process</title><link href="https://pranavhivarekar.com/threat-modeling-web-application-stride-step-by-step-process/" rel="alternate" type="text/html" title="Threat Modeling a Web Application With STRIDE — My Step-by-Step Process" /><published>2026-01-28T15:30:00+00:00</published><updated>2026-01-28T15:30:00+00:00</updated><id>https://pranavhivarekar.com/threat-modeling-web-application-stride-step-by-step-process</id><content type="html" xml:base="https://pranavhivarekar.com/threat-modeling-web-application-stride-step-by-step-process/"><![CDATA[<p><img src="/assets/images/posts/threat-modeling-stride-by-pranav-hivarekar.png" alt="threat-modeling-stride-by-pranav-hivarekar" /></p>

<p>I’ve been doing threat models for years now, and the one thing that annoys me is how everyone teaches it differently. Some people make it sound like a PhD exercise. Others oversimplify it to “just think like an attacker.” Neither helps when you’re sitting in a room with developers who need to ship a feature next week.</p>

<p>So I’m going to walk through my actual process. Not the theory — you can read Microsoft’s STRIDE documentation or Adam Shostack’s book for that. This is what I do when someone says “can you threat model this service?”</p>

<p>I also published my practice threat models on <a href="https://github.com/pranav1hivarekar/threat-modeling">GitHub</a> — this post explains the thinking behind them.</p>

<h2 id="before-i-touch-any-diagram">Before I Touch Any Diagram</h2>

<p>I have two mental checklists I run through before I start drawing anything. I’ve been using these long enough that they’re automatic now.</p>

<p>The first one is - For every component in the system, I ask:</p>
<ul>
  <li>how is <strong>Authentication</strong> handled?</li>
  <li>What <strong>Authorization</strong> controls exist?</li>
  <li>Is there <strong>Auditing</strong> and logging?</li>
  <li>Is there <strong>Rate Limiting</strong> to prevent abuse?</li>
  <li>And what’s the <strong>Data Protection</strong> story — encryption in transit, at rest, key management?</li>
</ul>

<p>That covers maybe 80% of the security surface. The remaining 20% is application-specific stuff — input validation, CORS, file upload restrictions, OWASP Top 10 patterns for web apps. And infrastructure-level questions like network segmentation, compute hardening, and how secrets are managed.</p>

<p>The second checklist is security principles: least privilege, defense in depth, secure by default, zero trust, separation of duties, auditability, fail-secure.</p>

<p>If a design violates any of these, that’s usually where the threat is hiding. For example, I reviewed a system once where a single API key gave read and write access to every customer’s data. That’s a least privilege violation, and the threat writes itself.</p>

<h2 id="step-1-decompose-and-draw-the-dfd">Step 1: Decompose and Draw the DFD</h2>

<p>Four things to identify:</p>
<ul>
  <li>external entities (users, third-party services)</li>
  <li>processes (your services)</li>
  <li>data stores (databases, caches), and</li>
  <li>data flows (how data moves between all of the above).</li>
</ul>

<p>I drawn this one in Microsoft Threat Modeling Tool. But you can use draw.io or OWASP Threat Dragon. Doesn’t need to be perfect. For a web app with an API gateway, it looks roughly like this:</p>

<p><img src="/assets/images/tm-webapp-3.png" alt="Web App With API Gateway" /></p>

<p>The part most people skip: <strong>trust boundaries</strong>. Draw lines where the trust level changes. 
Internet to your API gateway — that’s a trust boundary. API gateway to backend services — another one. Services to databases — another one. I’ve found that most threats cluster right at these boundaries.</p>

<p>If you’re short on time, just threat model the trust boundary crossings and you’ll catch the majority of issues.</p>

<h2 id="step-2-the-stride-per-element-matrix-my-quick-reference">Step 2: The STRIDE-Per-Element Matrix (My Quick Reference)</h2>

<p>I keep this as a quick reference because it saves a lot of time. Not every STRIDE category applies to every DFD element, and I wasted time early in my career trying to force-fit categories where they don’t belong.</p>

<table>
  <thead>
    <tr>
      <th> </th>
      <th>S</th>
      <th>T</th>
      <th>R</th>
      <th>I</th>
      <th>D</th>
      <th>E</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><strong>User (External Entity)</strong></td>
      <td>✓</td>
      <td> </td>
      <td>✓</td>
      <td> </td>
      <td> </td>
      <td> </td>
    </tr>
    <tr>
      <td><strong>Process</strong></td>
      <td>✓</td>
      <td>✓</td>
      <td>✓</td>
      <td>✓</td>
      <td>✓</td>
      <td>✓</td>
    </tr>
    <tr>
      <td><strong>Data Store</strong></td>
      <td> </td>
      <td>✓</td>
      <td>✓</td>
      <td>✓</td>
      <td>✓</td>
      <td> </td>
    </tr>
    <tr>
      <td><strong>Data Flow</strong></td>
      <td> </td>
      <td>✓</td>
      <td> </td>
      <td>✓</td>
      <td>✓</td>
      <td> </td>
    </tr>
  </tbody>
</table>

<p>Users can be spoofed and can repudiate actions — that’s it. Processes get hit with everything. Data stores can be tampered with, leaked, or overwhelmed, but you’re not going to “spoof” a database. Data flows can be intercepted (information disclosure), modified (tampering), or flooded (DoS).</p>

<p>When I’m analyzing a data flow between the API gateway and backend, I’m only thinking about tampering, information disclosure, and denial of service. I’m not wasting 10 minutes trying to come up with a spoofing scenario for a network connection. The matrix keeps me focused.</p>

<h2 id="step-3-write-threats-as-stories-not-labels">Step 3: Write Threats as Stories, Not Labels</h2>

<p>This is the thing that changed how I do threat modeling. I used to write things like “IDOR vulnerability” or “improper access control” as threats. Completely useless. A developer reads that and has no idea what to fix.</p>

<p>Now I write every threat with three parts: <strong>attack vector, outcome, and motivation</strong>.</p>

<p>Instead of “IDOR,” I write: <em>“Attacker changes the user_id parameter in the GET /api/users/{id}/profile request from their own ID to another user’s ID, gaining access to that user’s PII, because the backend doesn’t check if the authenticated user owns the requested resource.”</em></p>

<p>That’s specific enough that a developer can write the fix without asking me a single question.</p>

<p>Here’s another example — for a file upload feature, I’d write:</p>

<p><em>“Attacker uploads a PHP web shell disguised as a profile image to the file server, gaining persistent remote code execution, because the server doesn’t validate file content type beyond the extension.”</em> — STRIDE: Elevation of Privilege. Severity: Critical.</p>

<p><em>“Attacker uploads a 10GB file repeatedly to exhaust disk space on the file server, causing denial of service for all users, because there’s no file size limit enforced server-side.”</em> — STRIDE: DoS. Severity: High.</p>

<p>Compare that to “malicious file upload.” One tells you exactly what to test and fix. The other is a bullet point in a slide deck nobody reads.</p>

<h2 id="step-4-stride-per-element-vs-stride-per-interaction">Step 4: STRIDE Per Element vs STRIDE Per Interaction</h2>

<p>Two ways to apply STRIDE. I use both depending on the architecture.</p>

<p><strong>STRIDE Per Element</strong>: go through each component individually — user, API gateway, backend API, database — and check each applicable STRIDE category. I use this for simpler architectures where I want to go deep on individual components. My <a href="https://github.com/pranav1hivarekar/threat-modeling">API threat model</a> uses this approach.</p>

<p><strong>STRIDE Per Interaction</strong>: go through each data flow between components — User → API Gateway, Gateway → Backend, Backend → Database — and check all six STRIDE categories on each flow. I use this for microservices where the risk is in how services talk to each other across trust boundaries. My <a href="https://github.com/pranav1hivarekar/threat-modeling">web app threat model</a> uses this approach.</p>

<p>They find different things. Per Element goes deeper on individual component weaknesses. Per Interaction catches communication and authentication issues between services. Pick based on where you think the risk is concentrated. For most microservices architectures, I’d start with Per Interaction.</p>

<h2 id="step-5-mitigations-that-developers-can-actually-implement">Step 5: Mitigations That Developers Can Actually Implement</h2>

<p>I have a strong opinion here. Vague mitigations are worse than no mitigations because they give a false sense of security.</p>

<p>“Use encryption” means nothing. Encryption where? What algorithm? What key size? Who manages the keys? How often do you rotate? I’ve seen teams read “use encryption” and implement base64 encoding. Not joking.</p>

<p>What I write instead: “Encrypt PII columns at rest using AES-256-GCM. Envelope encryption with AWS KMS — data keys encrypted by a master key, 90-day rotation. Database in VPC private subnet, connections restricted to application tier security group.”</p>

<p>Same for rate limiting. “Add rate limiting” is not a mitigation. “100 requests/minute per authenticated user at the API Gateway, sliding window, with circuit breakers on backend services that fail-fast after 5 consecutive errors” — that’s a mitigation.</p>

<p>The test I use: can a developer implement this without coming back to ask me what I meant? If no, rewrite it.</p>

<h2 id="cloud-infrastructure-gets-the-same-treatment">Cloud Infrastructure Gets the Same Treatment</h2>

<p>When the app runs on AWS or any cloud, I extend the threat model to infrastructure. My mental checklist for every cloud component:</p>

<ul>
  <li><strong>Identity &amp; Access</strong> — who accesses this? IAM roles or hardcoded keys? Least privilege?</li>
  <li><strong>Network</strong> — how does traffic flow in and out? Security groups locked down?</li>
  <li><strong>Data</strong> — encrypted at rest and in transit? KMS managed?</li>
  <li><strong>Compute</strong> — host/container hardened? Patched?</li>
  <li><strong>Logging</strong> — CloudTrail, CloudWatch, alerts configured?</li>
</ul>

<p>For example, I reviewed a Terraform config once where the Jenkins server had an IAM policy with <code class="language-plaintext highlighter-rouge">"Resource": "*"</code> for ECR and Secrets Manager. Functionally it worked. Security-wise, that Jenkins instance could pull any secret in the account. The threat model caught it; a functional review wouldn’t have.</p>

<p>The threat model caught the question: “what if this Jenkins instance gets compromised?” And the answer was ugly — it could pull any secret in the account because of that wildcard permission.</p>

<h2 id="when-engineering-pushes-back">When Engineering Pushes Back</h2>

<p>It happens. Engineering says they won’t fix a finding before launch. I’ve learned not to fight this.</p>

<p>Instead: document the threat, write down the security team’s assessment AND the engineering team’s reasoning, propose partial mitigations if full ones aren’t feasible, and escalate to leadership with the documented risk. My job is due diligence. Leadership’s job is accepting or rejecting the risk. As long as it’s documented and deliberate, that’s how risk management is supposed to work.</p>

<p>The worst outcome isn’t a risk that leadership accepts. It’s a risk that nobody documented and everyone assumed someone else was handling.</p>

<h2 id="start-with-one-service">Start With One Service</h2>

<p>If you haven’t done this before, pick one service. Draw the DFD — doesn’t need to be beautiful. Mark the trust boundaries. Use the matrix to know which STRIDE categories apply to each element. Write threats as stories with attack vector, outcome, motivation. Write mitigations specific enough that a developer won’t need to ask you what you meant.</p>

<p>That’s it. Do it once and you’ll start seeing threats in every architecture diagram.</p>

<hr />

<p><em>My practice threat models are on <a href="https://github.com/pranav1hivarekar/threat-modeling">GitHub</a> — API (STRIDE Per Element) and Web App (STRIDE Per Interaction) with full DFDs, severity ratings, and specific mitigations.</em></p>

<hr />

<p><strong>References:</strong></p>

<ul>
  <li><a href="https://www.threatmodelingmanifesto.org/">Threat Modeling Manifesto</a> - values and principles for effective threat modeling</li>
  <li><a href="https://learn.microsoft.com/en-us/azure/security/develop/threat-modeling-tool-threats">Microsoft STRIDE Documentation</a> — the original STRIDE framework reference</li>
  <li><a href="https://cheatsheetseries.owasp.org/cheatsheets/Threat_Modeling_Cheat_Sheet.html">OWASP Threat Modeling Cheat Sheet</a> — practical starting point</li>
  <li><a href="https://owasp.org/www-project-threat-dragon/">OWASP Threat Dragon</a> — free tool for drawing DFDs with trust boundaries</li>
  <li><a href="https://catalog.workshops.aws/threatmodel/en-US">AWS Threat Modeling Workshop</a> — good for cloud-specific threat modeling</li>
</ul>]]></content><author><name>Pranav Hivarekar</name></author><category term="blog" /><category term="security" /><category term="application security" /><category term="threat modeling" /><category term="threat modeling" /><category term="STRIDE" /><category term="application security" /><category term="appsec" /><category term="secure design review" /><category term="DFD" /><category term="data flow diagram" /><category term="OWASP" /><category term="web application security" /><category term="API security" /><category term="security architecture" /><summary type="html"><![CDATA[A practical walkthrough of how I run STRIDE threat models on web applications and APIs — from DFD decomposition to writing actionable mitigations developers can actually implement]]></summary></entry><entry><title type="html">Data Governance For Engineers - The 5 Pillars Every Secure Data Pipeline Needs</title><link href="https://pranavhivarekar.com/data-governance-for-engineers-five-pillars/" rel="alternate" type="text/html" title="Data Governance For Engineers - The 5 Pillars Every Secure Data Pipeline Needs" /><published>2025-08-13T15:30:00+00:00</published><updated>2025-08-13T15:30:00+00:00</updated><id>https://pranavhivarekar.com/data-governance-for-engineers-five-pillars</id><content type="html" xml:base="https://pranavhivarekar.com/data-governance-for-engineers-five-pillars/"><![CDATA[<p><img src="/assets/images/posts/data-governance-by-pranav-hivarekar.png" alt="data-governance-by-pranav-hivarekar" /></p>

<p>This Blog Post is part of <strong>Building and Securing Data Pipelines: From Governance to Secure Implementation</strong> Series</p>

<p><em>A practical guide for engineers and managers to design secure, compliant data pipelines — from governance basics to production-grade implementation.</em></p>

<hr />
<p>Most data engineers focus on moving data from point A to point B — fast. But in today’s compliance-heavy world, speed without governance is a liability.</p>

<p>Weak or missing governance can trigger breaches, regulatory fines, and a loss of customer trust. Think about a pipeline that ingests sensitive data without proper access controls or encryption. It works fine… until an auditor shows up or a breach happens. Suddenly, that “fast” pipeline becomes your biggest problem.</p>

<p>That’s why this post — the first in our “Building and Securing Data Pipelines” series — breaks down the five pillars of data governance in a way engineers can actually implement. By the end, you’ll know exactly what governance looks like in practice and why it’s non-negotiable for secure, compliant pipelines.</p>

<h2 id="read-the-full-series">Read the full series:</h2>

<ol>
  <li><a href="/data-governance-for-engineers-five-pillars/"><strong>Blog 1: Data Governance for Engineers: The 5 Pillars Every Secure Pipeline Needs</strong> (you are here)</a></li>
  <li><a href="/designing-a-data-pipeline-that-embeds-governance-security/">Blog 2: Designing a Data Pipeline Architecture That Embeds Governance &amp; Security</a></li>
  <li><a href="/mapping-data-governance-to-aws-building-a-secure-DLP-pipeline/">Blog 3: Mapping Data Governance to AWS: Building a Secure DLP Pipeline</a></li>
  <li><a href="/securing-data-pipelines-privacy-compliance-security-aws/">Blog 4: Securing Data Pipelines: Privacy, Compliance, and Security-by-Design on AWS</a></li>
</ol>

<hr />

<h2 id="a-simple-data-pipeline">A Simple Data Pipeline</h2>

<p><img src="/assets/images/data-pipeline-1-datagovernance.png" alt="Data Governance" /></p>

<p>Data pipelines can be of multiple types but let’s stick to ETL Pipelines (Extract, Transform, Load) which are most common and easier to understand. For example, we download/retrieve a PDF from a website then we transform it (process the PDF and get only the required piece of information from it) and then load processed data into a relational database.</p>

<p>There are multiple components in a data pipeline - data sources, data ingestion, data storage, data processing, data orchestration, data governance and security. We will focus on the data governance part and build on our understanding of it.</p>

<h2 id="data-governance-pillars">Data Governance Pillars</h2>

<p><img src="/assets/images/data-pipeline-2-data-pillars.png" alt="Data Governance Pillars" /></p>

<p>Data governance is a system of rules or a framework ensuring effective management of data assets. It deals with five pillars broadly:</p>

<ul>
  <li><strong>Policies &amp; Standards, Roles &amp; Responsibilities, Ownership &amp; Accountability</strong></li>
  <li><strong>Data Quality</strong></li>
  <li><strong>Data Protection &amp; Safety (Security &amp; Privacy)</strong></li>
  <li><strong>Data Use &amp; Availability</strong></li>
  <li><strong>Data Management (Lifecycle)</strong></li>
</ul>

<p>The ultimate aim is to maximize data value while aligning with organizational goals.</p>

<h3 id="policies--standards">Policies &amp; Standards</h3>

<p>Policies &amp; standards are created by senior management which defines the high-level principles and detailed rules that guide how data is managed, protected, and used in alignment with laws, regulations, and business objectives.</p>

<p><strong>Remember this:</strong></p>
<ul>
  <li>Policies define what must be done; standards are mandatory requirements derived to implement policies</li>
  <li>They must integrate compliance requirements (GDPR, HIPAA, PCI DSS)</li>
  <li>They must provide consistency across data handling practices</li>
</ul>

<p>Policies &amp; Standards allows to create a clear, enforceable framework for secure and compliant data handling.</p>

<h3 id="roles--responsibilities">Roles &amp; Responsibilities</h3>

<p>Roles &amp; responsibilities assign duties to individuals or teams to ensure governance activities are executed and enforced.</p>

<p><strong>Remember this:</strong></p>
<ul>
  <li>Roles and responsibilities should be clearly defined to prevent gaps or overlaps</li>
  <li>Example of roles are Data Owners, Data Stewards, Data Custodians</li>
</ul>

<p>Roles &amp; Responsibilities allows to reduce risk of mismanagement and ensures accountability.</p>

<h3 id="ownership--accountability">Ownership &amp; Accountability</h3>

<p>Ownership &amp; accountability defines who has decision-making authority over data assets and holds them responsible for governance compliance.</p>

<p><strong>Remember this:</strong></p>
<ul>
  <li>Accountability and ownership cannot be delegated but responsibilities can</li>
  <li>It ensures someone is answerable if something goes wrong</li>
  <li>Data Owner is ultimately accountable</li>
</ul>

<p>Ownership &amp; Accountability allows to enforce compliance ownership.</p>

<h3 id="data-quality">Data Quality</h3>

<p>Data quality is all about rules to ensure data is accurate, complete, consistent, timely, valid and fit for its intended use. For example, if a source data contains 5000 records, the same 5000 records should exist after transformation and loading stages, unless intentionally filtered, to meet the completeness criteria. Similarly, other data quality rules can be defined.</p>

<p><strong>Few concepts to remember:</strong></p>
<ul>
  <li><strong>Metadata</strong> - Metadata is data about data. It helps to understand data</li>
  <li><strong>Data Lineage</strong> - Data lineage helps to visualize flow of data in a pipeline, from source to destination including all transformation steps</li>
  <li><strong>Data Profiling</strong> - Data profiling is the process of examining and analyzing a dataset to understand its characteristics, quality, and structure to identify potential quality issues</li>
</ul>

<p><strong>Process can be simplified as:</strong></p>
<ol>
  <li>Define and implement data quality rules (You should know what is good data for you)</li>
  <li>Continuously monitor for data quality issues</li>
  <li>Identify the issue utilizing metadata and data lineage</li>
  <li>Triage and remediate</li>
</ol>

<p>Poor data quality leads to wrong decisions, compliance risks, and loss of trust.</p>

<h3 id="data-protection--safety-security--privacy">Data Protection &amp; Safety (Security &amp; Privacy)</h3>

<p>Data protection &amp; safety deals with safeguarding data against unauthorized access, modification, or loss while ensuring compliance with privacy laws.</p>

<p><strong>Remember this:</strong></p>
<ul>
  <li>Security deals with CIA Triad (Confidentiality, Integrity, Availability)</li>
  <li>Data state can be data at rest, data in-transit and data in-use. We need to protect data in each state</li>
  <li>Privacy deals with regulation and laws eg. GDPR. We need to be compliant with every law and regulation to avoid penalties and fines</li>
  <li>Detect data breaches and have incident response plans ready</li>
  <li>Protect data using DLP and IRM tools</li>
</ul>

<p><strong>Process can be simplified as:</strong></p>
<ol>
  <li>Classifying the data</li>
  <li>Protecting the data</li>
</ol>

<p>Data protection &amp; safety deals with protecting both the organization’s assets and customer trust.</p>

<blockquote>
  <p><strong>Note:</strong> We will expand on data security and data privacy in a dedicated blog post of this series</p>
</blockquote>

<h3 id="data-use--availability">Data Use &amp; Availability</h3>

<p>Data use &amp; availability deals with governing how data is accessed, shared, and delivered to authorized users while maintaining performance and compliance.</p>

<p><strong>Remember this:</strong></p>
<ul>
  <li>Implement access control models to make data only available to the right people</li>
  <li>Have service level agreements for data availability</li>
</ul>

<p>Data use &amp; availability ensures data is available when needed, but only to the right people.</p>

<h3 id="data-management-lifecycle">Data Management (Lifecycle)</h3>

<p>Data management deals with data from creation to archival or secure disposal in line with governance rules.</p>

<p><strong>Lifecycle stages:</strong> Create → Store → Use → Share → Archive → Destroy</p>

<p><strong>Remember this:</strong></p>
<ul>
  <li>Design retention policies per regulatory needs</li>
  <li>Data should be securely deleted/destroyed to prevent data leakage</li>
</ul>

<p>Effective data management helps to avoid unnecessary storage costs, reduces risk, and ensures compliance with retention and disposal requirements.</p>

<h2 id="conclusion">Conclusion</h2>

<p>Data governance isn’t just about rules—it’s about trust, compliance, and enabling better decisions. The five pillars provide the structure, but it’s the consistent execution of these principles that turns data into a true business asset.</p>

<p>Now that you understand the pillars of data governance, the next step is turning those principles into an architecture you can actually build.</p>

<p><a href="/designing-a-data-pipeline-that-embeds-governance-security/"><strong>Read Part 2: Designing a Data Pipeline Architecture That Embeds Governance &amp; Security →</strong></a></p>]]></content><author><name>Pranav Hivarekar</name></author><category term="blog" /><category term="security" /><category term="data security" /><category term="data engineering" /><category term="data governance" /><category term="data engineering" /><category term="secure data pipelines" /><category term="compliance" /><category term="GDPR" /><category term="data quality" /><category term="data lifecycle" /><category term="policies and standards" /><category term="ETL governance" /><category term="data security principles" /><category term="data security" /><category term="data privacy" /><summary type="html"><![CDATA[Discover the 5 pillars of data governance that engineers must master to build secure, compliant, and reliable data pipelines. Learn how to protect trust, meet regulations, and ensure quality from the start]]></summary></entry><entry><title type="html">Designing A Data Pipeline Architecture That Embeds Governance &amp;amp; Security</title><link href="https://pranavhivarekar.com/designing-a-data-pipeline-that-embeds-governance-security/" rel="alternate" type="text/html" title="Designing A Data Pipeline Architecture That Embeds Governance &amp;amp; Security" /><published>2025-08-13T15:30:00+00:00</published><updated>2025-08-13T15:30:00+00:00</updated><id>https://pranavhivarekar.com/designing-a-data-pipeline-that-embeds-governance-security</id><content type="html" xml:base="https://pranavhivarekar.com/designing-a-data-pipeline-that-embeds-governance-security/"><![CDATA[<p><img src="/assets/images/posts/designing-data-pipeline-by-pranav-hivarekar.png" alt="designing-data-pipeline-by-pranav-hivarekar.png" /></p>

<p>This Blog Post is part of <strong>Building and Securing Data Pipelines: From Governance to Secure Implementation</strong> Series</p>

<p><em>A practical guide for engineers and managers to design secure, compliant data pipelines — from governance basics to production-grade implementation.</em></p>

<hr />

<p>Understanding governance principles is one thing — embedding them into your data pipeline is another.</p>

<p>Many organizations have written policies, but the architecture itself leaves gaps where sensitive data can slip through unnoticed. It’s like having a security checklist for your house but forgetting to put locks on the back doors. The intent is there, but the design leaves you exposed.</p>

<p>In this post, we’ll take the five pillars of governance from Blog 1 and show how to integrate them into a generalized pipeline architecture — stage by stage — so your design is secure and compliant from day one.</p>

<h2 id="read-the-full-series">Read the full series:</h2>

<ol>
  <li><a href="/data-governance-for-engineers-five-pillars/">Blog 1: Data Governance for Engineers: The 5 Pillars Every Secure Pipeline Needs</a></li>
  <li><a href="/designing-a-data-pipeline-that-embeds-governance-security/"><strong>Blog 2: Designing a Data Pipeline Architecture That Embeds Governance &amp; Security</strong> (you are here)</a></li>
  <li><a href="/mapping-data-governance-to-aws-building-a-secure-DLP-pipeline/">Blog 3: Mapping Data Governance to AWS: Building a Secure DLP Pipeline</a></li>
  <li><a href="/securing-data-pipelines-privacy-compliance-security-aws/">Blog 4: Securing Data Pipelines: Privacy, Compliance, and Security-by-Design on AWS</a></li>
</ol>

<hr />

<h2 id="a-simple-data-pipeline-with-data-governance--security">A Simple Data Pipeline With Data Governance &amp; Security</h2>

<p><img src="/assets/images/data-pipeline-3-governance.png" alt="Data Governance Data Pipeline" /></p>

<p>This is a simple data pipeline. Following are the components:</p>

<ul>
  <li><strong>Data Sources</strong></li>
  <li><strong>Data Ingestion</strong></li>
  <li><strong>Data Storage</strong></li>
  <li><strong>Data Processing</strong></li>
  <li><strong>Data Serving</strong></li>
  <li><strong>Data Orchestration</strong></li>
</ul>

<p>Data Governance &amp; Security should be integrated in every step of the pipeline.</p>

<h2 id="applying-governance-across-the-pipeline">Applying Governance Across the Pipeline</h2>

<h3 id="data-sources">Data Sources</h3>

<ul>
  <li>Identify source trustworthiness</li>
  <li>Apply policies for data acquisition and licensing</li>
  <li>Have data classification and sensitivity defined for your organization</li>
  <li>Verify compliance with jurisdictional rules (data residency, cross-border transfer laws)</li>
</ul>

<h3 id="data-ingestion">Data Ingestion</h3>

<ul>
  <li>Enforce access control and authentication for source systems</li>
  <li>Perform initial data profiling to understand the data</li>
  <li>Apply initial data quality checks and metadata tagging</li>
</ul>

<h3 id="data-storage">Data Storage</h3>

<ul>
  <li>Implement encryption at rest</li>
  <li>Apply data classification labels</li>
  <li>Define retention rules in line with governance policy</li>
</ul>

<h3 id="data-processing">Data Processing</h3>

<ul>
  <li>Perform data transformation</li>
  <li>Maintain data lineage tracking for auditability</li>
  <li>Validate outputs against quality rules</li>
</ul>

<h3 id="data-serving">Data Serving</h3>

<ul>
  <li>Storing data after processing</li>
</ul>

<h3 id="data-orchestration">Data Orchestration</h3>

<ul>
  <li>Ensure workflows respect access control policies</li>
  <li>Log all data movement for traceability</li>
  <li>Trigger governance checkpoints automatically</li>
</ul>

<h3 id="data-governance--security">Data Governance &amp; Security</h3>

<ul>
  <li>Use continuous monitoring for compliance and security incidents</li>
  <li>Integrate governance tools with data catalog and DLP solutions</li>
</ul>

<h2 id="how-governance--security-fit-together">How Governance &amp; Security Fit Together?</h2>

<p><strong>Policies &amp; Standards</strong> → Security Policy &amp; Regulatory Compliance</p>

<p><strong>Ownership &amp; Accountability</strong> → Access Control &amp; Audit Logging</p>

<p><strong>Data Quality</strong> → Integrity Assurance</p>

<p><strong>Data Protection &amp; Safety</strong> → CIA Triad + Privacy</p>

<p><strong>Data Use &amp; Availability</strong> → Controlled Access + Availability SLAs</p>

<p><strong>Data Management (Lifecycle)</strong> → Secure Retention &amp; Disposal</p>

<h2 id="conclusion">Conclusion</h2>

<p>This is a simple blueprint for designing and building secure data pipelines which integrates all the pillars of data governance into each stage of the data pipeline and reinforces them with strong security practices.</p>

<p>In Blog 3, we’ll map this architecture to a real AWS implementation that automatically detects and protects sensitive data — turning our blueprint into a working, production-ready pipeline.</p>

<p><a href="/mapping-data-governance-to-aws-building-a-secure-DLP-pipeline/"><strong>Read Part 3: Mapping Data Governance to AWS: Building a Secure DLP Pipeline →</strong></a></p>]]></content><author><name>Pranav Hivarekar</name></author><category term="blog" /><category term="security" /><category term="data security" /><category term="data engineering" /><category term="data governance" /><category term="data engineering" /><category term="data pipeline architecture" /><category term="secure data architecture" /><category term="governance framework" /><category term="security in data pipelines" /><category term="compliance architecture" /><category term="ETL security" /><category term="AWS pipeline design" /><category term="security-by-design" /><category term="data security" /><category term="data privacy" /><summary type="html"><![CDATA[Learn how to turn governance principles into a working architecture. This guide shows how to embed compliance and security into every stage of a data pipeline — from ingestion to orchestration.]]></summary></entry><entry><title type="html">Mapping Data Governance To AWS - Building a Secure DLP Pipeline</title><link href="https://pranavhivarekar.com/mapping-data-governance-to-aws-building-a-secure-DLP-pipeline/" rel="alternate" type="text/html" title="Mapping Data Governance To AWS - Building a Secure DLP Pipeline" /><published>2025-08-13T15:30:00+00:00</published><updated>2025-08-13T15:30:00+00:00</updated><id>https://pranavhivarekar.com/mapping-data-governance-to-aws-building-a-secure-DLP-pipeline</id><content type="html" xml:base="https://pranavhivarekar.com/mapping-data-governance-to-aws-building-a-secure-DLP-pipeline/"><![CDATA[<p><img src="/assets/images/posts/mapping-data-governance-by-pranav-hivarekar.png" alt="mapping-data-governance-by-pranav-hivarekar.png" /></p>

<p>This Blog Post is part of <strong>Building and Securing Data Pipelines: From Governance to Secure Implementation</strong> Series</p>

<p><em>A practical guide for engineers and managers to design secure, compliant data pipelines — from governance basics to production-grade implementation.</em></p>

<hr />

<p>A well-designed data pipeline is more than just moving data — it’s about governance, security, and trust. I took the initial generic blueprint for a governed data pipeline and turned it into a fully working AWS implementation that automatically identifies and redacts sensitive data.</p>

<p>Companies often have security policies on paper but no enforcement in the pipeline itself. If sensitive data slips past ingestion, it can land in non-secure systems, creating compliance and legal risks. The challenge was to embed governance and data loss prevention (DLP) directly into the pipeline — without slowing down the data flow.</p>

<p>This project is an AWS Glue + PySpark pipeline that automatically identifies and redacts sensitive data before it moves further downstream. It is available on <a href="https://github.com/pranav1hivarekar/data-loss-prevention-DLP-aws-glue/">GitHub</a>.</p>

<h2 id="read-the-full-series">Read the full series:</h2>

<ol>
  <li><a href="/data-governance-for-engineers-five-pillars/">Blog 1: Data Governance for Engineers: The 5 Pillars Every Secure Pipeline Needs</a></li>
  <li><a href="/designing-a-data-pipeline-that-embeds-governance-security/">Blog 2: Designing a Data Pipeline Architecture That Embeds Governance &amp; Security</a></li>
  <li><a href="/mapping-data-governance-to-aws-building-a-secure-DLP-pipeline/"><strong>Blog 3: Mapping Data Governance to AWS: Building a Secure DLP Pipeline</strong> (you are here)</a></li>
  <li><a href="/securing-data-pipelines-privacy-compliance-security-aws/">Blog 4: Securing Data Pipelines: Privacy, Compliance, and Security-by-Design on AWS</a></li>
</ol>

<hr />

<h2 id="from-blueprint-to-implementation">From Blueprint to Implementation</h2>

<p><img src="/assets/images/data-pipeline-4-governance-aws.png" alt="Data Pipeline AWS" /></p>

<p>This is how we use blueprint architecture and design our data pipeline. Let’s break down each component and build our understanding.</p>

<h3 id="data-sources-external">Data Sources (External)</h3>

<ul>
  <li>Identify source trustworthiness</li>
  <li>Apply policies for data acquisition and licensing</li>
  <li>Have data classification and sensitivity defined for your organization</li>
  <li>Verify compliance with jurisdictional rules (data residency, cross-border transfer laws)</li>
</ul>

<h3 id="data-ingestion-raw-data">Data Ingestion (Raw Data)</h3>

<ul>
  <li>Enforce access control and authentication for source systems</li>
  <li>Perform initial data profiling to understand the data</li>
  <li>Apply initial data quality checks and metadata tagging</li>
</ul>

<h3 id="data-storage-source-s3-bucket">Data Storage (Source S3 Bucket)</h3>

<ul>
  <li>Implement encryption at rest</li>
  <li>Apply data classification labels</li>
  <li>Define retention rules in line with governance policy</li>
</ul>

<h3 id="data-cataloging-aws-glue-data-catalog">Data Cataloging (AWS Glue Data Catalog)</h3>

<ul>
  <li>Perform data discovery</li>
  <li>Extract Metadata</li>
</ul>

<h3 id="data-processing-aws-glue-job---pyspark">Data Processing (AWS Glue Job - PySpark)</h3>

<ul>
  <li>Perform data transformation (redaction in our case)</li>
  <li>Maintain data lineage tracking for auditability</li>
  <li>Validate outputs against quality rules</li>
</ul>

<h3 id="data-serving-destination-s3-bucket">Data Serving (Destination S3 Bucket)</h3>

<ul>
  <li>Implement encryption at rest</li>
  <li>Storing data after processing</li>
</ul>

<h3 id="data-orchestration">Data Orchestration</h3>

<ul>
  <li>Ensure workflows respect access control policies</li>
  <li>Log all data movement for traceability</li>
  <li>Trigger governance checkpoints automatically</li>
</ul>

<h3 id="data-governance--security">Data Governance &amp; Security</h3>

<ul>
  <li>Use continuous monitoring for compliance and security incidents</li>
  <li>Integrate governance tools with data catalog and DLP solutions</li>
</ul>

<h2 id="technical-implementation">Technical Implementation</h2>

<p>Please review the <a href="https://github.com/pranav1hivarekar/data-loss-prevention-DLP-aws-glue/">GitHub project</a> for minute technical details and code on how the pipeline is implemented.</p>

<h2 id="conclusion">Conclusion</h2>

<p>This implementation transforms the blueprint into a production-ready pipeline. It’s modular enough to extend with new governance checks — for example, archiving raw data for long-term compliance or rejecting poor-quality data and reprocessing it automatically.</p>

<p>With this approach, we are successfully integrating governance and security right from the start, just like shift-left in DevSecOps. Whether you’re handling sensitive healthcare records or financial transactions, the same principles and code structure can be adapted to protect data at every stage.</p>

<p>In Blog 4, we’ll go deeper into security-by-design and privacy requirements, breaking down the controls that make this pipeline not just production-ready, but also regulation-ready.</p>

<p><a href="/securing-data-pipelines-privacy-compliance-security-aws/"><strong>Read Part 4: Securing Data Pipelines: Privacy, Compliance, and Security-by-Design on AWS →</strong></a></p>]]></content><author><name>Pranav Hivarekar</name></author><category term="blog" /><category term="security" /><category term="data security" /><category term="data engineering" /><category term="data governance" /><category term="data engineering" /><category term="AWS Glue" /><category term="PySpark" /><category term="AWS data pipeline" /><category term="DLP implementation" /><category term="data loss prevention" /><category term="secure AWS architecture" /><category term="data masking AWS" /><category term="GDPR" /><category term="data security" /><category term="data privacy" /><category term="cloud compliance" /><summary type="html"><![CDATA[See how to implement a secure, governed data pipeline on AWS with Glue, PySpark, and S3 — detecting and redacting sensitive data before it becomes a compliance risk]]></summary></entry><entry><title type="html">Securing Data Pipelines: Privacy, Compliance, And Security-by-Design On AWS</title><link href="https://pranavhivarekar.com/securing-data-pipelines-privacy-compliance-security-aws/" rel="alternate" type="text/html" title="Securing Data Pipelines: Privacy, Compliance, And Security-by-Design On AWS" /><published>2025-08-13T15:30:00+00:00</published><updated>2025-08-13T15:30:00+00:00</updated><id>https://pranavhivarekar.com/securing-data-pipelines-privacy-compliance-security-aws</id><content type="html" xml:base="https://pranavhivarekar.com/securing-data-pipelines-privacy-compliance-security-aws/"><![CDATA[<p><img src="/assets/images/posts/securing-data-pipelines-by-pranav-hivarekar.png" alt="securing-data-pipelines-by-pranav-hivarekar" /></p>

<p>This Blog Post is part of <strong>Building and Securing Data Pipelines: From Governance to Secure Implementation</strong> Series</p>

<p><em>A practical guide for engineers and managers to design secure, compliant data pipelines — from governance basics to production-grade implementation.</em></p>

<hr />

<p>In the cloud, speed and scalability mean nothing if you can’t protect the data you process. Regulations like GDPR don’t just demand encryption — they require security and privacy to be embedded at every stage of the data lifecycle.</p>

<p>In this final post of our “Building and Securing Data Pipelines” series, we’ll dive into the security pillars, privacy laws, and technical safeguards that make an AWS DLP pipeline both production-ready and compliant. You’ll see how to apply these principles from ingestion to archival — without leaving compliance to chance.</p>

<h2 id="read-the-full-series">Read the full series:</h2>

<ol>
  <li><a href="/data-governance-for-engineers-five-pillars/">Blog 1: Data Governance for Engineers: The 5 Pillars Every Secure Pipeline Needs</a></li>
  <li><a href="/designing-a-data-pipeline-that-embeds-governance-security/">Blog 2: Designing a Data Pipeline Architecture That Embeds Governance &amp; Security</a></li>
  <li><a href="/mapping-data-governance-to-aws-building-a-secure-DLP-pipeline/">Blog 3: Mapping Data Governance to AWS: Building a Secure DLP Pipeline</a></li>
  <li><a href="/securing-data-pipelines-privacy-compliance-security-aws/"><strong>Blog 4: Securing Data Pipelines: Privacy, Compliance, and Security-by-Design on AWS</strong> (you are here)</a></li>
</ol>

<hr />

<h2 id="understanding-security-pillars---cia-triad">Understanding Security Pillars - CIA Triad</h2>

<p>The CIA Triad stands for <strong>Confidentiality, Integrity, Availability</strong>:</p>

<ul>
  <li><strong>Confidentiality</strong> - Ensures that only authorized individuals or systems can view or access the data</li>
  <li><strong>Integrity</strong> - Ensures that data remains accurate, complete, and trustworthy. It prevents unauthorized modification, deletion, or corruption of data</li>
  <li><strong>Availability</strong> - Available data is readily accessible to authorized parties when they need it</li>
</ul>

<p>There are two additional pillars:</p>

<ul>
  <li><strong>Authenticity</strong> - Ensures that a person or system is authentic and we can verify that</li>
  <li><strong>Non-repudiation</strong> - Ensures that someone cannot deny responsibility or deny the validity of their actions or data they generated</li>
</ul>

<p>Data protection &amp; safety deals with implementing these pillars to safeguard data against unauthorized access, modification, or loss while ensuring compliance with privacy laws.</p>

<h2 id="understanding-data-privacy-requirements">Understanding Data Privacy Requirements</h2>

<p>Data privacy deals with laws and regulations which an organization needs to follow to avoid fines/penalties.</p>

<p>Let’s take an example of <strong>General Data Protection Regulation (GDPR)</strong> which is a European Union law focused on data protection and privacy.</p>

<p>We can break it down into three buckets:</p>

<h3 id="data-collection-and-processing">Data Collection and Processing</h3>
<ul>
  <li>Data minimization</li>
  <li>Purpose limitation</li>
</ul>

<h3 id="data-subject-rights">Data Subject Rights</h3>
<ul>
  <li>Right to access</li>
  <li>Right to erase</li>
</ul>

<h3 id="data-protection">Data Protection</h3>
<ul>
  <li>Data breach notifications</li>
  <li>Encryption of data</li>
</ul>

<p>We can develop our understanding as follows:</p>
<ul>
  <li>GDPR is applicable inside EU or outside EU enforced by EU</li>
  <li>It is about protecting personal data / human rights</li>
  <li>It applies to all the organizations who deals with EU citizens data</li>
  <li>Penalty is $10M or 4% annual revenue</li>
</ul>

<p>Reference: <a href="https://gdpr.eu/checklist/">GDPR Checklist</a></p>

<p>We want to protect PII data.</p>

<h2 id="merging-security--privacy-into-the-data-lifecycle">Merging Security &amp; Privacy into the Data Lifecycle</h2>

<p><strong>Lifecycle stages</strong>: Create → Store → Use → Share → Archive → Destroy</p>

<p>For each stage, data must be:</p>
<ul>
  <li>Classified by sensitivity</li>
  <li>Protected with appropriate security controls</li>
  <li>Managed under compliance requirements</li>
</ul>

<h3 id="core-security-strategiestechnologies">Core Security Strategies/Technologies:</h3>

<ul>
  <li>Encryption and key management (Encrypt data at rest and data in transit)</li>
  <li>Hashing</li>
  <li>Access Management (IAM) / Access Controls</li>
  <li>Data Obfuscation
    <ul>
      <li>Data masking</li>
      <li>De-identification (Anonymization and Pseudonymization)</li>
      <li>Tokenization</li>
    </ul>
  </li>
  <li>Monitoring (Auditing, logging, traceability)</li>
  <li>Network/Endpoint security</li>
</ul>

<h2 id="applying-security-by-design-to-our-aws-dlp-pipeline">Applying Security-by-Design to Our AWS DLP Pipeline</h2>

<p><img src="/assets/images/data-pipeline-4-governance-aws.png" alt="Data Pipeline AWS" /></p>

<h3 id="stage-1--data-sources-external">Stage 1 – Data Sources (External)</h3>

<p>Before ingestion: Apply organizational data classification, privacy policies, and security standards.</p>

<p><strong>Outcome</strong>: Know exactly what’s sensitive (e.g., PII) before it enters the pipeline.</p>

<h3 id="stage-2--data-ingestion--storage-source-s3-bucket">Stage 2 – Data Ingestion &amp; Storage (Source S3 Bucket)</h3>

<p>Initial profiling + basic data quality checks</p>

<p><strong>Security controls</strong>:</p>
<ul>
  <li>Encryption at rest (S3 SSE)</li>
  <li>IAM policies for least privilege</li>
  <li>Logging &amp; monitoring (CloudTrail, S3 access logs)</li>
  <li>Network-level protections (VPC endpoints)</li>
</ul>

<h3 id="stage-3--data-cataloging-aws-glue-data-catalog">Stage 3 – Data Cataloging (AWS Glue Data Catalog)</h3>

<p>Formal discovery &amp; metadata extraction</p>

<p>Link classification tags to schema metadata for policy-driven processing.</p>

<h3 id="stage-4--data-processing-aws-glue-etl-with-pyspark">Stage 4 – Data Processing (AWS Glue ETL with PySpark)</h3>

<p>Apply anonymization/redaction logic to sensitive fields.</p>

<p><strong>Security controls</strong>:</p>
<ul>
  <li>IAM roles for Glue jobs</li>
  <li>Fine-grained logging of processing steps</li>
  <li>Processing in private subnets for isolation</li>
</ul>

<h3 id="stage-5--data-serving-destination-s3-bucket">Stage 5 – Data Serving (Destination S3 Bucket)</h3>

<p>Store sanitized data for consumption.</p>

<p><strong>Security controls</strong>:</p>
<ul>
  <li>Encryption at rest &amp; transit</li>
  <li>IAM role-based access</li>
  <li>Retention &amp; archival policies</li>
  <li>Automated deletion after retention period</li>
</ul>

<h2 id="conclusion">Conclusion</h2>

<p>Security and privacy aren’t “add-ons” — they’re foundational layers of modern data pipelines.</p>

<p>This AWS DLP architecture demonstrates:</p>
<ul>
  <li>Security-by-design from ingestion to serving</li>
  <li>Compliance alignment with GDPR &amp; similar regulations</li>
  <li>Practical implementation of data governance in an engineering context</li>
</ul>

<p>By embedding privacy principles + security controls into every stage, we protect sensitive data before, during, and after processing — making this pipeline not only production-ready but regulation-ready.</p>

<p>This concludes our series on building and securing data pipelines — from governance fundamentals to AWS implementation and security-by-design.</p>

<p><strong>Missed a post? Start from the beginning:</strong></p>

<ol>
  <li><a href="/data-governance-for-engineers-five-pillars/">Blog 1: Data Governance for Engineers: The 5 Pillars Every Secure Pipeline Needs</a></li>
  <li><a href="/designing-a-data-pipeline-that-embeds-governance-security/">Blog 2: Designing a Data Pipeline Architecture That Embeds Governance &amp; Security</a></li>
  <li><a href="/mapping-data-governance-to-aws-building-a-secure-DLP-pipeline/">Blog 3: Mapping Data Governance to AWS: Building a Secure DLP Pipeline</a></li>
  <li><a href="/securing-data-pipelines-privacy-compliance-security-aws/"><strong>Blog 4: Securing Data Pipelines: Privacy, Compliance, and Security-by-Design on AWS</strong> (you are here)</a></li>
</ol>]]></content><author><name>Pranav Hivarekar</name></author><category term="blog" /><category term="security" /><category term="data security" /><category term="data engineering" /><category term="data governance" /><category term="data engineering" /><category term="secure data pipelines" /><category term="AWS security" /><category term="GDPR" /><category term="AWS DLP" /><category term="data lifecycle" /><category term="policies and standards" /><category term="ETL governance" /><category term="data security principles" /><category term="data security" /><category term="data privacy" /><summary type="html"><![CDATA[Embed security and privacy controls into every stage of your AWS data pipeline. Learn GDPR-aligned, security-by-design strategies for encryption, access control, and data anonymization]]></summary></entry><entry><title type="html">Facebook’s Bug - Unauthorized access to credit/prepaid card details (limited) of any user</title><link href="https://pranavhivarekar.com/facebooks-bug-unauthorized-access-to-credit-card-details-limited-of-any-user/" rel="alternate" type="text/html" title="Facebook’s Bug - Unauthorized access to credit/prepaid card details (limited) of any user" /><published>2017-02-11T19:34:30+00:00</published><updated>2017-02-11T19:34:30+00:00</updated><id>https://pranavhivarekar.com/facebooks-bug-unauthorized-access-to-credit-card-details-limited-of-any-user</id><content type="html" xml:base="https://pranavhivarekar.com/facebooks-bug-unauthorized-access-to-credit-card-details-limited-of-any-user/"><![CDATA[<h2 id="description">Description</h2>
<p>There are various Facebook products like Ads Manager, Business Manager, Messenger Payments, etc. which requires an <code class="language-plaintext highlighter-rouge">user</code> to add some payment method to their Facebook account which can be credit card, debit card, paypal, etc.</p>

<p>eg. If I want to run Facebook Ads then I need to add a <code class="language-plaintext highlighter-rouge">credit card</code> or any other relevant payment method so as to use it. Same is with other products.</p>

<p>Facebook assigns a unique <code class="language-plaintext highlighter-rouge">15 digit random number</code> to any <code class="language-plaintext highlighter-rouge">card</code> added to user’s Facebook account and this <code class="language-plaintext highlighter-rouge">id</code> is known as <code class="language-plaintext highlighter-rouge">credential id</code>. This <code class="language-plaintext highlighter-rouge">credential id</code> is then used by Facebook to query about <code class="language-plaintext highlighter-rouge">credit card</code> details.</p>

<p>This <code class="language-plaintext highlighter-rouge">credential id</code> was querable via <code class="language-plaintext highlighter-rouge">GraphQL</code> and it allowed an attacker to use it(credential id) to get <code class="language-plaintext highlighter-rouge">credit card</code> details. But it exposed last 4 digits, address, expiry date, etc.</p>

<h2 id="how-one-can-get-credential-id">How one can get <code class="language-plaintext highlighter-rouge">credential id</code>?</h2>

<p><img src="/assets/images/thinking-cartoon121.png" alt="thinking-cartoon121" /></p>

<p><a href="https://ataheri.files.wordpress.com/2012/07/thinking-cartoon121.png">Image Source</a></p>

<p>There are few methods to get <code class="language-plaintext highlighter-rouge">credential id</code> of your <code class="language-plaintext highlighter-rouge">card</code>…</p>

<p><strong>1]</strong> I had reported a bug last year where <code class="language-plaintext highlighter-rouge">Ad Analyst</code> was able to escalate privileges and was able to access <code class="language-plaintext highlighter-rouge">funding sources</code> of the Ad account. This leaked the <code class="language-plaintext highlighter-rouge">credential id</code> of the payment method. Unfortunately this bug went duplicate but I was still able to use it to demonstrate the flaw.</p>

<p><strong>2] Brute Force / Dictionary attacks:</strong>
We need to form 15 digit numbers so calculations are as follows…</p>

<ol>
  <li>We have digits [0-9]</li>
  <li>We have 15 places</li>
  <li>1st digit can be [1-9] i.e only 9 combinations</li>
  <li>Other 14 digits can be anything [0-9] i.e 10 combinations</li>
</ol>

<p>So,
9x10^14 =
10^14 = 100000000000000 = 100000 billion
9x10^14 = 900000 billion combinations</p>

<p>This covers all the 15 digit numbers. We need ONLY 900000 billion numbers. This seems to be practically possible as it may take few weeks to do so.</p>

<p>But even if we consider it impossible, one can generate numbers in range like generating number from <code class="language-plaintext highlighter-rouge">931000000000000 to 999999999999999</code>. This will be a lot quicker than previous one. Also, if we reduce the range and only brute force <code class="language-plaintext highlighter-rouge">last 6-8 digits</code> still we can generate a lot of valid 15 digit numbers.</p>

<p>So, now we assume that we can generate a large amount of valid unique <code class="language-plaintext highlighter-rouge">15 digit</code> number.</p>

<blockquote>
  <p>*Note : I avoided running the real brute force/dictionary attack as it would get me access to real <code class="language-plaintext highlighter-rouge">credential ids</code> of real users which voids Facebook’s terms. Instead, to prove my point I provided POC of my test accounts where I was able to show that brute force attack may work to get access to credit card details.</p>
</blockquote>

<p><strong>3] Other methods:</strong>
Ad account Admin removed from the Ad account having noted these ids can still use it now and get access <code class="language-plaintext highlighter-rouge">credit card</code> details.</p>

<p>Similarly, it applies to Business Manager as it has a separate <code class="language-plaintext highlighter-rouge">payment management</code>. A user having access to Business Manager but now removed from it can still have <code class="language-plaintext highlighter-rouge">credential ids</code>.</p>

<h2 id="proof-of-concept">Proof Of Concept</h2>

<p><strong>1]</strong> Get an <code class="language-plaintext highlighter-rouge">access_token</code> which can access <code class="language-plaintext highlighter-rouge">graphql</code>. This token can be obtained by observing requests/responses of your Android/IOS Facebook app or other Facebook owned apps.</p>

<p><strong>2]</strong> Now, get yourself a <code class="language-plaintext highlighter-rouge">credential id</code> via any of the methods listed above.</p>

<p><strong>3]</strong> Encode the <code class="language-plaintext highlighter-rouge">credential id</code> in order to form a string as <code class="language-plaintext highlighter-rouge">base64encode(p2p_credential_id)</code>.
eg. base64encode(p2p_999999999999999) → cDJwXzk5OTk5OTk5OTk5OTk5OQ==</p>

<p><strong>4]</strong> Make following graphql calls …</p>

<p>*Note : (Use <code class="language-plaintext highlighter-rouge">access_token</code> which you derived in Step 1)</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>REQUEST

POST /graphql?q=node(&lt;encoded p2p_credential_id string&gt;)
{
__typename,
id,
credit_card{
credential_id, 
card_association,
number, 
expire_month, 
expire_year, 
address {
__typename,
postal_code ,
full_address, 
single_line_full_address,
street, 
city, 
country, 
postal_code
}
},
mobile_csc_verified, 
zip_verified, 
web_csc_verified, 
method_category, 
commerce_payment_eligible, 
personal_transfer_eligible, 
is_default_receiving
}


RESPONSE

{
"&lt;encoded p2p_credential_id string&gt;": {
"__typename": "PeerToPeerPaymentMethod",    
"id": "&lt;encoded p2p_credential_id string&gt;",    
"credit_card": {
  "credential_id": "&lt;credential id&gt;",      
  "card_association": "VISA",      
  "number": "&lt;last 4 digits&gt;",      
  "expire_month": "&lt;expiry month&gt;",     
  "expire_year": "&lt;expiry year&gt;",     
  "address": {
    "__typename": "StreetAddress",        
    "postal_code": "&lt;postal code&gt;",        
    "full_address": "&lt;postal code&gt;",        
    "single_line_full_address": "&lt;postal code&gt;",        
    "street": "",       
    "city": "",        
    "country": "US"      
    }    
    },    
    "mobile_csc_verified": true,    
    "zip_verified": true,    
    "web_csc_verified": true,    
    "method_category": "DEBIT_CARD",    
    "commerce_payment_eligible": false,    
    "personal_transfer_eligible": true,    
    "is_default_receiving": false  
    }
    }
</code></pre></div></div>

<p><strong>5]</strong> Here, my <code class="language-plaintext highlighter-rouge">credit card</code> details(last 4 digits, expiry details, card association,etc.) and other sensitive information(address, etc.) are leaked.</p>

<blockquote>
  <p>NOTE : Please note that <code class="language-plaintext highlighter-rouge">credential id</code> is never deleted from Facebook. So, anyone can access the details even if card is removed or account is deactivated.</p>
</blockquote>

<h2 id="how-one-can-exploit-it">How one can exploit it?</h2>

<ol>
  <li>
    <p><strong>Try to form a valid credit card:</strong>
According to my research, it is possible to validate a credit card number using Luhn algorithm (<a href="https://en.wikipedia.org/wiki/Luhn_algorithm">https://en.wikipedia.org/wiki/Luhn_algorithm</a>). One can generate a large set of <code class="language-plaintext highlighter-rouge">credit card details</code> then filter out the credit cards based on <code class="language-plaintext highlighter-rouge">last 4 digits and pincode and expiry date</code>. This will return a very small set of valid credit cards. Later, cvv number can be brute force or any alternative attack can be done if we have valid credit cards.
This attack is sophisticated and will require a lot of time but it is not practically impossible.</p>
  </li>
  <li>
    <p><strong>Hacking combined with social engineering:</strong>
One can play smart and can make use of these details to compromise one’s apple account or amazon account or other things
Reference : <a href="https://www.wired.com/2012/08/apple-amazon-mat-honan-hacking/all/">https://www.wired.com/2012/08/apple-amazon-mat-honan-hacking/all/</a></p>
  </li>
</ol>

<p>One can even think of innovative ways to use these stolen credit card details.</p>

<h2 id="impact">Impact</h2>

<p>Once attacker knows the <code class="language-plaintext highlighter-rouge">credential id</code> then attacker can access credit card details which exposed the following:</p>

<ol>
  <li>last 4 digits</li>
  <li>expiry date</li>
  <li>address</li>
  <li>country and other relevant details</li>
</ol>

<p>Facebook determined that brute force attack may take a long time but considering other methods they patched the bug by placing permission checks on the endpoint. Now, users can only access their own credit cards.</p>

<h2 id="special-thanks">Special Thanks</h2>

<p>Thanks to Facebook for patching the vulnerability and all my friends who are supporting me for my work.</p>

<h2 id="how-can-you-learn-graphql">How can you learn GraphQL?</h2>

<ul>
  <li><a href="https://github.com/chentsulin/awesome-graphql#workshoppers">https://github.com/chentsulin/awesome-graphql#workshoppers</a></li>
</ul>

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

<p>January 1, 2017 at 11:35pm  - Report Sent<br />
January 13, 2017 at 6:22pm  - Initial Response by Facebook<br />
January 16, 2017 at 6:59am  - Sent more information<br />
January 18, 2017 at 1:55pm 	- Bug Confirmed by Facebook<br />
January 24, 2017 at 3:44pm  - Bug fixed and response by Facebook<br />
January 27, 2017 at 7:40am  - Confirmation of fix by me<br />
February 1, 2017 at 4:31pm  - Bounty awarded</p>]]></content><author><name>Pranav Hivarekar</name></author><category term="blog" /><category term="security" /><category term="BugBounty" /><category term="update" /><summary type="html"><![CDATA[Description There are various Facebook products like Ads Manager, Business Manager, Messenger Payments, etc. which requires an user to add some payment method to their Facebook account which can be credit card, debit card, paypal, etc.]]></summary></entry><entry><title type="html">Facebook’s Bug - Delete any video from Facebook</title><link href="https://pranavhivarekar.com/facebooks-bug-delete-any-video-from-facebook/" rel="alternate" type="text/html" title="Facebook’s Bug - Delete any video from Facebook" /><published>2016-06-23T19:34:30+00:00</published><updated>2016-06-23T19:34:30+00:00</updated><id>https://pranavhivarekar.com/facebooks-bug-delete-any-video-from-facebook</id><content type="html" xml:base="https://pranavhivarekar.com/facebooks-bug-delete-any-video-from-facebook/"><![CDATA[<h2 id="the-story">The story</h2>
<p>I came across a note <em><a href="https://www.facebook.com/notes/bob-baldwin/new-videos-in-comments/10156919502775277">New: Videos in Comments!</a></em> written by <a href="https://www.facebook.com/notes/bob-baldwin/new-videos-in-comments/10156919502775277">Bob Baldwin</a> who works at <a href="https://www.facebook.com/facebook/">Facebook</a>. This note was about Facebook launching it’s new feature of <strong>commenting using videos</strong>.</p>

<p>eg. Now, users were allowed to upload a video in comments.</p>

<p>When I saw this <a href="https://www.facebook.com/notes/bob-baldwin/new-videos-in-comments/10156919502775277">note</a>, at that time this <em>video comment</em> feature was already out 8 hrs ago. So, I started playing around and testing this feature to find out how it works. After, 2 hrs I was able to figure out some pretty interesting low impact flaws. Using these low impact flaws, I was able to form a bug to <strong>DELETE ANY VIDEO</strong></p>

<p>At that time, I was like …</p>

<p><img src="/assets/images/kidding.jpg" alt="Are you kidding me" /></p>

<p>Seriously, I am able to DELETE ANY VIDEO of my choice from FACEBOOK.</p>

<h2 id="the-bug">The Bug</h2>

<p>This bug is proof of flaw in logic rather than daily technical flaws which we see like RCE, SSRF, etc.</p>

<h3 id="developers-logic">Developers logic</h3>

<p>When we upload a <code class="language-plaintext highlighter-rouge">video</code> as a <code class="language-plaintext highlighter-rouge">comment</code>, then this video gets uploaded onto user/page ‘s timeline and then it gets attached to the post as a <code class="language-plaintext highlighter-rouge">video comment</code> using it’s <code class="language-plaintext highlighter-rouge">video-id</code>.</p>

<p>eg. When any user comments using a video on any random post, then video will first get uploaded to the user’s timeline and then <code class="language-plaintext highlighter-rouge">video-id</code> will be returned. This <code class="language-plaintext highlighter-rouge">video-id</code> gets attached to the post as a video comment.</p>

<h3 id="my-attack-logic">My attack Logic</h3>

<p>I love API. So, I got to this via <a href="https://developers.facebook.com/docs/graph-api">GraphAPI</a>. Below is simple attack logic.</p>

<ol>
  <li>Create a comment via api.</li>
  <li>Edit the comment and attach video of your choice using <code class="language-plaintext highlighter-rouge">video_id</code> via api.</li>
  <li>Delete the comment via api.</li>
</ol>

<p>This was removing the attached <code class="language-plaintext highlighter-rouge">video</code> using it’s <code class="language-plaintext highlighter-rouge">video-id</code>.</p>

<p>Here, there are two simple flaws …</p>

<ol>
  <li>I am able to attach anyone’s <code class="language-plaintext highlighter-rouge">video</code> to my comment using it’s <code class="language-plaintext highlighter-rouge">video-id</code>.</li>
  <li>When I delete my <code class="language-plaintext highlighter-rouge">comment</code>, then attached <code class="language-plaintext highlighter-rouge">video</code> gets deleted. As it uses ONLY <code class="language-plaintext highlighter-rouge">video-id</code> and there are no permission checks placed to verify if the <code class="language-plaintext highlighter-rouge">user</code> owns the <code class="language-plaintext highlighter-rouge">video</code>. Assumptions are made that <code class="language-plaintext highlighter-rouge">user</code> will ONLY upload/attach his/her own videos.</li>
</ol>

<h2 id="proof-of-concept">Proof Of Concept</h2>

<p>1.Create a comment on a post via API.</p>

<p>Api call :
Reference: (<a href="https://developers.facebook.com/docs/graph-api/reference/object/comments/">https://developers.facebook.com/docs/graph-api/reference/object/comments/</a>)</p>

<p><strong>POST /&lt; post id&gt;/comments?message=test</strong></p>

<p>2.Edit the comment and attach a VIDEO of your choice via API.</p>

<p>Video id : 1739331926310614 (Video to be deleted)</p>

<p>Api call :
Reference: (<a href="https://developers.facebook.com/docs/graph-api/reference/v2.6/comment">https://developers.facebook.com/docs/graph-api/reference/v2.6/comment</a>)</p>

<p><strong>POST /&lt; comment id&gt;?attachment_id=1739331926310614</strong></p>

<p>Video added as a comment.</p>

<p>3.Delete the comment. Wait 20 secs. (As it takes 20 secs to DELETE the video from Facebook’s server.)</p>

<p>Api call :
Reference: (<a href="https://developers.facebook.com/docs/graph-api/reference/v2.6/comment">https://developers.facebook.com/docs/graph-api/reference/v2.6/comment</a>)</p>

<p><strong>DELETE /&lt; comment id&gt;</strong></p>

<p>This will delete the video.</p>

<blockquote>
  <p>This vulnerability was temporarily fixed by Facebook team in 23 minutes after confirmation of flaw.</p>
</blockquote>

<blockquote>
  <p>Permanent fix was live in 10-12 hrs after that.</p>
</blockquote>

<p>Kudos to Facebook. :)</p>

<h2 id="how-i-got-this-hit-">How I got this hit ?</h2>

<p>I have been following some youtube channels, some great books and some other material which I mentioned in this <a href="https://www.facebook.com/notes/pranav-hivarekars-page/life-motivation/1784778461751783">note</a> on my <a href="https://www.facebook.com/pranavhivarekar">page</a> to improve my life. The book “<a href="https://www.amazon.in/The-Power-your-Subconscious-Mind/dp/1416511563%3FSubscriptionId%3DAKIAJN27IGV7EPZMNFPQ%26tag%3Drb200216-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1416511563">The Power Of Subconscious Mind</a>” mentioned in my <a href="https://www.facebook.com/notes/pranav-hivarekars-page/life-motivation/1784778461751783">note</a> is really life changing and have some really cool techniques to take you to whole new level. I recommend everyone to read this book who wants to acheive great things in their life.</p>

<p>Also, it’s worth mentioning that it took me more than 1.5 years to find this high-impact bug.</p>

<p>Follow this :</p>

<p><img src="/assets/img/achievements.jpg" alt="Achievement quote" /></p>

<h2 id="special-thanks">Special Thanks</h2>

<p>I would like to thank all my friends, well-wishers and everyone around me who plays an important role of motivating me. Also, Facebook Security Team to patch this bug before it goes into wrong hands.</p>

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

<p>June 10, 2016 at 3:53pm - Report Sent<br />
June 10, 2016 at 8:36pm  - Initial Response by Facebook<br />
June 10, 2016 at 8:51pm  - My Response to Facebook<br />
June 10, 2016 at 10:11pm - Bug Confirmed by Facebook<br />
June 10, 2016 at 10:31pm - My Response to Facebook<br />
June 10, 2016 at 10:34pm - Temporary fixed applied by Facebook<br />
June 10, 2016 at 10:44pm - My Response to Facebook<br />
June 11, 2016 at 9:05am  - Bug fixed and response by Facebook<br />
June 11, 2016 at 9:55am  - Confirmation of fix by me<br />
June 11, 2016 at 10:28am - Confirmation of fix by Facebook<br />
June 11, 2016 at 10:35am - Messages exchanged<br />
June 15, 2016 at 1:20am  - Messages exchanged<br />
June 20, 2016 at 9:03pm  - Asked about bounty decision<br />
June 23, 2016 at 1:13am  - 5 digits bounty awarded</p>]]></content><author><name>Pranav Hivarekar</name></author><category term="blog" /><category term="security" /><category term="BugBounty" /><category term="update" /><summary type="html"><![CDATA[The story I came across a note New: Videos in Comments! written by Bob Baldwin who works at Facebook. This note was about Facebook launching it’s new feature of commenting using videos.]]></summary></entry><entry><title type="html">Facebook’s Bug - Fooling Graph Search to Bypass Privacy Restrictions &amp;amp; Extract Private</title><link href="https://pranavhivarekar.com/facebooks-bug-fooling-graph-search-to-bypass-privacy-restrictions/" rel="alternate" type="text/html" title="Facebook’s Bug - Fooling Graph Search to Bypass Privacy Restrictions &amp;amp; Extract Private" /><published>2016-02-20T19:34:30+00:00</published><updated>2016-02-20T19:34:30+00:00</updated><id>https://pranavhivarekar.com/facebooks-bug-fooling-graph-search-to-bypass-privacy-restrictions</id><content type="html" xml:base="https://pranavhivarekar.com/facebooks-bug-fooling-graph-search-to-bypass-privacy-restrictions/"><![CDATA[<h2 id="description">Description</h2>
<p>I was able to fool Facebook’s Graph Search and bypass privacy restrictions and extract sensitive information about user’s applications and pages. I was able to get <code class="language-plaintext highlighter-rouge">applications used</code> by any user, regardless of privacy settings set to <code class="language-plaintext highlighter-rouge">Only Me</code> and also I was able to get <code class="language-plaintext highlighter-rouge">Pages liked</code> by user, regardless of privacy settings set to <code class="language-plaintext highlighter-rouge">Only Me</code></p>

<p>For example, I was able to see applications used by <code class="language-plaintext highlighter-rouge">Mark Zuckerberg</code> despite of <code class="language-plaintext highlighter-rouge">privacy</code> settings set.</p>

<h2 id="what-is-facebook-graph-search-and-how-it-works">What is Facebook Graph Search and How it works?</h2>

<p>Facebook Graph Search is SMART search tool developed by Facebook and Google developers who joined Facebook. It was an innovation as it allowed people to see what their Friends are doing. And these things aren’t possible using traditional Google search.</p>

<blockquote>
  <p>eg. <a href="https://www.facebook.com/search/2015/date/photos/4/photos/intersect">https://www.facebook.com/search/2015/date/photos/4/photos/intersect</a></p>
</blockquote>

<blockquote>
  <p>Mark Zuckerberg photos from 2015” would return all the photos from 2015.</p>
</blockquote>

<p>Some articles I read about Graph Search to understand it deeply. You can find many articles related to Graph Search on newyorker, newyorktimes, economist, etc.</p>

<ol>
  <li><a href="https://www.newyorker.com/news/news-desk/facebook-and-the-future-of-search">http://www.newyorker.com/news/news-desk/facebook-and-the-future-of-search</a></li>
</ol>

<p>This is simple working of Graph Search. But how it works internally ?</p>

<h2 id="graph-search-internal-working">Graph Search Internal Working</h2>

<p>Graph Search simply works on <code class="language-plaintext highlighter-rouge">Set Theory</code>. So, it is possible to fire queries which adhere to Set Theory and are successfully executed and make the search engine return result set back.</p>

<p><mark>For eg,  
A = {1,2,3}  
B = {2,3,7}</mark></p>

<p><mark>Then,  
Intersection = {2,3}  
Union = {1,2,3,7}</mark></p>

<p><mark>This works same in Graph Search.</mark></p>

<p>A similar bug found by “Philippe Harewood” → “<a href="http://philippeharewood.com/abusing-facebook-graph-search/">Abusing Facebook Graph Search using GraphQL</a>”. This bug gave me initial idea. He has exploited Graph Search directly using GraphQL whereas, I tried to abuse it directly on website.</p>

<h2 id="proof-of-concept">Proof Of Concept</h2>

<p><strong>Getting applications of any random user.</strong></p>

<p>Intersection of two sets was handled properly and didn’t show any private information using privacy <code class="language-plaintext highlighter-rouge">Only Me</code> or other.</p>

<blockquote>
  <p>eg. <a href="https://www.facebook.com/search/me/apps-used/100002065051535/apps-used/intersect">https://www.facebook.com/search/me/apps-used/100002065051535/apps-used/intersect</a></p>
</blockquote>

<p>This takes common-set(intersection) of <code class="language-plaintext highlighter-rouge">apps-used</code> by me and <code class="language-plaintext highlighter-rouge">apps-used</code> by <code class="language-plaintext highlighter-rouge">100002065051535</code> and returns a result set.</p>

<p>Union of two sets exposed private data i.e bypassed privacy settings. Given an app’s visibility is set to <code class="language-plaintext highlighter-rouge">Only Me</code>, was still returned in result set.</p>

<blockquote>
  <p>eg. <a href="https://www.facebook.com/search/me/apps-used/4/apps-used/union">https://www.facebook.com/search/me/apps-used/4/apps-used/union</a></p>
</blockquote>

<p>This returned me few applications which were used by me or Mark Zuckerberg. I demonstrated this vulnerability on my test accounts.</p>

<p><strong>Getting Pages liked by user.</strong></p>

<p>On user profile, a user is allowed to like pages which are of categories Apps and games, Movies, Tv shows, Music, Books, Sports, etc. Now, these pages are sorted according to categories and are addressed as individual elements. Books, Music, Sports are different entities and each entity has an option of privacy; an user can select any privacy for any entity.</p>

<p>eg. I visited this page (<a href="https://www.facebook.com/pranavhivarekar.hacker/games?pnref=lhc">https://www.facebook.com/pranavhivarekar.hacker/games?pnref=lhc</a>) and it showed me all sections and I was able to set different privacy to different sections and individual elements.</p>

<p>So, here I was able to extract any user’s personal information. It included <code class="language-plaintext highlighter-rouge">Books</code> he/she read, <code class="language-plaintext highlighter-rouge">Movies</code> he/she watched, etc. All the personal information was available via Graph Search, regardless of privacy settings.</p>

<p>To check whether a Tv show was liked by me. I used my another test account and fired the following query. My privacy settings for that page were set to <code class="language-plaintext highlighter-rouge">Only Me</code>.</p>

<blockquote>
  <p>Tv show : Taarak Mehta Ka ooltah Chashma</p>
</blockquote>

<p><mark>[https://www.facebook.com/search/100002065051535/pages-liked/str/Taarak%20Mehta%20Ka%20ooltah%20Chashma/keywords_pages/union](https://www.facebook.com/search/100002065051535/pages-liked/str/Taarak%20Mehta%20Ka%20ooltah%20Chashma/keywords_pages/union)</mark></p>

<p>You can clearly see that <code class="language-plaintext highlighter-rouge">Pranav Hivarekar likes this</code>. Despite of privacy settings set to <code class="language-plaintext highlighter-rouge">Only Me</code>, it did got returned in search. I was able to do this for any random user on facebook.</p>

<p>Now, it is patched and it returns the following …</p>

<h2 id="special-thanks">Special Thanks</h2>

<p>I would like to thank Facebook Security Team to understand the bug and fix it. Also, all my friends for supporting me all over.</p>

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

<p>Dec 1, 2015 - Report Sent<br />
Dec 2, 2015 - Escalation by Facebook<br />
Dec 2, 2015 - Additional information sent<br />
Dec 5, 2015 - Additional information sent<br />
Dec 13, 2015 - Pages Bug reported<br />
Dec 16, 2015 - Asked for more information<br />
Dec 18, 2015 - Additional information sent<br />
Dec 18, 2015 - Asked for confirmation of fix<br />
Dec 19, 2015 - More information sent to me by Facebook<br />
Dec 20, 2015 - Not fixed confirmation by me<br />
Jan 20, 2016 - Checked for updates<br />
Jan 23, 2016 - Asked for confirmation of fix<br />
Jan 23, 2016 - Not fixed confirmation by me<br />
Feb 13, 2016 - Bug fixed<br />
Feb 13, 2016 - Bounty awarded</p>]]></content><author><name>Pranav Hivarekar</name></author><category term="blog" /><category term="security" /><category term="BugBounty" /><category term="update" /><summary type="html"><![CDATA[Description I was able to fool Facebook’s Graph Search and bypass privacy restrictions and extract sensitive information about user’s applications and pages. I was able to get applications used by any user, regardless of privacy settings set to Only Me and also I was able to get Pages liked by user, regardless of privacy settings set to Only Me]]></summary></entry><entry><title type="html">DropBox’s Critical Bug - App having ONLY access to `App folder` being able to post and enumerate files in/of any folder</title><link href="https://pranavhivarekar.com/dropboxs-critical-bug/" rel="alternate" type="text/html" title="DropBox’s Critical Bug - App having ONLY access to `App folder` being able to post and enumerate files in/of any folder" /><published>2015-06-21T19:34:30+00:00</published><updated>2015-06-21T19:34:30+00:00</updated><id>https://pranavhivarekar.com/dropboxs-critical-bug</id><content type="html" xml:base="https://pranavhivarekar.com/dropboxs-critical-bug/"><![CDATA[<h2 id="description">Description</h2>
<p><strong>D</strong>ropbox offers two Api’s …</p>

<ol>
  <li>Core Api (https://www.dropbox.com/developers/core)</li>
  <li>Business Api (https://www.dropbox.com/developers/business)</li>
</ol>

<p>Both the Api’s have different permission models i.e different and distinct <code class="language-plaintext highlighter-rouge">scope</code> permissions are available for both the apis.</p>

<p>I was testing the Core Api and I found pretty bad authorization bypass. Let me explain what was it ?<br />
Also, I would like to add that this bug was open for almost 2 years from the initial launch of the api.</p>

<p>DropBox’s Core Api offers different <code class="language-plaintext highlighter-rouge">scope</code> permissions …<br />
Refer (https://www.dropbox.com/developers/reference/devguide)</p>

<p>App Folder scope got my attention</p>

<blockquote>
  <p>A dedicated folder named after your app is created within the Apps folder of a user’s Dropbox. Your app gets read and write access to this folder only and users can provide content to your app by moving files into this folder.<br />
In simple words, an app can access only the folder which is created by itself. It won’t have any access to other folders or root folder. So, an app can post/delete files ONLY in it’s folder.<br />
eg. If Pranav’s app has created Pranav’s app folder then app can access ONLY that folder and nothing else.</p>
</blockquote>

<p><mark>*But I was able to circumvent this permission model and I was able to post files in any folder of my choice of dropbox.*</mark></p>

<h2 id="proof-of-concept">Proof Of Concept</h2>

<p>This is completely logical attack …<br />
Two steps were required to completely post files in other folders.</p>

<ol>
  <li>Create a file in app’s respective App Folder.</li>
  <li>Create file’s copy reference.</li>
  <li>Copy file to any folder using copy reference.</li>
</ol>

<p>Request :<br />
<em>Creating copy reference of  <code class="language-plaintext highlighter-rouge">test.png</code> which is already uploaded in App Folder</em></p>

<p>(Making <code class="language-plaintext highlighter-rouge">copy_ref</code> —&gt;<a href="https://www.dropbox.com/developers/core/docs#copy_ref">https://www.dropbox.com/developers/core/docs#copy_ref</a>)</p>

<p><mark>GET https://api.dropbox.com/1/copy_ref/auto/test.png?access_token=redacted</mark></p>

<p>Response :</p>

<p><mark>{"expires": "Sun, 30 Apr 2045 07:23:24 +0000", "copy_ref": "JipjFzJqMDZrdGhqNTRnZA"}</mark></p>

<p><strong>Copy reference successfully created.</strong></p>

<hr />

<p>Request  :<br />
<em>Copying file  <code class="language-plaintext highlighter-rouge">test.png</code> using <code class="language-plaintext highlighter-rouge">copy reference</code> to any folder.</em></p>

<p>(Copying file to a new location —-&gt; <a href="https://www.dropbox.com/developers/core/docs#fileops-copy">https://www.dropbox.com/developers/core/docs#fileops-copy</a>)</p>

<p><mark>POST https://api.dropbox.com/1/fileops/copy?root=dropbox&amp;from_copy_ref=JipjFzJqMDZrdGhqNTRnZA&amp;to_path=/hacked.txt&amp;access_token=redacted</mark></p>

<p>Response :</p>

<p><mark>{"rev": "206262a6317", "thumb_exists": false, "path": "/hacked.txt", "is_dir": false, "client_mtime": "Fri, 08 May 2015 06:03:20 +0000", "icon": "page_white_text", "bytes": 15110, "modified": "Fri, 08 May 2015 07:41:19 +0000", "size": "14.8 KB", "root": "app_folder", "mime_type": "text/plain", "revision": 518}</mark></p>

<p><strong>File got successfully copied to ‘root’ directory.</strong></p>

<hr />

<p>Vulnerable parameter is root=dropbox. Here, <code class="language-plaintext highlighter-rouge">auto</code> means it will directly point to the App Folder but <code class="language-plaintext highlighter-rouge">dropbox</code> means it starts pointing from <code class="language-plaintext highlighter-rouge">root</code>.</p>

<p>If file is already present with the name then it gave verbose errors. This allowed me to enumerate all files present in the dropbox.<br />
eg. If <code class="language-plaintext highlighter-rouge">test.png</code> is already present in the <code class="language-plaintext highlighter-rouge">root</code> directory and we try to post file with same name then it will give verbose errors and Status 403 Forbidden which is a clear indication that file exists.</p>

<hr />

<p>I successfully submitted this bug to Dropbox’s Flex which was hosted on Bugcrowd and won first prize.</p>

<h2 id="video-proof-of-concept">Video Proof Of Concept</h2>

<iframe width="640" height="360" src="https://www.youtube.com/embed/NkuN8C8cRFQ" frameborder="0" allowfullscreen=""></iframe>

<h2 id="special-thanks">Special Thanks</h2>

<p>First I would like to thank Philippe Harewood (<a href="http://philippeharewood.com/">http://philippeharewood.com/</a>) for motivating all from his research on Facebook’s Api.</p>

<p>Later, I would like to convey my thanks to Bugcrowd for their supportiveness they showed towards me.</p>

<p>And lately, I would like to thank DropBox for successfully hosting their Flex Bounty. :-)</p>

<p>Cheers all- round ! :-)</p>]]></content><author><name>Pranav Hivarekar</name></author><category term="blog" /><category term="security" /><category term="BugBounty" /><category term="update" /><summary type="html"><![CDATA[Description Dropbox offers two Api’s …]]></summary></entry><entry><title type="html">Facebook’s API Bug - Exposure of `unpublished links` over graph api</title><link href="https://pranavhivarekar.com/facebooks-api-bug-exposure-of-unpublished-links/" rel="alternate" type="text/html" title="Facebook’s API Bug - Exposure of `unpublished links` over graph api" /><published>2015-05-08T19:34:30+00:00</published><updated>2015-05-08T19:34:30+00:00</updated><id>https://pranavhivarekar.com/facebooks-api-bug-exposure-of-unpublished-links</id><content type="html" xml:base="https://pranavhivarekar.com/facebooks-api-bug-exposure-of-unpublished-links/"><![CDATA[<h2 id="description">Description</h2>
<p>The endpoint <code class="language-plaintext highlighter-rouge">/me/links</code> is undocumented. We cannot find documentation about how to deal with this endpoint. But combining few api calls we can create <code class="language-plaintext highlighter-rouge">unpublished</code> posts.</p>

<p>More information about creating <code class="language-plaintext highlighter-rouge">unpublished</code> posts can be found here.<br />
It states that, “It is possible to add some content to the Graph without publishing a news feed or profile story indicating that it has been created. This is useful in a few situations, such as Page posts which are scheduled to go live at a particular time, or when a photo is to be used in a photo comment.”</p>

<p>This is very useful for page owners as <code class="language-plaintext highlighter-rouge">UNPUBLISHED</code> content will not be shown on page until published. Page admins or people having roles on pages can also schedule the posts to be published later.</p>

<p>After recursive testing, I observed that this edge(<code class="language-plaintext highlighter-rouge">/{page-id}/links</code>) is not obeying the rules of an unpublished content. When we create an <code class="language-plaintext highlighter-rouge">UNPUBLISHED</code> link via <code class="language-plaintext highlighter-rouge">/me/links</code> edge. Then it will be unpublished i.e it won’t be visible in feed and a profile story indicating that it has been created will not be shown. So, it is working good on the front end.</p>

<p>But any app or anyone can access the page. So, anyone with their access_token with <code class="language-plaintext highlighter-rouge">public_profile</code> permission can access the <code class="language-plaintext highlighter-rouge">UNPUBLISHED</code> links.<br />
This can be done via <code class="language-plaintext highlighter-rouge">/{page-id}/links</code> edge.</p>

<h2 id="proof-of-concept">Proof Of Concept</h2>

<p>Request</p>

<p><mark>POST /me/links?access_token=redacted</mark></p>

<p>==published=0&amp;message=created by testing&amp;link=http://www.pranavhivarekar.in/ ==</p>

<p>Response<br />
<mark>{  
"id": "366040680262484"  
}</mark></p>

<p>The link is published as <code class="language-plaintext highlighter-rouge">unpublished</code>. So, link is public at the moment but it is not shown or linked directly to the page. But there was flaw that allowed anyone with any access_token to view the <code class="language-plaintext highlighter-rouge">unpublished</code> links via <code class="language-plaintext highlighter-rouge">/me/links</code> endpoint. Now, it is patched and the <code class="language-plaintext highlighter-rouge">unpublished</code> links are only accessible to admins/editor or people having roles on pages and not to public.</p>

<p>Thanks to Facebook’s team for patching this vulnerability that allowed exposing of <code class="language-plaintext highlighter-rouge">unpublished links</code> via API.</p>

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

<p>Apr 12, 2015 10:52pm – Report Sent<br />
Apr 15, 2015 3:50am – Escalation by Facebook<br />
May 7, 2015 11:44pm – Asked about confirmation of fix<br />
May 8, 2015 12:01am – Fixed confirmed by me<br />
May 9, 2015 05:20am – Bounty awarded by Facebook</p>]]></content><author><name>Pranav Hivarekar</name></author><category term="blog" /><category term="security" /><category term="BugBounty" /><category term="update" /><summary type="html"><![CDATA[Description The endpoint /me/links is undocumented. We cannot find documentation about how to deal with this endpoint. But combining few api calls we can create unpublished posts.]]></summary></entry></feed>