<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abdul Basit Khan on Medium]]></title>
        <description><![CDATA[Stories by Abdul Basit Khan on Medium]]></description>
        <link>https://medium.com/@abdulbasitpriv?source=rss-9420c21a5c0d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*5lPYiVY8ALGuva7t</url>
            <title>Stories by Abdul Basit Khan on Medium</title>
            <link>https://medium.com/@abdulbasitpriv?source=rss-9420c21a5c0d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 15:34:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abdulbasitpriv/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Cyber Security Project#4 — Building Encrypted Notes Vault]]></title>
            <link>https://medium.com/@abdulbasitpriv/cyber-security-project-4-building-encrypted-notes-vault-9e0c6d20c7bc?source=rss-9420c21a5c0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e0c6d20c7bc</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity-project]]></category>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[encryption]]></category>
            <dc:creator><![CDATA[Abdul Basit Khan]]></dc:creator>
            <pubDate>Wed, 17 Dec 2025 15:09:08 GMT</pubDate>
            <atom:updated>2025-12-17T15:09:08.785Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cyber Security Project#4 — Building Encrypted Notes Vault</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o0EF5GTH3nuFqXXUrrA8qA.png" /></figure><p>Hey guys, so this is 4rth project in our beginner friendly cyber security projects series and by the name you must’ve guessed it, its a encrypted and secure note taking vault or webapp.</p><h3>A Local Encrypted Notes Vault (No Install, No Cloud, Fully Offline)</h3><p>In cybersecurity, we often preach about encryption, password hardening, and secure data storage but rarely do we bring all of these concepts together in a <em>simple</em> project that anyone can build and understand.</p><p>So I decided to create a basic encrypted notes vault that runs locally, requires no installations, and stores everything securely on your own machine.</p><p>This project is perfect for:</p><ul><li>Beginners learning real-world cryptography</li><li>Developers who want offline secure storage</li><li>Students looking for portfolio-building security projects</li><li>Privacy-focused users who don’t trust cloud-based note apps</li></ul><p>And the best part?<br>It’s just one HTML file portable, auditable, and fully offline.</p><h3>Project Over</h3><p>The idea was simple:</p><blockquote><em>“Double-click a single file → Enter password → Access encrypted notes.<br> Close it → Everything remains encrypted at rest.”</em></blockquote><p>To make that happen, I used three Web Crypto primitives:</p><h4>1. PBKDF2 (300,000 iterations)</h4><p>Used for password hardening and deriving a 256-bit encryption key.<br>Argon2 can also be integrated later for even stronger protection.</p><h4>2. AES-256-GCM</h4><p>Each note is encrypted using AES-GCM with a fresh random IV.<br>This ensures confidentiality and integrity.</p><h4>3. IndexedDB</h4><p>Perfect for storing binary encrypted objects locally in the browser.<br>Zero cloud dependency. Zero external storage.</p><h3>⚙️ How It Works (Simple Flow)</h3><h4>First Run</h4><ul><li>User enters “new password” + “confirm”</li><li>A random salt is generated</li><li>PBKDF2 derives a master encryption key</li><li>An empty vault structure is created and stored in IndexedDB</li></ul><h4>Unlock Flow</h4><ul><li>User enters password</li><li>Same salt + PBKDF2 regenerates the key</li><li>First note is decrypted to verify correctness</li><li>If valid → vault unlocks</li></ul><h3>Notes</h3><p>Each note uses:<br> AES-GCM 256-bit key + random IV<br>Only decrypted in memory when the vault is unlocked and stored encrypted at rest</p><h3>📦 Features</h3><p>✔ No installation<br> ✔ No backend<br> ✔ No dependencies<br> ✔ Everything happens locally<br> ✔ Encrypted-at-rest notes<br> ✔ Clean JS, readable code<br> ✔ Fully offline and portable<br> ✔ Secure by default</p><h3>🧪 Why This Project Is Great for Learning</h3><p>This vault teaches core security concepts:</p><h4>1. Password Hardening</h4><p>PBKDF2 (or Argon2 if added) demonstrates slow hashing, salts, and stretching.</p><h4>2. Symmetric Encryption</h4><p>AES-GCM is the modern standard for authenticated encryption.</p><h4>3. Secure Storage</h4><p>IndexedDB is perfect for storing encrypted blobs.</p><h4>4. Real-World Security Design</h4><ul><li>No storing plaintext</li><li>No exporting CryptoKeys</li><li>No transmitting data</li><li>No dependencies or risks from external libraries</li></ul><p>It’s a practical demonstration of <em>client-side encryption done right</em>.</p><h3>📁 Full Source Code</h3><p>Users can simply save it as .html and double-click to use.</p><pre><br>&lt;!doctype html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>&lt;meta charset=&quot;utf-8&quot; /&gt;<br>&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,initial-scale=1&quot; /&gt;<br>&lt;title&gt;Encrypted Notes Vault — Local (PBKDF2)&lt;/title&gt;<br>&lt;style&gt;<br>  :root{--bg:#0b0f13;--card:#0f1720;--muted:#98a0ab;--accent:#60a5fa;--danger:#fb7185}<br>  html,body{height:100%;margin:0;background:linear-gradient(180deg,#030417 0%,#0b0f13 100%);color:#e6eef6;font-family:Inter,Segoe UI,system-ui,Arial,sans-serif}<br>  .app{max-width:960px;margin:28px auto;padding:20px;border-radius:12px;background:linear-gradient(180deg,rgba(255,255,255,0.02),transparent);box-shadow:0 6px 24px rgba(2,6,23,0.7)}<br>  header{display:flex;align-items:center;justify-content:space-between}<br>  h1{font-size:20px;margin:0}<br>  .controls{display:flex;gap:8px}<br>  button{background:transparent;border:1px solid rgba(255,255,255,0.06);color:var(--accent);padding:8px 12px;border-radius:8px;cursor:pointer}<br>  button.ghost{border-color:transparent;color:var(--muted)}<br>  .grid{display:grid;grid-template-columns:1fr 320px;gap:18px;margin-top:18px}<br>  .notes{background:var(--card);padding:12px;border-radius:10px;min-height:360px}<br>  .note{background:linear-gradient(180deg,rgba(255,255,255,0.01),transparent);padding:10px;border-radius:8px;margin-bottom:10px;display:flex;justify-content:space-between;align-items:flex-start;cursor:pointer}<br>  .note:hover{outline:1px solid rgba(96,165,250,0.08)}<br>  .note .title{font-weight:600}<br>  .note small{color:var(--muted);display:block}<br>  .side{background:var(--card);padding:12px;border-radius:10px;height:max-content}<br>  .hidden{display:none}<br>  .center{display:flex;align-items:center;justify-content:center;min-height:220px}<br>  input[type=&quot;password&quot;],input[type=&quot;text&quot;],textarea{width:100%;padding:10px;border-radius:8px;border:1px solid rgba(255,255,255,0.04);background:#07101a;color:#eaf2ff}<br>  textarea{min-height:120px;resize:vertical}<br>  footer{margin-top:16px;color:var(--muted);font-size:13px}<br>  .menu{position:relative}<br>  .menu button{padding:6px;border-radius:6px}<br>  .menu-list{position:absolute;right:0;top:36px;background:#07121a;border-radius:8px;padding:6px;display:flex;flex-direction:column;gap:6px;min-width:160px;box-shadow:0 6px 18px rgba(2,6,23,0.6)}<br>  .menu-list button{background:transparent;border:0;color:#dbeafe;text-align:left;padding:8px;border-radius:6px}<br>  .note-editor{display:flex;flex-direction:column;gap:8px}<br>  .muted{color:var(--muted);font-size:13px}<br>  .topbar{display:flex;gap:8px;align-items:center}<br>  .danger{color:var(--danger)}<br>  .notice{background:#071827;padding:8px;border-radius:8px;color:var(--muted);font-size:13px}<br>  .small{font-size:13px;color:var(--muted)}<br>&lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;div class=&quot;app&quot; role=&quot;application&quot; aria-label=&quot;Encrypted Notes Vault&quot;&gt;<br>  &lt;header&gt;<br>    &lt;h1&gt;Encrypted Notes Vault — Local (PBKDF2)&lt;/h1&gt;<br>    &lt;div class=&quot;controls&quot;&gt;<br>      &lt;button id=&quot;btnExport&quot; class=&quot;ghost&quot; title=&quot;Export encrypted vault&quot;&gt;Export Vault&lt;/button&gt;<br>      &lt;button id=&quot;btnImport&quot; class=&quot;ghost&quot; title=&quot;Import encrypted vault&quot;&gt;Import Vault&lt;/button&gt;<br>      &lt;button id=&quot;btnLock&quot; class=&quot;ghost hidden&quot;&gt;Lock&lt;/button&gt;<br>    &lt;/div&gt;<br>  &lt;/header&gt;<br><br>  &lt;div class=&quot;grid&quot;&gt;<br>    &lt;main class=&quot;notes&quot; id=&quot;notesSection&quot; aria-live=&quot;polite&quot;&gt;<br>      &lt;div id=&quot;lockedPane&quot; class=&quot;center&quot;&gt;<br>        &lt;div style=&quot;width:360px&quot;&gt;<br>          &lt;h3 id=&quot;lp-title&quot;&gt;Setup / Unlock Vault&lt;/h3&gt;<br>          &lt;div id=&quot;setupArea&quot;&gt;<br>            &lt;div class=&quot;muted&quot;&gt;Create a strong password. If you lose it, there is no recovery unless you exported a backup.&lt;/div&gt;<br>            &lt;label class=&quot;small&quot;&gt;Password&lt;/label&gt;<br>            &lt;input id=&quot;pw&quot; type=&quot;password&quot; autocomplete=&quot;new-password&quot; /&gt;<br>            &lt;label class=&quot;small&quot;&gt;Confirm&lt;/label&gt;<br>            &lt;input id=&quot;pw2&quot; type=&quot;password&quot; autocomplete=&quot;new-password&quot; /&gt;<br>            &lt;div style=&quot;display:flex;gap:8px;margin-top:8px&quot;&gt;<br>              &lt;button id=&quot;btnCreate&quot;&gt;Create Vault&lt;/button&gt;<br>              &lt;button id=&quot;btnUseExisting&quot; class=&quot;ghost&quot;&gt;I already have a vault&lt;/button&gt;<br>            &lt;/div&gt;<br>            &lt;div style=&quot;margin-top:8px&quot;&gt;<br>              &lt;div class=&quot;small&quot;&gt;KDF: PBKDF2-HMAC-SHA256 (iterations: 300,000)&lt;/div&gt;<br>              &lt;div class=&quot;muted&quot; style=&quot;margin-top:6px&quot;&gt;This app stores a per-vault salt and re-uses it for unlocks. No external libraries required.&lt;/div&gt;<br>            &lt;/div&gt;<br>          &lt;/div&gt;<br><br>          &lt;div id=&quot;unlockArea&quot; class=&quot;hidden&quot;&gt;<br>            &lt;label class=&quot;small&quot;&gt;Enter password to unlock&lt;/label&gt;<br>            &lt;input id=&quot;pwUnlock&quot; type=&quot;password&quot; autocomplete=&quot;current-password&quot; /&gt;<br>            &lt;div style=&quot;display:flex;gap:8px;margin-top:8px&quot;&gt;<br>              &lt;button id=&quot;btnUnlock&quot;&gt;Unlock&lt;/button&gt;<br>              &lt;button id=&quot;btnReset&quot; class=&quot;ghost&quot;&gt;Reset (wipe vault)&lt;/button&gt;<br>            &lt;/div&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br><br>      &lt;div id=&quot;unlockedPane&quot; class=&quot;hidden&quot;&gt;<br>        &lt;div style=&quot;display:flex;justify-content:space-between;align-items:center&quot;&gt;<br>          &lt;div&gt;<br>            &lt;label class=&quot;small&quot;&gt;Search&lt;/label&gt;&lt;br/&gt;<br>            &lt;input id=&quot;search&quot; type=&quot;text&quot; placeholder=&quot;Search titles or contents (only while unlocked)&quot;/&gt;<br>          &lt;/div&gt;<br>          &lt;div style=&quot;text-align:right&quot;&gt;<br>            &lt;div class=&quot;muted&quot;&gt;Vault unlocked&lt;/div&gt;<br>            &lt;div class=&quot;small&quot;&gt;Notes: &lt;span id=&quot;noteCount&quot;&gt;0&lt;/span&gt;&lt;/div&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br><br>        &lt;div id=&quot;notesList&quot; style=&quot;margin-top:12px&quot;&gt;&lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/main&gt;<br><br>    &lt;aside class=&quot;side&quot;&gt;<br>      &lt;div style=&quot;display:flex;justify-content:space-between;align-items:center&quot;&gt;<br>        &lt;h3 style=&quot;margin:0&quot;&gt;Note Editor&lt;/h3&gt;<br>        &lt;div class=&quot;muted small&quot;&gt;Local only • AES-GCM&lt;/div&gt;<br>      &lt;/div&gt;<br><br>      &lt;div style=&quot;margin-top:12px&quot; class=&quot;note-editor&quot;&gt;<br>        &lt;input id=&quot;noteTitle&quot; type=&quot;text&quot; placeholder=&quot;Title (will be encrypted)&quot;/&gt;<br>        &lt;textarea id=&quot;noteBody&quot; placeholder=&quot;Write your note here...&quot;&gt;&lt;/textarea&gt;<br>        &lt;div style=&quot;display:flex;gap:8px&quot;&gt;<br>          &lt;button id=&quot;btnNew&quot;&gt;New Note&lt;/button&gt;<br>          &lt;button id=&quot;btnSave&quot; class=&quot;ghost&quot; disabled&gt;Save&lt;/button&gt;<br>          &lt;button id=&quot;btnClear&quot; class=&quot;ghost&quot;&gt;Clear&lt;/button&gt;<br>        &lt;/div&gt;<br><br>        &lt;div style=&quot;margin-top:12px&quot;&gt;<br>          &lt;div class=&quot;notice&quot;&gt;Auto-lock on blur/inactivity. Clipboard copied content will be cleared after 15s.&lt;/div&gt;<br>          &lt;div style=&quot;margin-top:8px&quot; class=&quot;small&quot;&gt;Security note: This app uses client-side crypto; a compromised OS can still capture the password.&lt;/div&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/aside&gt;<br>  &lt;/div&gt;<br><br>  &lt;footer&gt;<br>    &lt;div class=&quot;small&quot;&gt;Built for local use. No external resources. Keep backups of exported vaults. Avoid weak passwords.&lt;/div&gt;<br>  &lt;/footer&gt;<br>&lt;/div&gt;<br><br>&lt;script&gt;<br>/* Encrypted Notes Vault - PBKDF2 fixed version<br>   Save this file as .html and open it in a modern browser.<br>*/<br><br>const DB_NAME = &#39;enc-notes-vault-db&#39;;<br>const STORE = &#39;vault&#39;;<br>const VAULT_KEY = &#39;vault&#39;;<br>const ITERATIONS = 300000; // PBKDF2 iterations<br>const AES_ALGO = &#39;AES-GCM&#39;;<br>const IV_BYTES = 12;<br>const SALT_BYTES = 16;<br>const KEY_LEN = 256;<br><br>let db = null;<br>let masterKey = null;     // CryptoKey<br>let masterRaw = null;     // ArrayBuffer of raw key (for zeroing)<br>let vaultMeta = null;     // loaded vault object<br>let unlockedNotes = [];   // decrypted notes in memory<br><br>const enc = new TextEncoder();<br>const dec = new TextDecoder();<br><br>function $(id){ return document.getElementById(id); }<br><br>// IndexedDB helpers<br>function openDB(){ return new Promise((res,rej)=&gt;{<br>  const r = indexedDB.open(DB_NAME,1);<br>  r.onupgradeneeded = e =&gt; {<br>    const idb = e.target.result;<br>    if(!idb.objectStoreNames.contains(STORE)) idb.createObjectStore(STORE);<br>  }<br>  r.onsuccess = e =&gt; { db = e.target.result; res(db); }<br>  r.onerror = e =&gt; rej(e);<br>})}<br><br>function idbGet(key){ return new Promise((res,rej)=&gt;{<br>  const tx = db.transaction([STORE],&#39;readonly&#39;);<br>  const st = tx.objectStore(STORE);<br>  const rq = st.get(key);<br>  rq.onsuccess =()=&gt; res(rq.result);<br>  rq.onerror = e =&gt; rej(e);<br>})}<br><br>function idbPut(key,val){ return new Promise((res,rej)=&gt;{<br>  const tx = db.transaction([STORE],&#39;readwrite&#39;);<br>  const st = tx.objectStore(STORE);<br>  const rq = st.put(val,key);<br>  rq.onsuccess =()=&gt; res(true);<br>  rq.onerror = e =&gt; rej(e);<br>})}<br><br>function idbDelete(key){ return new Promise((res,rej)=&gt;{<br>  const tx = db.transaction([STORE],&#39;readwrite&#39;);<br>  const st = tx.objectStore(STORE);<br>  const rq = st.delete(key);<br>  rq.onsuccess =()=&gt; res(true);<br>  rq.onerror = e =&gt; rej(e);<br>})}<br><br>// util helpers<br>function toB64(buf){ return btoa(String.fromCharCode(...new Uint8Array(buf))); }<br>function fromB64(s){ const bin = atob(s); const arr = new Uint8Array(bin.length); for(let i=0;i&lt;bin.length;i++) arr[i]=bin.charCodeAt(i); return arr.buffer; }<br>function uuidv4(){ return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,c=&gt; (c ^ crypto.getRandomValues(new Uint8Array(1))[0] &amp; 15 &gt;&gt; c/4).toString(16)); }<br>function zeroBuffer(buf){ try{ const a = new Uint8Array(buf); a.fill(0); }catch(e){} }<br><br>// crypto helpers<br>async function deriveKeyPBKDF2(password, salt, iterations=ITERATIONS){<br>  const pwKey = await crypto.subtle.importKey(&#39;raw&#39;, enc.encode(password), {name:&#39;PBKDF2&#39;}, false, [&#39;deriveBits&#39;,&#39;deriveKey&#39;]);<br>  const key = await crypto.subtle.deriveKey(<br>    {name:&#39;PBKDF2&#39;, salt, iterations, hash:&#39;SHA-256&#39;},<br>    pwKey,<br>    {name:AES_ALGO, length: KEY_LEN},<br>    false,<br>    [&#39;encrypt&#39;,&#39;decrypt&#39;]<br>  );<br>  const raw = await crypto.subtle.exportKey(&#39;raw&#39;, key);<br>  return { key, raw };<br>}<br><br>async function deriveKeyFromVaultPassword(password, vault){<br>  // vault.kdfParams.salt is base64<br>  const saltBuf = fromB64(vault.kdfParams.salt);<br>  const iterations = vault.kdfParams.iterations || ITERATIONS;<br>  return deriveKeyPBKDF2(password, saltBuf, iterations);<br>}<br><br>async function encryptPlaintextWithCryptoKey(cryptoKey, plaintext){<br>  const iv = crypto.getRandomValues(new Uint8Array(IV_BYTES));<br>  const encOpts = { name: AES_ALGO, iv };<br>  const ct = await crypto.subtle.encrypt(encOpts, cryptoKey, enc.encode(plaintext));<br>  return { iv: new Uint8Array(iv), ciphertext: new Uint8Array(ct) };<br>}<br><br>async function decryptCipherWithCryptoKey(cryptoKey, ivBytes, ctBytes){<br>  const decOpts = { name: AES_ALGO, iv: new Uint8Array(ivBytes) };<br>  const pt = await crypto.subtle.decrypt(decOpts, cryptoKey, ctBytes);<br>  return dec.decode(pt);<br>}<br><br>// vault helpers<br>function createNewVaultObject(){<br>  const salt = crypto.getRandomValues(new Uint8Array(SALT_BYTES));<br>  return {<br>    version: 1,<br>    kdf: &#39;pbkdf2&#39;,<br>    kdfParams: { salt: toB64(salt.buffer), iterations: ITERATIONS },<br>    notes: []<br>  };<br>}<br><br>// UI and app logic<br>async function init(){<br>  await openDB();<br>  const existing = await idbGet(VAULT_KEY);<br>  // wire<br>  $(&#39;btnCreate&#39;).addEventListener(&#39;click&#39;, onCreateVault);<br>  $(&#39;btnUseExisting&#39;).addEventListener(&#39;click&#39;, ()=&gt;{ $(&#39;setupArea&#39;).classList.add(&#39;hidden&#39;); $(&#39;unlockArea&#39;).classList.remove(&#39;hidden&#39;); $(&#39;lp-title&#39;).innerText=&#39;Unlock Vault&#39; });<br>  $(&#39;btnUnlock&#39;).addEventListener(&#39;click&#39;, onUnlock);<br>  $(&#39;btnReset&#39;).addEventListener(&#39;click&#39;, onResetVault);<br>  $(&#39;btnNew&#39;).addEventListener(&#39;click&#39;, onNewNote);<br>  $(&#39;btnSave&#39;).addEventListener(&#39;click&#39;, onSaveNote);<br>  $(&#39;btnClear&#39;).addEventListener(&#39;click&#39;, ()=&gt;{ $(&#39;noteTitle&#39;).value=&#39;&#39;; $(&#39;noteBody&#39;).value=&#39;&#39;; $(&#39;btnSave&#39;).disabled=true; });<br>  $(&#39;btnExport&#39;).addEventListener(&#39;click&#39;, onExportVault);<br>  $(&#39;btnImport&#39;).addEventListener(&#39;click&#39;, ()=&gt;{ fileInput.click(); });<br>  $(&#39;btnLock&#39;).addEventListener(&#39;click&#39;, lockVault);<br>  $(&#39;search&#39;).addEventListener(&#39;input&#39;, renderNotesList);<br>  $(&#39;pw&#39;).addEventListener(&#39;input&#39;, updateStrength);<br>  $(&#39;pw2&#39;).addEventListener(&#39;input&#39;, updateStrength);<br><br>  // import file input<br>  const fileInput = document.createElement(&#39;input&#39;);<br>  fileInput.type=&#39;file&#39;; fileInput.accept=&#39;.json,.vault&#39;; fileInput.className=&#39;hidden&#39;;<br>  fileInput.addEventListener(&#39;change&#39;, async e=&gt;{<br>    const f = e.target.files[0]; if(!f) return;<br>    const txt = await f.text();<br>    try{<br>      const parsed = JSON.parse(txt);<br>      // basic structure check<br>      if(!parsed.kdfParams || !parsed.kdfParams.salt) return alert(&#39;Invalid vault file (missing kdf salt).&#39;);<br>      await idbPut(VAULT_KEY, parsed);<br>      alert(&#39;Vault imported locally. Now unlock using your password.&#39;);<br>      location.reload();<br>    }catch(err){ alert(&#39;Invalid vault file&#39;); }<br>  });<br>  document.body.appendChild(fileInput);<br><br>  if(!existing){<br>    $(&#39;setupArea&#39;).classList.remove(&#39;hidden&#39;);<br>    $(&#39;unlockArea&#39;).classList.add(&#39;hidden&#39;);<br>  } else {<br>    $(&#39;setupArea&#39;).classList.add(&#39;hidden&#39;);<br>    $(&#39;unlockArea&#39;).classList.remove(&#39;hidden&#39;);<br>  }<br>}<br><br>function updateStrength(){<br>  const a = $(&#39;pw&#39;).value || &#39;&#39;;<br>  const b = $(&#39;pw2&#39;).value || &#39;&#39;;<br>  $(&#39;btnCreate&#39;).disabled = !(a &amp;&amp; b &amp;&amp; a === b &amp;&amp; a.length &gt;= 8);<br>}<br><br>async function onCreateVault(){<br>  const p = $(&#39;pw&#39;).value;<br>  const p2 = $(&#39;pw2&#39;).value;<br>  if(!p || p !== p2){ alert(&#39;Passwords do not match&#39;); return; }<br>  if(p.length &lt; 8 &amp;&amp; !confirm(&#39;Password shorter than 8 chars. Continue?&#39;)) return;<br>  const v = createNewVaultObject();<br>  // persist vault metadata now (salt included)<br>  await idbPut(VAULT_KEY, v);<br>  alert(&#39;Vault created locally. Now unlock using your new password.&#39;);<br>  location.reload();<br>}<br><br>async function onResetVault(){<br>  if(!confirm(&#39;This will wipe the vault from this browser. Are you sure?&#39;)) return;<br>  await idbDelete(VAULT_KEY);<br>  alert(&#39;Vault wiped locally.&#39;);<br>  location.reload();<br>}<br><br>async function onUnlock(){<br>  const p = $(&#39;pwUnlock&#39;).value;<br>  if(!p) return alert(&#39;Enter password to unlock&#39;);<br>  const stored = await idbGet(VAULT_KEY);<br>  if(!stored) return alert(&#39;No vault found. Create one first.&#39;);<br>  vaultMeta = stored;<br>  try{<br>    const res = await deriveKeyFromVaultPassword(p, stored);<br>    // set masterKey and raw<br>    masterKey = res.key;<br>    masterRaw = res.raw;<br>    // attempt to decrypt all notes<br>    unlockedNotes = [];<br>    for(const n of (stored.notes || [])){<br>      try{<br>        const ivBuf = fromB64(n.iv);<br>        const ctBuf = fromB64(n.ciphertext);<br>        const plain = await decryptCipherWithCryptoKey(masterKey, new Uint8Array(ivBuf), new Uint8Array(ctBuf));<br>        // plaintext expected to be JSON {title,body}<br>        const parsed = JSON.parse(plain);<br>        unlockedNotes.push({ id: n.id, title: parsed.title || &#39;&#39;, body: parsed.body || &#39;&#39;, created: n.created || &#39;&#39; });<br>      }catch(e){<br>        // decryption failed for this note; skip it<br>        console.warn(&#39;Failed decrypting a note (skipped):&#39;, e);<br>      }<br>    }<br>    // render UI<br>    $(&#39;lockedPane&#39;).classList.add(&#39;hidden&#39;);<br>    $(&#39;unlockedPane&#39;).classList.remove(&#39;hidden&#39;);<br>    $(&#39;btnLock&#39;).classList.remove(&#39;hidden&#39;);<br>    $(&#39;noteCount&#39;).innerText = unlockedNotes.length;<br>    renderNotesList();<br>    alert(&#39;Vault unlocked. Notes decrypted in memory only.&#39;);<br>  }catch(err){<br>    console.error(err);<br>    alert(&#39;Failed to derive key or decrypt. Wrong password or corrupted vault.&#39;);<br>    if(masterRaw) zeroBuffer(masterRaw);<br>    masterRaw = null;<br>    masterKey = null;<br>  }<br>  $(&#39;pwUnlock&#39;).value=&#39;&#39;;<br>}<br><br>function lockVault(){<br>  if(masterRaw) zeroBuffer(masterRaw);<br>  masterRaw = null;<br>  masterKey = null;<br>  unlockedNotes = [];<br>  $(&#39;unlockedPane&#39;).classList.add(&#39;hidden&#39;);<br>  $(&#39;lockedPane&#39;).classList.remove(&#39;hidden&#39;);<br>  $(&#39;btnLock&#39;).classList.add(&#39;hidden&#39;);<br>  $(&#39;noteTitle&#39;).value=&#39;&#39;; $(&#39;noteBody&#39;).value=&#39;&#39;; $(&#39;btnSave&#39;).disabled=true;<br>  $(&#39;noteCount&#39;).innerText = 0;<br>  alert(&#39;Vault locked. Key material cleared from memory references (best-effort).&#39;);<br>}<br><br>// render notes<br>function renderNotesList(){<br>  const container = $(&#39;notesList&#39;); container.innerHTML=&#39;&#39;;<br>  const q = $(&#39;search&#39;).value.toLowerCase();<br>  const list = unlockedNotes.filter(n=&gt; !q || n.title.toLowerCase().includes(q) || n.body.toLowerCase().includes(q));<br>  for(const note of list){<br>    const el = document.createElement(&#39;div&#39;); el.className=&#39;note&#39;; el.tabIndex=0;<br>    const left = document.createElement(&#39;div&#39;);<br>    const t = document.createElement(&#39;div&#39;); t.className=&#39;title&#39;; t.textContent = note.title || &#39;(no title)&#39;;<br>    const s = document.createElement(&#39;small&#39;); s.textContent = (note.body||&#39;&#39;).slice(0,120);<br>    left.appendChild(t); left.appendChild(s);<br><br>    const right = document.createElement(&#39;div&#39;); right.style.display=&#39;flex&#39;; right.style.flexDirection=&#39;column&#39;; right.style.gap=&#39;6px&#39;;<br>    const menuWrap = document.createElement(&#39;div&#39;); menuWrap.className=&#39;menu&#39;;<br>    const menuBtn = document.createElement(&#39;button&#39;); menuBtn.textContent=&#39;⋯&#39;;<br>    const menuList = document.createElement(&#39;div&#39;); menuList.className=&#39;menu-list hidden&#39;;<br>    const delBtn = document.createElement(&#39;button&#39;); delBtn.textContent=&#39;Delete&#39;;<br>    const expBtn = document.createElement(&#39;button&#39;); expBtn.textContent=&#39;Export Note&#39;;<br>    const copyBtn = document.createElement(&#39;button&#39;); copyBtn.textContent=&#39;Copy (clears 15s)&#39;;<br>    menuList.appendChild(copyBtn); menuList.appendChild(expBtn); menuList.appendChild(delBtn);<br>    menuWrap.appendChild(menuBtn); menuWrap.appendChild(menuList);<br>    menuBtn.addEventListener(&#39;click&#39;, e=&gt;{ menuList.classList.toggle(&#39;hidden&#39;); });<br>    delBtn.addEventListener(&#39;click&#39;, async e=&gt;{<br>      if(!confirm(&#39;Delete this note?&#39;)) return;<br>      unlockedNotes = unlockedNotes.filter(x=&gt;x.id !== note.id);<br>      await persistNotesToVault();<br>      renderNotesList();<br>    });<br>    expBtn.addEventListener(&#39;click&#39;, e=&gt;{<br>      const blob = new Blob([ JSON.stringify({id:note.id,title:note.title,body:note.body,created:note.created},null,2) ],{type:&#39;application/json&#39;});<br>      const a = document.createElement(&#39;a&#39;); a.href = URL.createObjectURL(blob); a.download = `note-${note.id}.json`; a.click();<br>    });<br>    copyBtn.addEventListener(&#39;click&#39;, async e=&gt;{<br>      try{<br>        await navigator.clipboard.writeText(note.body || note.title || &#39;&#39;);<br>        alert(&#39;Copied. Clipboard will be cleared in 15s.&#39;);<br>        setTimeout(async ()=&gt;{ try{ await navigator.clipboard.writeText(&#39;&#39;); }catch(e){} },15000);<br>      }catch(err){ alert(&#39;Clipboard failed&#39;); }<br>    });<br><br>    right.appendChild(menuWrap);<br>    el.appendChild(left); el.appendChild(right);<br>    el.addEventListener(&#39;click&#39;, ()=&gt;{ $(&#39;noteTitle&#39;).value=note.title; $(&#39;noteBody&#39;).value=note.body; $(&#39;btnSave&#39;).disabled=false; $(&#39;btnSave&#39;).dataset.id = note.id; });<br>    container.appendChild(el);<br>  }<br>  $(&#39;noteCount&#39;).innerText = unlockedNotes.length;<br>}<br><br>// note CRUD<br>function onNewNote(){<br>  $(&#39;noteTitle&#39;).value=&#39;&#39;; $(&#39;noteBody&#39;).value=&#39;&#39;; $(&#39;btnSave&#39;).disabled=false; delete $(&#39;btnSave&#39;).dataset.id;<br>}<br><br>async function onSaveNote(){<br>  if(!masterKey) return alert(&#39;Vault must be unlocked to save.&#39;);<br>  const id = $(&#39;btnSave&#39;).dataset.id || uuidv4();<br>  const title = $(&#39;noteTitle&#39;).value;<br>  const body = $(&#39;noteBody&#39;).value;<br>  const created = new Date().toISOString();<br>  const plaintext = JSON.stringify({ title, body });<br>  const { iv, ciphertext } = await encryptPlaintextWithCryptoKey(masterKey, plaintext);<br>  const stored = await idbGet(VAULT_KEY);<br>  if(!stored) return alert(&#39;Vault missing from storage!&#39;);<br>  stored.notes = stored.notes || [];<br>  const noteEntry = { id, iv: toB64(iv.buffer), ciphertext: toB64(ciphertext.buffer), created };<br>  const idx = stored.notes.findIndex(n=&gt;n.id===id);<br>  if(idx &gt;= 0) stored.notes[idx] = noteEntry; else stored.notes.push(noteEntry);<br>  await idbPut(VAULT_KEY, stored);<br><br>  // update in-memory<br>  const existingIdx = unlockedNotes.findIndex(n=&gt;n.id===id);<br>  const plainObj = { id, title, body, created };<br>  if(existingIdx &gt;= 0) unlockedNotes[existingIdx] = plainObj; else unlockedNotes.push(plainObj);<br>  $(&#39;noteTitle&#39;).value=&#39;&#39;; $(&#39;noteBody&#39;).value=&#39;&#39;; $(&#39;btnSave&#39;).disabled=true;<br>  renderNotesList();<br>  alert(&#39;Note saved (encrypted at rest).&#39;);<br>}<br><br>async function persistNotesToVault(){<br>  const stored = await idbGet(VAULT_KEY);<br>  if(!stored) return;<br>  stored.notes = [];<br>  for(const n of unlockedNotes){<br>    const plaintext = JSON.stringify({ title: n.title, body: n.body });<br>    const { iv, ciphertext } = await encryptPlaintextWithCryptoKey(masterKey, plaintext);<br>    stored.notes.push({ id: n.id, iv: toB64(iv.buffer), ciphertext: toB64(ciphertext.buffer), created: n.created });<br>  }<br>  await idbPut(VAULT_KEY, stored);<br>}<br><br>// export<br>async function onExportVault(){<br>  const stored = await idbGet(VAULT_KEY);<br>  if(!stored) return alert(&#39;No vault to export&#39;);<br>  stored.kdfParams = stored.kdfParams || { salt: toB64(crypto.getRandomValues(new Uint8Array(SALT_BYTES)).buffer), iterations: ITERATIONS };<br>  const blob = new Blob([JSON.stringify(stored,null,2)],{type:&#39;application/json&#39;});<br>  const a = document.createElement(&#39;a&#39;); a.href = URL.createObjectURL(blob); a.download = &#39;vault-export.json&#39;; a.click();<br>}<br><br>// init<br>init();<br><br>// auto-lock on blur (optional)<br>window.addEventListener(&#39;blur&#39;, ()=&gt;{ if(masterKey) lockVault(); });<br><br>&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><h3>Conclusion</h3><p>This mini-project might be simple, but it demonstrates powerful concepts:<br>local encryption, secure password-drawn keys, encrypted data persistence, and client-side crypto design.</p><p>If you’re learning cybersecurity or building practical infosec tools, this is a great addition to your portfolio — lightweight, secure, and easy to explain in interviews.</p><p>Stay tuned for more hands-on security projects.<br>Happy hacking! UwU</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e0c6d20c7bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cybersecurity Project#3 - Building JavaScript Analyzer for Secrets, PII & Red Flags]]></title>
            <link>https://medium.com/@abdulbasitpriv/cyber-security-project-building-javascript-analyzer-for-secrets-pii-red-flags-612125f4af81?source=rss-9420c21a5c0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/612125f4af81</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Abdul Basit Khan]]></dc:creator>
            <pubDate>Wed, 03 Dec 2025 07:11:09 GMT</pubDate>
            <atom:updated>2025-12-03T07:13:53.927Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o0EF5GTH3nuFqXXUrrA8qA.png" /></figure><p>Project 3 in beginner friendly cyber security projects is “JS File Analyzer”</p><p>Hardcoded secrets in JavaScript are one of the most common causes of leaked AWS keys, internal URLs, credentials, and sensitive user data.<br>During penetration tests and code reviews, I frequently come across:</p><p>Exposed API keys<br>Internal IPs and admin URLs<br>JWTs and session tokens<br>Emails, phone numbers, or other PII<br>Obfuscated or malicious JavaScript payloads</p><p>To simplify the process of quickly scanning JS files for sensitive content, I built a pure Python analyzer no external libraries, no Node.js, no heavy AST parsing.<br>Just Python, regex, and smart detection logic so that you dont have to go through hectic installation of libraries or adding stuff in env variables or any other complex task.</p><p><strong>This tool is especially useful for:</strong><br>Pentesters analyzing JS bundles during web app tests<br>Bug bounty hunters scanning minified JS<br>Developers validating code before production<br>Security engineers checking for leaks in CI/CD<br>Students building cybersecurity projects</p><h3>FULL PYTHON SCRIPT</h3><pre># ------------------------------<br># Project by Adbul Basit Khan<br># medium: https://medium.com/@abdulbasitpriv<br># ------------------------------<br><br>import re<br>import sys<br>import json<br>import math<br><br># ------------------------------<br># REGEX PATTERNS<br># ------------------------------<br>PATTERNS = {<br>    &quot;Email&quot;: r&quot;[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+&quot;,<br>    &quot;IPv4&quot;: r&quot;\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b&quot;,<br>    &quot;IPv6&quot;: r&quot;\b(?:[A-Fa-f0-9]{1,4}:){1,7}[A-Fa-f0-9]{1,4}\b&quot;,<br>    &quot;URL&quot;: r&quot;https?://[^\s\&quot;&#39;]+&quot;,<br>    &quot;AWS Access Key&quot;: r&quot;AKIA[0-9A-Z]{16}&quot;,<br>    &quot;JWT&quot;: r&quot;[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+&quot;,<br>    &quot;API Key&quot;: r&quot;(?i)(api|access|secret|auth)[ _-]?(key|token)[&#39;\&quot;]?\s*[:=]\s*[&#39;\&quot;][A-Za-z0-9\-_]{8,}[&#39;\&quot;]&quot;,<br>    &quot;Password&quot;: r&quot;(?i)password[&#39;\&quot;]?\s*[:=]\s*[&#39;\&quot;][^&#39;\&quot;]+[&#39;\&quot;]&quot;,<br>    &quot;Secret Var&quot;: r&quot;(?i)(secret|token|key)[&#39;\&quot;]?\s*[:=]\s*[&#39;\&quot;][^&#39;\&quot;]+[&#39;\&quot;]&quot;,<br>}<br><br># ------------------------------<br># ENTROPY FUNCTION<br># ------------------------------<br>def shannon_entropy(data):<br>    if not data:<br>        return 0<br>    entropy = 0<br>    for x in set(data):<br>        p_x = data.count(x) / len(data)<br>        entropy += - p_x * math.log2(p_x)<br>    return round(entropy, 2)<br><br># ------------------------------<br># REMOVE COMMENTS<br># ------------------------------<br>def remove_comments(js):<br>    # remove /* ... */ comments<br>    js = re.sub(r&quot;/\*.*?\*/&quot;, &quot;&quot;, js, flags=re.DOTALL)<br>    # remove // ... comments<br>    js = re.sub(r&quot;//.*&quot;, &quot;&quot;, js)<br>    return js<br><br># ------------------------------<br># FIND STRING LITERALS<br># ------------------------------<br>def extract_strings(js):<br>    # Match single and double-quoted strings<br>    return re.findall(r&quot;([&#39;\&quot;])(?:(?=(\\?))\2.)*?\1&quot;, js)<br><br># ------------------------------<br># SCAN FUNCTION<br># ------------------------------<br>def analyze_js(js_code):<br>    findings = []<br><br>    js_code_nocomments = remove_comments(js_code)<br>    lines = js_code_nocomments.split(&quot;\n&quot;)<br><br>    for lineno, line in enumerate(lines, start=1):<br>        # Scan regex patterns<br>        for name, pattern in PATTERNS.items():<br>            for match in re.finditer(pattern, line):<br>                value = match.group()<br>                findings.append({<br>                    &quot;type&quot;: name,<br>                    &quot;value&quot;: value,<br>                    &quot;line&quot;: lineno,<br>                    &quot;entropy&quot;: shannon_entropy(value)<br>                })<br><br>        # Scan string literals for high entropy<br>        for quote, _ in extract_strings(line):<br>            s = quote<br>            if len(s) &gt;= 20:  # arbitrary threshold<br>                entropy = shannon_entropy(s)<br>                if entropy &gt; 4.0:<br>                    findings.append({<br>                        &quot;type&quot;: &quot;High Entropy String&quot;,<br>                        &quot;value&quot;: s,<br>                        &quot;line&quot;: lineno,<br>                        &quot;entropy&quot;: entropy<br>                    })<br><br>    return findings<br><br># ------------------------------<br># MAIN<br># ------------------------------<br>if __name__ == &quot;__main__&quot;:<br>    if len(sys.argv) &lt; 2:<br>        print(&quot;Usage: python jsanalyzer.py &lt;file.js&gt;&quot;)<br>        sys.exit(1)<br><br>    filename = sys.argv[1]<br><br>    try:<br>        with open(filename, &quot;r&quot;, encoding=&quot;utf-8&quot;, errors=&quot;ignore&quot;) as f:<br>            js_content = f.read()<br>    except Exception as e:<br>        print(f&quot;[Error reading file]: {e}&quot;)<br>        sys.exit(1)<br><br>    results = analyze_js(js_content)<br><br>    print(json.dumps(results, indent=4))</pre><p>Save the file as jsanalyzer.py</p><h3>HOW TO RUN</h3><pre>cd xyz/jsanalyzer/ (open terminal or cd to dir where tool is)<br>python jsanalyzer.py &lt;targetfile.js&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8O8qCOLyIvW0t2jMUaQ8tQ.png" /></figure><p>this is how the output will look like.</p><p>This project is intentionally simple but powerful.<br>It’s the kind of tool that:<br>beginners can understand and learn from,<br>pentesters can use in the field, and<br>security engineers can extend into a bigger product.</p><p>If you’re learning cybersecurity, building tools like this is one of the best ways to grow your skills, understand patterns, and create portfolio-ready work.</p><p>Go Ahead create this script run it and put it on your CV to standout from other freshies or even experienced employees</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=612125f4af81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cybersecurity Project #2 — Secure Password Generator with Strength Meter (Beginner Friendly)]]></title>
            <link>https://medium.com/@abdulbasitpriv/cybersecurity-project-2-secure-password-generator-with-strength-meter-beginner-friendly-acc94eaeb6f9?source=rss-9420c21a5c0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/acc94eaeb6f9</guid>
            <category><![CDATA[passwords]]></category>
            <category><![CDATA[password-management]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[projects]]></category>
            <dc:creator><![CDATA[Abdul Basit Khan]]></dc:creator>
            <pubDate>Mon, 24 Nov 2025 19:38:18 GMT</pubDate>
            <atom:updated>2025-11-24T19:49:47.652Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cybersecurity Project #2 — Secure Password Generator with Strength Meter (Beginner Friendly)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o0EF5GTH3nuFqXXUrrA8qA.png" /><figcaption>PROJECT 2 — Secure Password Generator with Strenght Meter</figcaption></figure><p>Passwords are still the first line of defense yet most users rely on predictable or weak ones. So for the second project in this beginner-friendly cybersecurity series, I built a <strong>Secure Password Generator</strong> that not only creates strong passwords but also <em>calculates their exact strength</em> based on entropy and complexity.</p><p>This project is perfect for:<br>Aspiring penetration testers<br>Students building their CV<br>Anyone wanting a practical understanding of password security<br>Developers who want to integrate strength checks into apps</p><h3>What the Project Does</h3><p>This tool generates secure passwords using:<br>Uppercase / lowercase / digits / symbols<br>Custom length<br>Randomness using secrets (cryptographically safe)<br>Pattern-avoidance checks<br>Entropy-based strength scoring<br>A real-time strength meter (Weak → Medium → Strong → Very Strong)</p><h4>TECH STACK</h4><p>This project uses python, secrets library for secure randomness, string for controlled character sets and entropy formula that is log2(pool_size^lenght)</p><h4>STEP BY STEP GUIDE</h4><ol><li>First of all create a folder please so that your projects look managed ;-;</li><li>Create a text file and paste the following code</li></ol><pre>&lt;!doctype html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>&lt;meta charset=&quot;utf-8&quot; /&gt;<br>&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,initial-scale=1&quot; /&gt;<br>&lt;title&gt;Secure Password Generator + Strength Meter&lt;/title&gt;<br>&lt;style&gt;<br>  :root{<br>    --bg:#0b0f14; --card:#0f1720; --muted:#9aa7b2; --accent:#7ee787;<br>    --danger:#ff6b6b; --glass: rgba(255,255,255,0.03);<br>  }<br>  html,body{height:100%;margin:0;background:linear-gradient(180deg,#071019 0%, #0b0f14 100%);font-family:Inter,system-ui,Segoe UI,Roboto,Helvetica,Arial; color:#e6eef6}<br>  .wrap{max-width:820px;margin:40px auto;padding:24px;background:var(--card);border-radius:12px;box-shadow:0 8px 30px rgba(0,0,0,0.7)}<br>  h1{margin:0 0 8px;font-size:20px}<br>  .row{display:flex;gap:12px;align-items:center;margin:12px 0}<br>  label{font-size:13px;color:var(--muted)}<br>  input[type=&quot;range&quot;]{width:240px}<br>  .chip{display:inline-flex;align-items:center;padding:6px 10px;border-radius:8px;background:var(--glass);font-size:13px}<br>  .pwbox{display:flex;gap:8px;align-items:center}<br>  .pw{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;background:transparent;border:1px dashed rgba(255,255,255,0.03);padding:10px;border-radius:8px;min-width:320px;color:#cfe9ff}<br>  button{background:#0ea5a5;border:none;padding:8px 12px;border-radius:8px;color:#042022;cursor:pointer}<br>  button.ghost{background:transparent;border:1px solid rgba(255,255,255,0.04);color:var(--muted)}<br>  .meter{height:12px;background:rgba(255,255,255,0.04);border-radius:6px;overflow:hidden;width:100%}<br>  .meter-fill{height:100%;width:0;transition:width 220ms ease}<br>  .small{font-size:12px;color:var(--muted)}<br>  .controls{display:grid;grid-template-columns:1fr 1fr;gap:12px}<br>  .footer{display:flex;justify-content:space-between;align-items:center;margin-top:18px}<br>  @media(max-width:640px){.controls{grid-template-columns:1fr}}<br>&lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>  &lt;div class=&quot;wrap&quot; role=&quot;main&quot; aria-labelledby=&quot;title&quot;&gt;<br>    &lt;h1 id=&quot;title&quot;&gt;Secure Password Generator + Strength Meter&lt;/h1&gt;<br>    &lt;p class=&quot;small&quot;&gt;Client-side only. Uses crypto RNG. Never sends passwords to servers.&lt;/p&gt;<br><br>    &lt;div class=&quot;row pwbox&quot; style=&quot;margin-top:10px&quot;&gt;<br>      &lt;input id=&quot;password&quot; class=&quot;pw&quot; readonly aria-readonly=&quot;true&quot; value=&quot;Click Generate&quot; /&gt;<br>      &lt;div style=&quot;display:flex;flex-direction:column;gap:8px&quot;&gt;<br>        &lt;button id=&quot;generate&quot;&gt;Generate&lt;/button&gt;<br>        &lt;button id=&quot;copy&quot; class=&quot;ghost&quot;&gt;Copy&lt;/button&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br><br>    &lt;div class=&quot;row controls&quot;&gt;<br>      &lt;div&gt;<br>        &lt;label for=&quot;length&quot;&gt;Length: &lt;span id=&quot;lenVal&quot; class=&quot;chip&quot;&gt;12&lt;/span&gt;&lt;/label&gt;<br>        &lt;div class=&quot;row&quot; style=&quot;align-items:center&quot;&gt;<br>          &lt;input type=&quot;range&quot; id=&quot;length&quot; min=&quot;6&quot; max=&quot;64&quot; value=&quot;12&quot; /&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br><br>      &lt;div&gt;<br>        &lt;label&gt;Options&lt;/label&gt;<br>        &lt;div style=&quot;display:flex;flex-direction:column;gap:6px;margin-top:6px&quot;&gt;<br>          &lt;label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;useLower&quot; checked&gt; Lowercase&lt;/label&gt;<br>          &lt;label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;useUpper&quot; checked&gt; Uppercase&lt;/label&gt;<br>          &lt;label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;useDigits&quot; checked&gt; Digits&lt;/label&gt;<br>          &lt;label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;useSymbols&quot; checked&gt; Symbols&lt;/label&gt;<br>          &lt;label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;avoidAmbig&quot;&gt; Avoid ambiguous (0,O,l,1,i)&lt;/label&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br><br>    &lt;div style=&quot;margin-top:12px&quot;&gt;<br>      &lt;div style=&quot;display:flex;justify-content:space-between;align-items:center&quot;&gt;<br>        &lt;div class=&quot;small&quot;&gt;Strength: &lt;strong id=&quot;strengthLabel&quot;&gt;—&lt;/strong&gt;&lt;/div&gt;<br>        &lt;div class=&quot;small&quot;&gt;Entropy: &lt;strong id=&quot;entropyBits&quot;&gt;—&lt;/strong&gt; bits&lt;/div&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;meter&quot; style=&quot;margin-top:8px&quot; aria-hidden=&quot;true&quot;&gt;<br>        &lt;div id=&quot;meterFill&quot; class=&quot;meter-fill&quot;&gt;&lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br><br>    &lt;div class=&quot;footer&quot;&gt;<br>      &lt;div class=&quot;small&quot;&gt;Tip: prefer using a password manager to store generated passwords.&lt;/div&gt;<br>      &lt;div class=&quot;small&quot;&gt;Made for demo — do not store generated secrets in localStorage.&lt;/div&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br><br>&lt;script&gt;<br>/* ---------- Utilities: crypto-safe integer &amp; shuffle ---------- */<br>function cryptoRandomInt(maxExclusive){<br>  // returns integer in [0, maxExclusive)<br>  if (maxExclusive &lt;= 0) throw new Error(&#39;maxExclusive must be &gt; 0&#39;);<br>  const maxUint32 = 0xffffffff;<br>  const range = maxExclusive;<br>  const limit = Math.floor((maxUint32 + 1) / range) * range;<br>  const arr = new Uint32Array(1);<br>  while(true){<br>    crypto.getRandomValues(arr);<br>    const r = arr[0];<br>    if (r &lt; limit) return r % range;<br>  }<br>}<br><br>function cryptoShuffle(array){<br>  // Fisher-Yates using cryptoRandomInt<br>  for (let i = array.length - 1; i &gt; 0; i--){<br>    const j = cryptoRandomInt(i + 1);<br>    [array[i], array[j]] = [array[j], array[i]];<br>  }<br>  return array;<br>}<br><br>/* ---------- Character classes ---------- */<br>const CLASSES = {<br>  lower: &#39;abcdefghijklmnopqrstuvwxyz&#39;,<br>  upper: &#39;ABCDEFGHIJKLMNOPQRSTUVWXYZ&#39;,<br>  digits: &#39;0123456789&#39;,<br>  symbols: &#39;!@#$%^&amp;*()-_=+[]{};:,.&lt;&gt;/?~`|\\&#39;<br>};<br><br>const AMBIGUOUS = new Set([&#39;0&#39;,&#39;O&#39;,&#39;o&#39;,&#39;I&#39;,&#39;l&#39;,&#39;1&#39;,&#39;|&#39;]);<br><br>/* ---------- Generation logic ---------- */<br>function buildCharset(opts){<br>  let chars = &#39;&#39;;<br>  if (opts.lower) chars += CLASSES.lower;<br>  if (opts.upper) chars += CLASSES.upper;<br>  if (opts.digits) chars += CLASSES.digits;<br>  if (opts.symbols) chars += CLASSES.symbols;<br>  if (opts.avoidAmbig){<br>    chars = Array.from(chars).filter(c =&gt; !AMBIGUOUS.has(c)).join(&#39;&#39;);<br>  }<br>  return chars;<br>}<br><br>function selectOneFromClass(cls, avoidAmbig){<br>  let pool = cls;<br>  if (avoidAmbig) pool = Array.from(pool).filter(c =&gt; !AMBIGUOUS.has(c)).join(&#39;&#39;);<br>  if (!pool.length) throw new Error(&#39;Character class is empty after ambiguous removal&#39;);<br>  return pool[cryptoRandomInt(pool.length)];<br>}<br><br>function generatePassword({length=12, lower=true, upper=true, digits=true, symbols=true, avoidAmbig=false}){<br>  // Validate at least one class selected<br>  const selected = [];<br>  if (lower) selected.push(&#39;lower&#39;);<br>  if (upper) selected.push(&#39;upper&#39;);<br>  if (digits) selected.push(&#39;digits&#39;);<br>  if (symbols) selected.push(&#39;symbols&#39;);<br>  if (selected.length === 0) throw new Error(&#39;Select at least one character class&#39;);<br><br>  // Build full charset and pool_size<br>  const fullCharset = buildCharset({lower,upper,digits,symbols,avoidAmbig});<br>  if (!fullCharset.length) throw new Error(&#39;Effective charset is empty&#39;);<br><br>  // Guarantee one char from each selected class<br>  const pwChars = [];<br>  for (const c of selected){<br>    pwChars.push(selectOneFromClass(CLASSES[c], avoidAmbig));<br>  }<br><br>  // Fill the rest from the full charset<br>  for (let i = pwChars.length; i &lt; length; i++){<br>    const idx = cryptoRandomInt(fullCharset.length);<br>    pwChars.push(fullCharset[idx]);<br>  }<br><br>  // Shuffle securely<br>  cryptoShuffle(pwChars);<br>  return pwChars.join(&#39;&#39;);<br>}<br><br>/* ---------- Entropy &amp; strength ---------- */<br>function entropyBits(length, poolSize){<br>  // Entropy = length * log2(poolSize)<br>  return length * (Math.log2(poolSize));<br>}<br><br>function strengthLabel(bits){<br>  if (bits &lt; 28) return &#39;Very weak&#39;;<br>  if (bits &lt; 36) return &#39;Weak&#39;;<br>  if (bits &lt; 60) return &#39;Moderate&#39;;<br>  if (bits &lt; 128) return &#39;Strong&#39;;<br>  return &#39;Very strong&#39;;<br>}<br><br>/* ---------- UI wiring ---------- */<br>const ui = {<br>  length: document.getElementById(&#39;length&#39;),<br>  lenVal: document.getElementById(&#39;lenVal&#39;),<br>  useLower: document.getElementById(&#39;useLower&#39;),<br>  useUpper: document.getElementById(&#39;useUpper&#39;),<br>  useDigits: document.getElementById(&#39;useDigits&#39;),<br>  useSymbols: document.getElementById(&#39;useSymbols&#39;),<br>  avoidAmbig: document.getElementById(&#39;avoidAmbig&#39;),<br>  generate: document.getElementById(&#39;generate&#39;),<br>  copy: document.getElementById(&#39;copy&#39;),<br>  password: document.getElementById(&#39;password&#39;),<br>  strengthLabel: document.getElementById(&#39;strengthLabel&#39;),<br>  entropyBits: document.getElementById(&#39;entropyBits&#39;),<br>  meterFill: document.getElementById(&#39;meterFill&#39;)<br>};<br><br>function updateStrengthDisplay(pwText, opts){<br>  const poolSize = buildCharset(opts).length;<br>  const bits = entropyBits(pwText.length, poolSize);<br>  ui.entropyBits.textContent = bits.toFixed(2);<br>  ui.strengthLabel.textContent = strengthLabel(bits);<br><br>  // Meter: map bits -&gt; percent (cap at 100)<br>  // For visualization map 0..128 bits to 0..100%<br>  const pct = Math.min(100, (bits / 128) * 100);<br>  ui.meterFill.style.width = pct + &#39;%&#39;;<br>  // color by level<br>  let color = &#39;&#39;;<br>  if (bits &lt; 36) color = &#39;linear-gradient(90deg,#ff6b6b,#ff8a6b)&#39;;<br>  else if (bits &lt; 60) color = &#39;linear-gradient(90deg,#ffb86b,#ffd36b)&#39;;<br>  else color = &#39;linear-gradient(90deg,#7ee787,#39d353)&#39;;<br>  ui.meterFill.style.background = color;<br>}<br><br>function readOptions(){<br>  return {<br>    length: parseInt(ui.length.value, 10),<br>    lower: ui.useLower.checked,<br>    upper: ui.useUpper.checked,<br>    digits: ui.useDigits.checked,<br>    symbols: ui.useSymbols.checked,<br>    avoidAmbig: ui.avoidAmbig.checked<br>  };<br>}<br><br>ui.length.addEventListener(&#39;input&#39;, () =&gt; {<br>  ui.lenVal.textContent = ui.length.value;<br>  // recompute strength for placeholder password length<br>  const opts = readOptions();<br>  const fakePool = buildCharset(opts).length || 1;<br>  const bits = entropyBits(parseInt(ui.length.value,10), fakePool);<br>  ui.entropyBits.textContent = bits.toFixed(2);<br>  ui.strengthLabel.textContent = strengthLabel(bits);<br>  ui.meterFill.style.width = Math.min(100,(bits/128)*100) + &#39;%&#39;;<br>});<br><br>ui.generate.addEventListener(&#39;click&#39;, () =&gt; {<br>  try {<br>    const opts = readOptions();<br>    const pwd = generatePassword(opts);<br>    ui.password.value = pwd;<br>    updateStrengthDisplay(pwd, opts);<br>  } catch (e){<br>    alert(&#39;Error: &#39; + e.message);<br>  }<br>});<br><br>ui.copy.addEventListener(&#39;click&#39;, async () =&gt; {<br>  try {<br>    const text = ui.password.value;<br>    if (!text) return;<br>    await navigator.clipboard.writeText(text);<br>    ui.copy.textContent = &#39;Copied!&#39;;<br>    setTimeout(()=&gt; ui.copy.textContent = &#39;Copy&#39;, 1500);<br>  } catch (e){<br>    alert(&#39;Clipboard write failed: &#39; + e.message);<br>  }<br>});<br><br>// initialize display<br>(function init(){<br>  ui.lenVal.textContent = ui.length.value;<br>  ui.generate.click();<br>})();<br>&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>3. Save the file as securepassgen.html<br>4. Open the file 😐<br>5. This is what you all will see</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R4imIOF4AkTKuHfjJjeihw.png" /></figure><p>And our second project is ready, it generates passwords for you and shows how strong the password is. It also gives you the freedom to choose how complex you want it and how many letters. The strenght depends on you as it does not force anything and simply generates a password. the strenght meter will show how strong your password is so if you generate a short easy password the meter will tell you its weak, you better use it at your own risk ;-;</p><p>My linkedin: <a href="https://www.linkedin.com/in/abdulbasitkhan2002/">https://www.linkedin.com/in/abdulbasitkhan2002/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acc94eaeb6f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[File Integrity Checker — FIM]]></title>
            <link>https://medium.com/@abdulbasitpriv/file-integrity-checker-fim-c1c4faf7bdfd?source=rss-9420c21a5c0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1c4faf7bdfd</guid>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[file-integrity-monitoring]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Abdul Basit Khan]]></dc:creator>
            <pubDate>Sun, 23 Nov 2025 18:21:11 GMT</pubDate>
            <atom:updated>2025-11-23T18:21:11.970Z</atom:updated>
            <content:encoded><![CDATA[<h3>File Integrity Checker — FIM</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o0EF5GTH3nuFqXXUrrA8qA.png" /><figcaption>PROJECT 1 — FIM</figcaption></figure><p>Hi guys welcome to beginners cyber security projects. I am on a journey to help students and beginners in cyber security create their projects and make their CVs look cooler and stand out from others.<br>Linkedin <a href="https://www.linkedin.com/in/abdulbasitkhan2002/">https://www.linkedin.com/in/abdulbasitkhan2002/</a></p><h3>Project 1 — FIM</h3><p>FIM or File Integrity Monitor is a tool for checking if a file is tampered or original. for example: a confidential file is being shared within a department, we have to make sure that this file is original and nothing has been changed so we use FIM which matches hashes of the files.</p><p>1. What is a hash?<br>A hash is a file’s fingerprint.<br>If the file changes even 1 byte the hash changes.</p><p>2. What is a baseline?<br>Baseline = “Last known good hash stored previously.”</p><p>3. How does integrity check work?<br>Calculate the file hash now<br>Compare it to baseline<br>If different → file has been changed<br>Then update the baseline<br>This is exactly what Wazuh, Tripwire, AIDE, OSSEC do at a basic level.</p><h4>Step by Step Process</h4><p>Here’s the logic we will implement:</p><ol><li>Ask user for file path</li><li>Calculate SHA-256 hash</li><li>Check if baseline exists</li><li>If not → create baseline</li><li>If yes → compare current hash with baseline</li><li>If different → alert user</li><li>Update baseline with new hash.</li></ol><h4>CODE</h4><pre>import hashlib<br>import json<br>import os<br><br>BASELINE_FILE = &quot;baseline.json&quot;<br><br># Function to calculate SHA-256 hash of a file<br>def calculate_hash(file_path):<br>    sha256 = hashlib.sha256()<br>    <br>    with open(file_path, &quot;rb&quot;) as f:<br>        while chunk := f.read(4096):<br>            sha256.update(chunk)<br>    <br>    return sha256.hexdigest()<br><br># Load baseline from JSON<br>def load_baseline():<br>    if not os.path.exists(BASELINE_FILE):<br>        return None<br>    <br>    with open(BASELINE_FILE, &quot;r&quot;) as f:<br>        return json.load(f)<br><br># Save baseline to JSON<br>def save_baseline(hash_value):<br>    with open(BASELINE_FILE, &quot;w&quot;) as f:<br>        json.dump({&quot;baseline_hash&quot;: hash_value}, f, indent=4)<br><br>def main():<br>    file_path = input(&quot;Enter the path of the file to monitor: &quot;).strip()<br><br>    if not os.path.exists(file_path):<br>        print(&quot;❌ File does not exist.&quot;)<br>        return<br><br>    # Step 1: Calculate current file hash<br>    current_hash = calculate_hash(file_path)<br>    print(f&quot;\nCurrent File Hash:\n{current_hash}\n&quot;)<br><br>    # Step 2: Load baseline (if exists)<br>    baseline = load_baseline()<br><br>    if baseline is None:<br>        print(&quot;📌 No baseline found. Creating a new baseline...&quot;)<br>        save_baseline(current_hash)<br>        print(&quot;✔ Baseline created successfully.&quot;)<br>        return<br><br>    baseline_hash = baseline[&quot;baseline_hash&quot;]<br><br>    # Step 3: Compare hashes<br>    if current_hash == baseline_hash:<br>        print(&quot;🟢 File is clean. No modifications detected.&quot;)<br>    else:<br>        print(&quot;⚠️ WARNING: File HAS BEEN MODIFIED!&quot;)<br>        print(&quot;Previous Hash:&quot;, baseline_hash)<br>        print(&quot;New Hash:     &quot;, current_hash)<br><br>    # Step 4: Update baseline<br>    save_baseline(current_hash)<br>    print(&quot;\n🔄 Baseline updated.&quot;)<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><p>Save this code as checker.py as this is a python script.</p><p>Here is how our folder will look like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*sZSWdKAaQ1On8gmx0xjM2A.png" /></figure><p>checker.py is our script/tool and baseline.json is auto generated by the script. The script stores current hash of the file in baseline.json and when u run it again it matches the hash with hash stored already.</p><p>To test it we will, create a file confidential.txt and verify it using the script</p><pre>python checker.py</pre><p>run this command while in folder</p><p>then you will be prompted to enter the path to the file, add file path and hit enter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fRdWtDegri3aY2dnFvQZhQ.png" /></figure><p>the script verifies the hashes and prompts file is clean.</p><p>lets tamper with the file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iF2ECrPNx8ZKrJJNdd11jw.png" /></figure><p>I changed the contents of confidential.txt and then verified the hashes and voila it prompts that the file has been modified.</p><h4>TOOL BEHAVIOR</h4><p><strong>First Run<br></strong>No baseline → tool creates baseline<br>Says: “Baseline created successfully.”</p><p><strong>Second Run</strong><br>Compares current hash to baseline<br>If unchanged → “File is clean.”<br>If changed → “WARNING: File HAS BEEN MODIFIED!”<br>Then updates baseline.</p><p>I hope you guys learnt something today, create this project understand how it works and add it to your CV ;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1c4faf7bdfd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Decompile, Modify, Bypass SSL Pinning and Rebuild Split APKs — A Hacker’s Guide]]></title>
            <link>https://medium.com/@abdulbasitpriv/how-to-decompile-modify-bypass-ssl-pinning-and-rebuild-split-apks-a-hackers-guide-af69ddcd49e7?source=rss-9420c21a5c0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/af69ddcd49e7</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[apk-split]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[ssl-pinning-bypass]]></category>
            <dc:creator><![CDATA[Abdul Basit Khan]]></dc:creator>
            <pubDate>Wed, 05 Mar 2025 09:04:22 GMT</pubDate>
            <atom:updated>2025-03-05T09:18:54.906Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Decompile, Modify, Bypass SSL Pinning and Rebuild Split APKs — A Hacker’s Guide</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ve91i0Eo7l9fi612KK-3gg.png" /><figcaption>UwU</figcaption></figure><p>In this guide, we’ll <strong>deep dive into working with split APKs</strong> — covering everything from <strong>extraction and decompilation</strong> to <strong>bypassing protections, repackaging, and signing the APKs</strong> for successful deployment. Whether you’re a cybersecurity researcher, ethical hacker, or Android enthusiast, this article will equip you with the skills to manipulate and analyze split APKs like a pro.</p><p>Ready to break down the barriers of Android security? Let’s get started! 🚀</p><p>Alright so first of all let me tell you what split APKs are, when one application is divided into multiple APKs to lower application size, better performance and optimization etc. The app is divided into base.apk and split configuration apks. Unlike traditional APKs, <strong>split APKs must be installed together</strong>, as installing only the base APK will result in a broken or incomplete app.</p><p>Lets get right into it</p><p>The tools we will need are</p><p>ADB</p><p>Visual Studio</p><p>VS extension APK LAB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iYwVHVHLwB_ox32PR2ynlw.png" /><figcaption>error message while installing base.apk when you are missing split apks</figcaption></figure><p>Ever encountered this issue? That is because you are trying to install an apk using ADB like usual but this time its missing split apks. This means that the app you are trying to install does not have a standalone apk instead it requires more apks including split apks and here is how we can find the rest of apks.</p><h3>EXTRACTING SPLIT APKS</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v4Q4_mUnpZNHv3wn3MIbDg.png" /></figure><p>STEPS:</p><p>run following commands</p><pre>adb shell //to connect to your device<br>su //for getting super user rights, run this command if your phone is rooted<br>cd data/app  //for getting list folders that have apks<br></pre><p>once you are in /data/local directory you will find folders with encrypted names, its really hard to find your target application like finding a needle in haystack.</p><pre>pm path com.target.app //to find the path to your app</pre><p>replace com.target.app with your application package name. To find package name you can either use FRIDA TOOL or shell command.</p><pre>pm list packages //incase you dont have frida<br>frida-ps -Uai //if you have frida up and running</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*zoReR7JUOmEvdH5-moOMiA.png" /></figure><p>as you can see in the above screenshot, once you run pm path com.xyz.app command you will get paths to all the apks related to that package similar to what i got that are</p><p>base.apk</p><p>split_config.arm64_v8a.apk</p><p>split_config.en.apk</p><p>split_config.xxhdpi.apk</p><p>These are the split apks of my target application, ill have to install all these together to actually install the app on device.</p><h3>REPACKING SPLIT APKS</h3><p>To repack or re build the split apks and install it in our device we will follow below steps</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*BonB8GpoXeBwQ9JJGMYyyA.png" /></figure><p>Keep all split APKs in one folder.</p><p>Open CMD/Powershell in that folder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LQqsb3HlQaAW-VS1-qBBog.png" /><figcaption>ignore the errors hehe</figcaption></figure><p>run command</p><pre>adb install-multiple base.apk split_config.arm64.v8a.apk split_config.en.apk split_config.xxhdpi.apk</pre><p>this command will successfully install the application in your device installing all the apks together.</p><p>Uptill now we have found and installed split APKs UwU.</p><h3>REPACKAGING ATTACK &amp; SSL PINNING BYPASS</h3><p>Finding and installing split APKs is pretty normal but lets work on repackaging attack on split apks, how to extract apks, manipulate code, bypass ssl pinning, sign applications and install them.</p><p>We already have all the APKs.</p><p><strong>USING VS CODE</strong></p><p>step 1: install APK LAB extension in VS Code</p><p>step 2: open folder containing split apks in vscode</p><p>step 3: press “ctrl + shift + p” and select apk lab, open an apk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m6-S0fgcgurcdN4TuFwRmw.png" /><figcaption>1st dropdown menu option, apklab: open an apk</figcaption></figure><p>step 4: select base.apk and open that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WNR-9j6oIehLyKkRyXwJcA.png" /><figcaption>interface after opening base.apk</figcaption></figure><p>step 5: If you want to manipulate smali code then navigate to smali then to your desired folder and smali file and edit the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fAai_1oHKWzFCyncCYiKeQ.png" /><figcaption>just example code, dont mind it UwU</figcaption></figure><p>step 6: once you have manipulated code etc, save it by pressing ctrl + s</p><p>LETS BYPASS SSL PINNING UwU</p><p>step 7: right click apktool.yaml and select prepare for HTTPS inspection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_pMUw-qfktPk-PwGEOj6dg.png" /><figcaption>this will inject its own mitm code and bypass ssl pinning</figcaption></figure><p>step 8: right click apktool.yaml and select Rebuild the apk</p><p>Once its repacked you will find it in dist folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XrPXLUU5x5PCPrNF8dpzVg.png" /><figcaption>dist-&gt;base.apk is repacked and signed</figcaption></figure><p>Our Application is ready BUT its just base.apk and not full bundle that includes split apks.</p><p><strong>NOTE</strong></p><p><strong>If you try to install split apks using above command with our modified base apk, it will give you a error claiming that the signatures used to sign apks are different because the split apks were pre signed by developers but the base.apk that we modified for https interception was signed using VS Code during the process of rebuilding the apk.</strong></p><p>step 9: repeat the process with rest of split apks, open apk then simple rebuild the apk. no need to modify them for https interception, just modifying base.apk is enough. Rebuild the remaining apks using VS Code.</p><p>step 10: keep all newly singed apks in one folder.</p><p>step 11: install them using adb install-multiple command.</p><p>And we have installed split apks and bypassed their ssl pinning. You can intercept traffic using burp suite.</p><p>Thank you for reading, we covered how to extract split apks and bypass ssl pinning and then rebuild them and install them on your device without errors.</p><p>UwU</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af69ddcd49e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Click Jacking Vulnerability: Exploitation & Prevention]]></title>
            <link>https://medium.com/@abdulbasitpriv/click-jacking-vulnerability-exploitation-prevention-01118bfa9ccb?source=rss-9420c21a5c0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/01118bfa9ccb</guid>
            <category><![CDATA[clickjacking]]></category>
            <category><![CDATA[clickbait]]></category>
            <category><![CDATA[mitigation]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[vulnerability]]></category>
            <dc:creator><![CDATA[Abdul Basit Khan]]></dc:creator>
            <pubDate>Thu, 20 Feb 2025 07:32:45 GMT</pubDate>
            <atom:updated>2025-02-20T07:33:48.341Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5RKYFifeZl_gEZeu.png" /><figcaption><a href="https://en.wikipedia.org/wiki/File:Clickjacking.png">https://en.wikipedia.org/wiki/File:Clickjacking.png</a></figcaption></figure><h3>Introduction</h3><p>Clickjacking, also known as UI Redressing, is a deceptive attack where an attacker tricks a user into clicking on something different from what they perceive. This technique overlays an invisible or disguised interface element over a legitimate page, leading users to unknowingly perform actions such as liking a post, transferring funds, or changing security settings.</p><p>In simple words, click jacking tricks user into clicking something that has a different functionality at backend but it looks totally legit on front end.</p><h3>How Clickjacking Works</h3><p>Clickjacking exploits HTML iframes and CSS styling to trick users. Attackers typically:</p><ol><li>Embed a legitimate web page inside an iframe.</li><li>Make the iframe invisible or position it precisely under a fake button.</li><li>Trick users into clicking on what they think is a harmless button while interacting with the hidden legitimate function.</li></ol><h3>How to Test for Clickjacking</h3><h3>Manual Testing</h3><ol><li>Create an HTML page with an iframe pointing to the target website.</li><li>Adjust CSS to make the iframe transparent or reposition it over a clickable element.</li><li>Interact with the iframe and check if actions are executed on the target site.</li></ol><h3>Using Burp Suite</h3><ol><li>Capture the request to the target website.</li><li>Check for the X-Frame-Options and Content-Security-Policy headers.</li><li>If missing or misconfigured, the site is vulnerable to clickjacking.</li></ol><h3>Automated Testing Tools</h3><ul><li><strong>OWASP ZAP</strong>: Detects UI redressing vulnerabilities.</li><li><strong>Clickjacking Test by Google Chrome DevTools</strong>: Allows testing frame-based attacks.</li></ul><h3>Script</h3><pre>&lt;html&gt;<br>    &lt;head&gt;<br>        &lt;title&gt;Website is vulnerable&lt;/title&gt;<br>    &lt;/head&gt;<br>    &lt;body&gt;<br>        &lt;iframe src=&quot;target url&quot; width=&quot;1080&quot; height=&quot;920&quot;&gt;&lt;/iframe&gt;<br>    &lt;/body&gt;<br>&lt;/html&gt;</pre><p>This is a simple script to test for click jacking vulnerability.</p><p>replace target url with the url you want to test for eg: <a href="https://target/login.aspx">https://target/login.aspx</a></p><p>save the file as filename.html</p><p>open the file and if it shows target url page front end then the website is vulnerable to click jacking.</p><h3>How to Prevent Clickjacking</h3><p>Use the folowing request and response headers to prevent clickjacking.</p><h4>1. X-Frame-Options Security Header</h4><p>Set the X-Frame-Options header to prevent iframe embedding:</p><pre>X-Frame-Options: DENY</pre><p>Alternatively, allow embedding only from the same origin:</p><pre>X-Frame-Options: SAMEORIGIN</pre><h4>2. Content Security Policy (CSP)</h4><p>Use frame-ancestors directive to control which domains can embed your site:</p><pre>Content-Security-Policy: frame-ancestors &#39;none&#39;;</pre><h4>3. JavaScript Frame Busting</h4><p>Implement JavaScript-based protection to prevent embedding:</p><pre>if (window.top !== window.self) {<br>    window.top.location = window.self.location;<br>}</pre><h4>4. Click Confirmation Mechanisms</h4><p>Require user interaction before executing sensitive actions (e.g., CAPTCHA, multi-step confirmation).</p><p>And thats how you exploit and prevent click jacking UwU</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01118bfa9ccb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[No Rate Limit: The Easiest Bug Bounty Payout You’re Missing]]></title>
            <link>https://medium.com/@abdulbasitpriv/no-rate-limit-the-easiest-bug-bounty-payout-youre-missing-79335e39c377?source=rss-9420c21a5c0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/79335e39c377</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[website]]></category>
            <category><![CDATA[rate-limit]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Abdul Basit Khan]]></dc:creator>
            <pubDate>Wed, 19 Feb 2025 11:30:30 GMT</pubDate>
            <atom:updated>2025-02-19T11:30:30.428Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aCkAM2qZny_8H-YXdpX4tg.png" /><figcaption>EASY BUG BOUNTY PART 1 [ RATE LIMITING ]</figcaption></figure><p>Rate limiting is a common security control used by developers to prevent abuse, brute-force attacks, and API misuse. However, misconfigurations where <strong>no rate limit</strong> is implemented can lead to serious vulnerabilities, allowing attackers to perform account takeovers, scrape data, or exploit business logic flaws.</p><p>For bug bounty hunters, <strong>no rate limit vulnerabilities</strong> are some of the easiest and most rewarding bugs to find.</p><h3>Understanding No Rate Limit Vulnerabilities</h3><p>When applications fail to enforce rate limiting, attackers can send <strong>unlimited requests</strong> without any restrictions. This is commonly found in:</p><ul><li><strong>Login Forms</strong> (leading to brute-force attacks)</li><li><strong>Password Reset &amp; Account Recovery</strong></li><li><strong>2FA &amp; OTP Validation</strong></li><li><strong>API Endpoints</strong> (leading to mass data extraction)</li><li><strong>Sensitive Actions</strong> (such as money transfers, coupon redemption, etc.)</li></ul><p>LETS DIVE INTO IT UwU</p><p>We will be finding no rate limit vulnerability and in order to do so we need a target and in my case ill be showcasing no rate limit vulnerability i found on my client web portal on send otp funtionality however generally you will need a target and burp suite to test no rate limit.</p><p>CASE SCENERIO:</p><p>The website was sending a request for generating and sending OTP. We captured that request and it had a account number parameter, we will be using that to test no rate limit.</p><p>STEPS:</p><p>Fire up burp suite</p><p>setup proxy to capture traffic</p><p>identify target such as login functionality, reset password or send otp functionality. In our case its OTP functionality.</p><p>send the request, for example: send otp or login using random credentials etc.</p><p>capture the request</p><p>send the request to intruder and identify the parameter for payload position</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*NlTn9dgZA3v1DhipW2b_mg.png" /></figure><p>Here we are using account number parameter and adding our payload position in the end of payload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dQqdh-T1uw_YWnYYx2eo3w.png" /></figure><p>We will select payload type to null payload so that it does not add anything in parameter value except for null values ( nothing ). We are doing so to send unlimited OTP that will lead to</p><ol><li>Resource Exhaustion</li><li>Flood users emails and text messages with OTPs</li></ol><p>Next we are going to verify if its vulnerable and does not have rate limitting. Start the attack and observe</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dcdb2_7z9vDn0I16KOahRA.png" /></figure><p>As we can see over here that all the requests are going through and giving a response code 200 and in response there is a success parameter value too pointing that otp was successfully sent. This proves that vulnerability exists.</p><p>Thats how we find no rate limit vulnerability during bug bounty programs and reporting these easy vulnerabilities will get you payouts UwU</p><p>NOTE: While submitting vulnerability report make sure you have included all the evidence and steps to reproduce and impact is clear.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79335e39c377" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Insecure Bank V2 server setup/configuration on Windows]]></title>
            <link>https://medium.com/@abdulbasitpriv/insecure-bank-v2-server-setup-configuration-on-windows-a5b9f6933cb9?source=rss-9420c21a5c0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5b9f6933cb9</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[insecurebankv2]]></category>
            <category><![CDATA[androidpenetrationtesting]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Abdul Basit Khan]]></dc:creator>
            <pubDate>Tue, 24 Sep 2024 08:18:14 GMT</pubDate>
            <atom:updated>2024-09-24T08:18:14.469Z</atom:updated>
            <content:encoded><![CDATA[<p>After encountering several challenges while setting up and configuring the server for Insecure Bank v2 — a client-server application — I was finally able to complete the process successfully, though it required significant troubleshooting and persistence. Hence am writing this blog to help and save others from going through such troubles</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*6f2bnQLQVU20wBkfF58LdA.png" /></figure><blockquote><strong>Lets get started</strong></blockquote><p>Goto insecure bank app github repository</p><p><a href="https://github.com/dineshshetty/Android-InsecureBankv2">GitHub - dineshshetty/Android-InsecureBankv2: Vulnerable Android application for developers and security enthusiasts to learn about Android insecurities</a></p><p>Download the zip file of this repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OAjZt3jyclnbjSpu1-_B5w.png" /></figure><p>Once Download, Extract the zip file and goto AndroLabServer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*S3TTZ35hYMRMmSNxLm5GpA.png" /></figure><p>This is how the insides should look like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*7MSpYs0WqXHT0uuhzLVKHw.png" /></figure><blockquote><strong>NOTE</strong></blockquote><p>This app uses python2 and pip2 instead of python3 or pip3.</p><p>goto <a href="https://www.python.org/downloads/release/python-2718/">https://www.python.org/downloads/release/python-2718/</a> and Download Windows x86–64 MSI installer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iFTYNzJX3S1hRVYoM7homw.png" /></figure><p>Before proceeding with the installation, please <strong>uninstall Python 3</strong> from your system via <strong>Add or Remove Programs</strong>. I recommend this step because it took me quite some time to resolve compatibility issues. Once Python 3 is uninstalled, you can then proceed with installing <strong>Python 2</strong>.</p><p>Once done</p><p>open cmd in Androlab server folder and run command</p><pre>pip2 install -r requirements.txt</pre><p>itll install all the required dependencies etc. then run the command to run the server</p><pre>python app.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5UT23zCfNBszJ3bZMLA4Fg.png" /></figure><p>the server will be running on PORT 8888.</p><p>Now we will configure the application to connect it to server. Run insecurebankv2 on any device/emulator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*MGPpq_XepXgb0gz31loP-w.png" /></figure><p>Click on 3 dots then preferences .</p><p>then Enter your ipv4 address in the server ip field</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*PX9qE2VYNjf4UUSDmnloMw.png" /></figure><p>Click Submit and itll give a prompt at the bottom of application “server configured successfully”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*89R35_Ry7tn8-gAku6XwDA.png" /></figure><p>And now, we have <strong>successfully configured the server</strong> for <strong>Insecure Bank V2</strong>. Everything is up and running smoothly!</p><p>I hope this guide will still be helpful for you in the future — maybe even in <strong>2034</strong>! <strong>UwU</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5b9f6933cb9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Frida Detection Bypass]]></title>
            <link>https://medium.com/@abdulbasitpriv/frida-detection-bypass-19313de5455f?source=rss-9420c21a5c0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/19313de5455f</guid>
            <category><![CDATA[frida]]></category>
            <category><![CDATA[bypass-frida]]></category>
            <category><![CDATA[frida-detection]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Abdul Basit Khan]]></dc:creator>
            <pubDate>Fri, 20 Sep 2024 07:48:36 GMT</pubDate>
            <atom:updated>2024-09-20T07:48:36.015Z</atom:updated>
            <content:encoded><![CDATA[<p>Easy frida detection bypass Tricks/Tips and scripts UwU</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*TUgEHaq6y_0fF-Xpqsjjkg.png" /></figure><p>Hey guys, so in my previous writeup we worked on vuln app AndroGoat and bypassed sslpinning, root etc using FRIDA.</p><p>BUT</p><p>What if Frida itself wont work because an app has Anti Frida Mechanism ?</p><p>well well i got ur back UwU</p><blockquote><strong>LETS GET STARTED</strong></blockquote><p>Here is the Anti Frida Mechanism Code :</p><pre>public class FridaDetection {<br>    private static final String TAG = &quot;FridaDetection&quot;;<br><br>    private static boolean checkForFridaFiles() {<br>        String[] strArr = {&quot;/data/local/tmp/frida-server&quot;, &quot;/data/local/tmp/frida&quot;, &quot;/data/local/tmp/re.frida.server&quot;};<br>        for (int i2 = 0; i2 &lt; 3; i2++) {<br>            String str = strArr[i2];<br>            if (new File(str).exists()) {<br>                StringBuilder sb = new StringBuilder();<br>                sb.append(&quot;Frida file detected: &quot;);<br>                sb.append(str);<br>                return true;<br>            }<br>        }<br>        return false;<br>    }<br><br>    private static boolean checkForFridaPorts() {<br>        int[] iArr = {27042, 27043};<br>        try {<br>            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(&quot;netstat -an&quot;).getInputStream()));<br>            while (true) {<br>                String readLine = bufferedReader.readLine();<br>                if (readLine == null) {<br>                    break;<br>                }<br>                for (int i2 = 0; i2 &lt; 2; i2++) {<br>                    int i3 = iArr[i2];<br>                    if (readLine.contains(String.valueOf(i3))) {<br>                        StringBuilder sb = new StringBuilder();<br>                        sb.append(&quot;Frida port detected: &quot;);<br>                        sb.append(i3);<br>                        return true;<br>                    }<br>                }<br>            }<br>        } catch (IOException e2) {<br>            Log.e(TAG, &quot;Error checking for Frida ports&quot;, e2);<br>        }<br>        return false;<br>    }<br>    private static boolean checkForFridaServerProcesses() {<br>        String readLine;<br>        String[] strArr = {&quot;frida-server&quot;, &quot;frida&quot;};<br>        int i2 = 0;<br>        while (i2 &lt; 2) {<br>            String str = strArr[i2];<br>            try {<br>                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(&quot;ps&quot;).getInputStream()));<br>                do {<br>                    readLine = bufferedReader.readLine();<br>                    if (readLine != null) {<br>                    }<br>                } while (!readLine.contains(str));<br>                StringBuilder sb = new StringBuilder();<br>                sb.append(&quot;Frida process detected: &quot;);<br>                sb.append(str);<br>                return true;<br>            } catch (IOException e2) {<br>                Log.e(TAG, &quot;Error checking for Frida server processes&quot;, e2);<br>            }<br>        }<br>        return false;<br>        i2++;<br>    }<br><br>    public static void detectFrida() {<br>        if (!checkForFridaServerProcesses() &amp;&amp; !checkForFridaFiles() &amp;&amp; !checkForFridaPorts()) {<br>        } else {<br>            throw new RuntimeException(&quot;null&quot;);<br>        }<br>    }<br>}</pre><p>This code consists of three frida checks<br>1. Checks for hardcoded Frida filenames in data/local/tmp dir<br>2. Checks for Ports on which Frida runs by default<br>3. Checks for services running named as Frida<br>If any of these checks is returned true the app crashes because itll throw runtimeexception.</p><blockquote>LETS BYPASS THESE</blockquote><p><strong>BYPASSING 1st Check</strong></p><pre>private static boolean checkForFridaFiles() {<br> String[] strArr = {&quot;/data/local/tmp/frida-server&quot;, &quot;/data/local/tmp/frida&quot;, &quot;/data/local/tmp/re.frida.server&quot;};</pre><p>Its basically looking for files in directories hardcoded in the above code snippet.<br>To bypass this check we will simply change the name of the frida-server we have pushed into data/local/tmp, it can be named anything except for three values i.e frida-server, frida, re.frida.server.<br>I named mine <strong>mytools</strong> to avoid detection.</p><p>1st Check has been BYPASSED UwU</p><p><strong>BYPASSING 2nd Check</strong></p><pre>private static boolean checkForFridaPorts() {<br>        int[] iArr = {27042, 27043};</pre><p>Its checking ports that frida by default run on that are 27042 &amp; 27043. It will run a netstat -an to see if the hardcoded ports are occupied or no if they are then that means that frida is running on one of them and itll throw runtimeexception thatll crash the app. <br>To avoid detection and bypass this check we will forward the services running on these ports to different ports.<br>using command</p><pre># adb forward tcp:27044 tcp:27042<br># adb forward tcp:27045 tcp:27043</pre><p>This will move services of 27042 &amp; 27043 to 27044 &amp; 27045 that way both default ports will be free and wont be detected as occupied by 2nd check and this will bypass port detection.</p><p>2nd Check has been BYPASSED UwU</p><blockquote><strong>These were PREREQUISITES so that we can run CUSTOM ANTI FRIDA BYPASS SCRIPT</strong></blockquote><p>The custom created script was made according to the code present in application for detecting frida. If not encountering same code then you will have to modify the custom script according to your needs. The current script iam using can help you understand and create your own script.</p><p>Here is the custom script</p><pre>Java.perform(function() {<br>    // Hook the file detection method<br>    var fridaDetection = Java.use(&#39;PROCESSNAME.FridaDetection&#39;);<br>//This line finds and loads the FridaDetection class from the app’s code (the full class path is processname.path.FridaDetection).<br>//Java.use() gives access to the app&#39;s Java classes and methods, allowing you to modify or intercept them.<br>    fridaDetection.checkForFridaFiles.implementation = function() {<br>        console.log(&quot;Bypassed Frida file detection&quot;);<br>        return false; // Always return false to bypass the check<br>    };<br><br>    // Hook the port detection method<br>    fridaDetection.checkForFridaPorts.implementation = function() {<br>        console.log(&quot;Bypassed Frida port detection&quot;);<br>        return false; // Always return false to bypass the check<br>    };<br><br>    // Hook the process detection method<br>    fridaDetection.checkForFridaServerProcesses.implementation = function() {<br>        console.log(&quot;Bypassed Frida process detection&quot;);<br>        return false; // Always return false to bypass the check<br>    };<br>});</pre><p>In order to understand the code and modify to your needs use chatGPT itll make things easier UwU</p><blockquote><strong>LETS RUN THE SCRIPT</strong></blockquote><p>Run the command</p><pre>frida -H 127.0.0.1:27044 -f (process name) -l antifridadetectionscript.js</pre><p>Note: we are using -H parameter to make a remote connection to given ip:port instead of making a direct USB connection using -U parameter.</p><p>Running this will bypass all checks and return their values as FALSE.</p><p><strong>All The Checks Are Now BYPASSED UwU</strong></p><p>NOTE:</p><p>Reason for going through the prerequisites and then running the script was that without prerequisites if i ran the script, the app would crash as it takes mili-seconds to detect frida presence BUT after changing name and then ports it gave the script enough time frame to run and return all values as FALSE</p><blockquote><strong>STEP by STEP procedure</strong></blockquote><pre>adb shell<br>cd data/local/tmp<br>./mytools &amp; (remember this is my frida server renamed to avoid detection)</pre><p>on a different terminal</p><pre>adb forward tcp:27044 tcp:27042<br>adb forward tcp:27045 tcp :27043<br>frida -H 127.0.0.1:27044 -f (process name) -l antifridadetectionscript.js</pre><p>Note: we are using -H parameter to make a remote connection to given ip:port instead of making a direct USB connection using -U parameter.</p><p>Running this will bypass all checks and return their values as FALSE.</p><p>Press enter to access frida terminal</p><pre>&gt;%load rootbypassscript.js</pre><p>This will run root bypass script and fail to bypass root detection BUT will tell us that app has rootbeer protection.</p><pre>&gt;%load rootbeerbypass.js</pre><p>This will bypass root detection and your app is good to go UwU</p><p>This was it about bypassing frida detection. I hope it helped you either bypass frida or understand how the mechanism works so that you can bypass different frida checks.</p><p>Good Luck Hacking !!</p><p>UwU</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19313de5455f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AndroGoat Mobile Penetration Testing Walkthrough/Comprehensive Guide]]></title>
            <link>https://medium.com/@abdulbasitpriv/androgoat-mobile-penetration-testing-walkthrough-comprehensive-guide-e7684ff2179a?source=rss-9420c21a5c0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7684ff2179a</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[walkthrough]]></category>
            <category><![CDATA[androgoat]]></category>
            <dc:creator><![CDATA[Abdul Basit Khan]]></dc:creator>
            <pubDate>Wed, 18 Sep 2024 07:29:28 GMT</pubDate>
            <atom:updated>2024-09-18T07:29:28.184Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rk8uKV1FPIqw4zwJsDaoiQ.png" /></figure><p>Lets Get Started ^^</p><blockquote>APP name: ANDRO Goat</blockquote><blockquote>Version: 1.0</blockquote><blockquote><strong>Promocode in hardcoded form</strong></blockquote><p><strong>Description: </strong>Hardcoded issues are caused by sensitive data found in source code/ code of that application such as androidmanifext.xml file. The hardcoded data is static and remain unchanged, making them vulnerable to unauthorized access if discovered by attackers.</p><p><strong>For example: </strong>Hardcoded passwords are credentials (usually usernames and passwords) that are directly embedded into the source code of an application. These credentials if accessed/seen by the attacker can cause damage to Data Confidentiality.</p><p><strong>Impact:</strong></p><ol><li>The impact of this vulnerability is significant and multi-faceted. It can cause Unauthorized accessExposed credentials can be exploited by malicious actors to gain unauthorized access to sensitive backend systems, databases, or APIs. This can lead to unauthorized data retrieval, manipulation, or deletion.</li><li>Data Breach: Attackers who exploit this vulnerability can potentially access personal or sensitive information stored in the app’s backend, leading to data breaches and privacy violations for users.</li><li>Service Disruption: If attackers gain control over critical services through these credentials, they could disrupt app functionality, leading to service outages or degraded user experience.</li><li>Reputation Damage: The exploitation of this vulnerability could damage the organization’s reputation and erode user trust, especially if sensitive user data is compromised or if the service is disrupted.</li><li>Regulatory and Compliance Issues: Depending on the nature of the data and the jurisdiction, a breach resulting from this issue could lead to regulatory fines and compliance issues, particularly if it involves personally identifiable information (PII) or protected health information (PHI).</li></ol><p><strong>Impacts Found:</strong> A promo code that can lower down the price of product to zero making it free to purchase.</p><p><strong>Steps to reproduce:</strong></p><ol><li>Using tool Jadx-Gui open androgoat.apk</li><li>Browse to androidmanifest.xml and open it</li><li>At line:68 android:name=”owasp.sat.agoat.HardCodeActivity”/&gt; Double click on HardCodeActivity to open owasp.sat.agoat.HardCodeActivity</li><li>It will Redirect you to owasp.sat.agoat.HardCodeActivity where at line:50 we will find a code promoCode.element = “NEW2019”;</li><li>This includes Promocode “NEW2019”, using this code in androgoat HARDCODE ISSUE tab will lower down the product price to 0 and give a pop-up “Congratulations you got this product for free</li></ol><p><strong>Evidence: </strong>This vulnerability was found in androidmanifest.xml package owasp.sat.agoat.hardcodeactivity</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*sYRGmWljNzUR1fVJvdjxzg.png" /></figure><blockquote><strong>SSL PINNING BYPASS</strong></blockquote><p><strong>Description:</strong></p><p>SSL pinning bypass vulnerabilities compromise the security of SSL/TLS connections, enabling attackers to intercept sensitive data by circumventing the app’s certificate validation processes. Allows an attacker to intercept and decrypt secure communications by bypassing the certificate pinning checks.</p><p><strong>Impacts: </strong></p><ol><li>Allows hackers to perform Man In The Middle Attacks that can lead to Sensitive data, such as login credentials, personal information, or financial data, can be stolen or tampered with. </li></ol><p>2. Compromised data can be extracted from the intercepted traffic. </p><p>3. Altered application behavior, potential corruption of data, and security vulnerabilities.</p><p><strong>Impacts Found:</strong></p><p>Was able to intercept http request being sent from the application, Allows hackers to manipulate requests and cause integrity issues, data breach etc.</p><p><strong>Steps To Reproduce:</strong></p><ol><li>Using ADB push Frida Application android server file into mobile device and execute it after giving +x permission.</li></ol><p>2. Install BurpSuite certificate.</p><p>3. Use cmnd</p><pre># Frida -U -l &quot;Frida script for sslpinning&quot; -f owasp.sat.agoat</pre><p>THIS will bypass SSL pinning.</p><p><strong>Evidence</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*epeMLc79ppiZI9Vi4dDt4A.png" /></figure><blockquote><strong>UNPROTECTED ANDROID COMPONENTS</strong></blockquote><p><strong>Description:</strong></p><p>Activities are the UI components of an app that users interact with. If an activity is not adequately protected, it may be accessible or exploitable by other apps or users. Sensitive activities may be exposed to other apps or users if not properly protected. Confidential information might be visible or accessible through unprotected activities.</p><p><strong>Impacts: </strong></p><ol><li>Sensitive user data, such as personal information, financial details, or authentication tokens, can be accessed by unauthorized users or malicious apps. </li><li>Users’ personal data might be exposed, leading to privacy breaches and potential misuse of information. </li><li>Malicious apps or users might exploit unprotected activities or services to perform unauthorized actions, such as initiating transactions or altering configurations.</li></ol><p><strong>Impact Found:</strong></p><p>Was able to download User Invoice Due unprotected activity control.</p><p><strong>Steps to Reproduce:</strong></p><ol><li>Open and Explore androGoat.apk</li><li>Find activities related to verification of pin, in our case “AccessControlIssue1Activity”</li><li>Using ADB run command</li></ol><pre>#adb shell am start -n owasp.sat.agoat/.AcessControl1ViewActivity</pre><p>This will open the download invoice tab without entering PIN</p><p><strong>Evidence</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*oaP3FULL9uQwyizL284Dyg.png" /></figure><blockquote><strong>INSECURED DATA STORAGE</strong></blockquote><p><strong>Description:</strong></p><p>a security flaw where sensitive information is stored insecurely on an Android device, potentially exposing it to unauthorized access or misuse. This vulnerability can lead to data breaches and compromise user privacy and security. It occurs when an app stores sensitive data in a way that makes it accessible to unauthorized users or malicious applications. This can happen if data is not properly protected or if the storage mechanisms used are inherently insecure.</p><p><strong>Impacts:</strong></p><p>Unauthorized Data Access:  Sensitive data like personal information, authentication tokens, financial data, or application secrets can be accessed by malicious apps or users if not properly secured.</p><p>Data Leakage:  Information can be exposed through unprotected files or databases. Data leakage can occur if the storage mechanisms are not adequately protected against unauthorized access.</p><p>Privacy Violations:  Compromised data can lead to privacy violations, including identity theft, fraud, or exposure of confidential information.</p><p>Compliance Issues:  Failure to properly secure sensitive data might lead to non-compliance with data protection regulations and standards (e.g., GDPR, HIPAA).</p><p>Data Corruption:  Insecure storage mechanisms might be prone to corruption or tampering, affecting data integrity and application functionality.</p><p><strong>Impacts Found:</strong></p><p>Shared Preferences — Used for storing simple key-value pairs. By default, data stored here is not encrypted. We were able to read user name and password entered earlier in form in clear text.</p><p><strong>Steps to Reproduce:</strong></p><ol><li>Connect to shell using</li></ol><pre>#adb shell</pre><p>2. Redirect to data/data/owasp.sat.agoat/shared_prefs</p><p>3. Open users.xml using</p><pre>#cat users.xml</pre><p><strong>Evidence:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*olhYaY_ezANisyFq9s9ZDA.png" /></figure><blockquote><strong>For Shared pref pt.2</strong></blockquote><p><strong>Steps to reproduce:</strong></p><p>Redirect to data/data/owasp.sat.agoat/shared_prefs</p><p>Run command</p><pre>#Cat score.xml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*s4jQYL-txGEtMhQF5Se4_Q.png" /></figure><blockquote><strong>For SQLi</strong></blockquote><p>A vulnerability in Android apps is a type of security flaw where an attacker can manipulate SQL queries made by the application to gain unauthorized access to or modify the underlying database. we were able to manipulate sql queries and gain access to shared folder in databases to find username and passwords.</p><p>Steps to Reproduce:</p><ol><li>Redirect to /data/data/owasp.sat.aGoat/databases</li></ol><p>2. Using SQLite3</p><pre>./sqlite3 aGoat <br>.tables <br>select * from users;</pre><p><strong>Evidence:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*dZlW41BePHdz-HxqNjIQ3g.png" /></figure><blockquote><strong>XSS</strong></blockquote><p><strong>Description:</strong></p><p>Cross-Site Scripting (XSS) in the context of Android applications refers to vulnerabilities where an attacker can inject malicious scripts into web views or other parts of the app that display or execute content.</p><p><strong>Impacts</strong>: </p><ol><li>Attackers can steal session cookies or authentication tokens from the WebView context, potentially gaining unauthorized access to user accounts or sensitive information. </li><li>Malicious scripts injected via XSS can exfiltrate sensitive data, such as user inputs, stored data, or configuration settings, to an external server controlled by the attacker. </li><li>Attackers can inject scripts to create fake login forms or phishing pages that trick users into entering their credentials or other sensitive information.</li></ol><p><strong>Impacts Found:</strong></p><p>Found XSS Vulnerability in input validation form where we can cause a popup alert.</p><p><strong>Steps to reproduce:</strong></p><ol><li>Browse to Input Validations -&gt; XSS tab.</li></ol><p>2. Enter in Display text field</p><pre>“&gt;&lt;script&gt;alert(“ungabunga”)&lt;/script&gt;</pre><p>This will popup alert on screen displaying text “ungabunga”</p><p><strong>Evidence:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*MIXNA9KGfEhSSPtmnz4y_Q.png" /></figure><blockquote><strong>SQLi</strong></blockquote><p><strong>Description</strong>:</p><p>SQL Injection (SQLi) vulnerability in Android apps occurs when an attacker can manipulate SQL queries sent to a database by injecting malicious SQL code. This can happen when user input is incorporated into SQL queries without proper validation or sanitization. SQL Injection can lead to unauthorized data access, data manipulation, or even full control over the database.</p><p><strong>Impacts</strong>: </p><ol><li>Attackers can extract sensitive data from the database, such as personal information, financial records, or credentials. </li><li>Attackers can modify, insert, or delete data within the database, leading to unauthorized changes. </li><li>Attackers can bypass authentication mechanisms, gaining unauthorized access to the app or its features.</li></ol><p><strong>Impacts Found:</strong></p><p>We were able to use Sql injection to fetch usernames and passwords.</p><p><strong>Steps to Reproduce:</strong></p><ol><li>Browse to inputvalidations -&gt; sqli tab</li></ol><p>2. In username field input</p><pre>&#39; OR &#39;1&#39;=&#39;1&#39; -</pre><p>This will show usernames and passwords as popup at bottom of screen</p><p><strong>Evidence</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/285/1*4NwXVyjVBEclY284hKXDVg.png" /></figure><blockquote><strong>WEB VIEW</strong></blockquote><p><strong>Description:</strong></p><p>WebView vulnerabilities in Android applications occur when a WebView component — used to render web content within an app — is not properly secured. WebView is a versatile component that allows Android apps to display web content, but if not handled correctly, it can introduce significant security risks.</p><p><strong>Impacts</strong>:</p><ol><li>Attackers can steal sensitive information such as login credentials, personal data, or payment details by exploiting WebView vulnerabilities.</li><li>Attackers can steal session cookies or authentication tokens by exploiting WebView vulnerabilities, allowing them to impersonate legitimate users.</li></ol><p><strong>Impacts Found:</strong></p><p>We were able to access device directories and get a view of what is written inside users.xml and fetch usernames and passwords.</p><p><strong>Steps to reproduce:</strong></p><ol><li>Browse to WEBVIEW</li><li>In URL field enter</li></ol><pre>file:///data/data/owasp.sat.agoat/shared_prefs/users.xml</pre><p>This will give credentials.</p><p><strong>Evidence:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/1*sdDYh66-9aA7Ex20ZnSifQ.png" /></figure><blockquote><strong>Insecure Logging</strong></blockquote><p><strong>Description:</strong></p><p>Insecure logging vulnerability refers to data being saved in logs in plain text. All the process and events are stored into logs if enabled and if not configured correctly will lead to data being saved in plaint text. This data can be anything such as user credentials or credit card details or keys pressed.</p><p><strong>Impact:</strong></p><ol><li>Sensitive information logged by the application can be accessed by unauthorized individuals or applications, leading to data breaches.</li><li>Logging personal or sensitive information without proper security measures can violate user privacy and legal regulations.</li><li>Logging credentials or tokens in plaintext can allow attackers to steal these credentials if they gain access to the logs.</li></ol><p><strong>Impacts Found:</strong></p><p>User credentials that were entered in login form were exposed in plain text in logs.</p><p><strong>Steps to reproduce:</strong></p><p>1. Browse to insecure logging tab</p><p>2. Run adb shell and then run command logcat,</p><p>this will give realtime logs</p><p>3. Enter user details in login form and they will appear in logs in plain text.</p><p><strong>Evidence:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*YRkwZ3Og0i9ihqJOPYFKQQ.png" /></figure><p>And that concludes my presentation, learners! If you’ve made it this far, congratulations! You now have a solid foundation in the basics of mobile penetration testing.</p><p>GOOD LUCK <strong>HACKING</strong></p><p>Ethical <strong>Hacking </strong>i meant ;-;</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7684ff2179a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>