<?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"><channel><title><![CDATA[ar6aaz]]></title><description><![CDATA[ar6aaz]]></description><link>https://a6z.co</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 01:33:14 GMT</lastBuildDate><atom:link href="https://a6z.co/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Lessons from a Live Hacking event]]></title><description><![CDATA[I recently participated in a virtual Live Hacking event organized by bugbountyhunter.com. This was my first ever Hackevent and I learned a lot of new things and made a bunch of new friends. I thought I'd share some of my findings and learnings from t...]]></description><link>https://a6z.co/lessons-from-a-live-hacking-event</link><guid isPermaLink="true">https://a6z.co/lessons-from-a-live-hacking-event</guid><category><![CDATA[bugbounty]]></category><category><![CDATA[hacking]]></category><category><![CDATA[#cybersecurity]]></category><category><![CDATA[infosec]]></category><dc:creator><![CDATA[Mohammed Arbaaz Shaikh]]></dc:creator><pubDate>Sun, 25 Dec 2022 09:17:54 GMT</pubDate><content:encoded><![CDATA[<p>I recently participated in a virtual Live Hacking event organized by <a target="_blank" href="https://www.bugbountyhunter.com/">bugbountyhunter.com</a>. This was my first ever Hackevent and I learned a lot of new things and made a bunch of new friends. I thought I'd share some of my findings and learnings from the event through this post.</p>
<p>Massive shoutout to <a target="_blank" href="https://twitter.com/zseano">zseano</a> for organizing this event. Sean was not well during the entire week the event was live but still managed to successfully host it. Oh and also, thanks again Sean for permitting me to disclose some of my findings through this blog post.</p>
<h3 id="heading-the-numbers">The numbers</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1671907712321/30153874-44d4-4e59-807d-b886f302fc08.png" alt="Leaderboard" class="image--center mx-auto" /></p>
<p>At the end of the event, I finished 4th on the global leaderboard. I was quite happy with 4th, considering this was my first ever Hackevent. I spent a total of 30 hours, 28 minutes and 6 seconds hacking the web app. And in that time, I reported a total of 28 bugs, of which 27 were valid and one ended up being rejected. I was late to the party and only really started testing the application two days after the event started, so the majority of my bugs ended up being duplicates.</p>
<p>I reported 12 Stored XSS, 4 Reflected XSS, 1 Blind XSS, 4 Application/Business logic issues, 2 Authentication issues, 1 Broken Access Control, 1 CSRF and a couple of other miscellaneous bugs.</p>
<h3 id="heading-the-rules">The rules</h3>
<p>The event rules were pretty clear - Only manual testing was allowed. You couldn't use any automated scanners like Burp or ZAP (You could still use Burp proxy and other features, just not the Active scan). You could also do limited contextual fuzzing, once you get to know the application. But randomly picking a 1-million-directories wordlist from Github &amp; running ffuf was a NO-NO.</p>
<h3 id="heading-the-first-bug">The first bug</h3>
<p>The first bug I found was probably the easiest one I came across. Funnily enough, once I started testing, it took me less than 30 seconds to find it. I navigated through the application's homepage, and started looking for requests in Burp's history. I found a request to the endpoint <code>/sample-endpoint.html</code>, which redirected the user to <code>/sample-endpoint.php</code>. I looked at the source code of the response, and found the following code:</p>
<pre><code class="lang-javascript">&lt;script&gt;

    <span class="hljs-keyword">var</span> curUrl = <span class="hljs-built_in">window</span>.location.search;
    <span class="hljs-keyword">var</span> params = <span class="hljs-keyword">new</span> URLSearchParams(curUrl);
    <span class="hljs-keyword">var</span> redirect_url = params.get(<span class="hljs-string">'redirect_url'</span>);

    <span class="hljs-keyword">if</span> (redirect_url == <span class="hljs-literal">null</span>) {
        top.location.href=<span class="hljs-string">'sample-endpoint.php'</span>;
    } <span class="hljs-keyword">else</span> {
         top.location.href=redirect_url;
    }

&lt;/script&gt;
</code></pre>
<p>And that was it, my first Reflected XSS. It is technically a client side Open Redirect bug, as the application doesn't validate the value of parameter redirect_url, and so a malicious entity could redirect a user to any URL by crafting a malicious URL like <code>/sample-endpoint.html?redirect_url=https://evil.com</code></p>
<p>Luckily for us, the parameter accepts the <code>javascript:</code> URL scheme, so we can escalate this to a Reflected XSS by crafting a URL like <code>/sample-endpoint.html?redirect_url=javascript:alert(document.cookie)</code></p>
<h3 id="heading-other-interesting-finds">Other interesting finds</h3>
<p><strong>1) Blind XSS:</strong> I had never found a Blind XSS before. And this one was very straightforward. On the login page, there was a message saying <mark>"Attempts to login will be logged"</mark>. This made me suspect that there is surely something around logging that could be exploited here.<br />I could think of two things to try here: <strong>log4j</strong> or <strong>Blind XSS</strong>. The application was built in PHP, so that ruled out any log4j stuff. I tried some Blind XSS payloads in the username field, and 15 hours later, received a pingback on my email. The Blind XSS had fired on an internal panel and I received a screenshot as well as some other details of the URL, IP and DOM of the internal panel via the script hosted on my <a target="_blank" href="https://xsshunter.com">XSS hunter</a> instance.</p>
<p><strong>2) Modifying the unmodifiable:</strong> The application had a feature where there were some existing user profiles that you could modify. Every user profile had a few attributes like bio and name that could be edited but the profile picture of the user was not editable. So I started looking into ways to modify the profile picture.</p>
<p>I edited the bio and intercepted the request in Burp. After a lot of failed attempts at guessing the parameter that could magically update the profile picture, I decided to send the request to ParamMiner. But unfortunately, ParamMiner couldn't find anything either. Then I thought, what if I change this to a GET request. I changed the request method, moved parameters from POST body to GET request query parameters, and once again sent the request to ParamMiner.</p>
<p>And voila! ParamMiner detected a parameter "photo". I resent the request with the parameter "photo" and the server decided to help me out here. The server replied with "<em>Invalid photo parameter provided. It must be photoUrl</em>". I then sent the request with the "photoUrl" parameter, added a <strong><mark>relative URL</mark></strong> of another existing image on the server and the application changed the profile picture of the user!</p>
<p><strong>3) Could this be escalated to XSS though?</strong><br />Sure, being able to modify the profile picture is a functional bug in itself but is that the worst thing that could happen here? Probably not.</p>
<p>I started thinking about the things I could do by updating the profile picture - the initial idea was to upload an SVG file with an XSS payload in it as the profile picture. But there was a problem - as highlighted above, the application was only accepting relative URLs, meaning you could only change the profile picture to an existing image on the server. I tried bypassing this relative URL restriction but I was not able to <em>(at the end of the event I did get to know that someone else was able to bypass this though).</em></p>
<p>Anyway, I reached out to a friend for some help on this and we ended up collaborating on this report (more on this later). He realized that this profile picture was also reflected on another endpoint that displayed the user's profile image in the following manner in the DOM:<br /><code>&lt;img src="images/user_1.png"&gt;</code></p>
<p>So then, I sent the edit profile request with the value <code>/xxx"+onerror="alert(document.domain)"</code> and it escaped out of the src attribute, executing the XSS.<br /><code>&lt;img src="/xxx" onerror=alert(1)""&gt;</code></p>
<p>And now we have security impact! From a functional bug to a security vulnerability.</p>
<h3 id="heading-collaboration">Collaboration</h3>
<p>My biggest takeaway from this event is that collaboration is key. You will always achieve more success if you're hunting in packs. Out of the 27 bugs I reported, I needed a nudge from my friends for at least 5 bugs.</p>
<p>All of us look at things differently. There is a strong chance that something that may look like completely secure functionality to you, is a high-severity bug in someone else's eyes. Believe it or not, I may have finished 4th in the event but I missed the easiest bug <em>(Authentication Bypass using default credentials)</em> until someone pointed it out to me when I was stuck.</p>
<p>This was the first time I collaborated with people and I certainly enjoyed the experience. Sure, it's important to establish trust before collaborating and set the rules of collaboration straight before starting, but it's worth it. I look forward to collaborating with more people in the future.</p>
]]></content:encoded></item><item><title><![CDATA[Exploiting exposed Spring Boot Heapdump endpoint]]></title><description><![CDATA[While testing for bugs on a Vulnerability Disclosure Program, I recently came across a subdomain of the program having an application running on Spring Boot. The application had exposed Spring Boot Actuator endpoints in production, which could lead t...]]></description><link>https://a6z.co/exploiting-exposed-spring-boot-heapdump-endpoint</link><guid isPermaLink="true">https://a6z.co/exploiting-exposed-spring-boot-heapdump-endpoint</guid><category><![CDATA[#cybersecurity]]></category><category><![CDATA[bugbounty]]></category><category><![CDATA[infosec]]></category><category><![CDATA[Java]]></category><category><![CDATA[Springboot]]></category><dc:creator><![CDATA[Mohammed Arbaaz Shaikh]]></dc:creator><pubDate>Sun, 02 Oct 2022 16:38:17 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1664718870369/a_BS7GOw1.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>While testing for bugs on a Vulnerability Disclosure Program, I recently came across a subdomain of the program having an application running on Spring Boot. The application had exposed Spring Boot Actuator endpoints in production, which could lead to a number of issues. In this post, I will share how to exploit one such issue for security impact, when the application has exposed the /heapdump actuator endpoint.</p>
<p>Note: Do not test web apps without permission. I reported this bug along with all other exposed actuator endpoints to the program and they have now fixed it.</p>
<h2 id="heading-spring-boot-actuator">Spring Boot Actuator</h2>
<p>Spring Boot Framework provides some built-in features to help you manage and monitor your application. These features can be accessed via the actuator endpoints, and are meant to help developers to monitor and debug. Some of the common endpoints are:</p>
<ul>
<li>/health</li>
<li>/info </li>
<li>/trace</li>
<li>/metrics</li>
<li>/heapdump</li>
</ul>
<p>There are many such actuator endpoints and you can find the complete list of these endpoints with description <a target="_blank" href="https://docs.spring.io/spring-boot/docs/2.5.6/reference/html/actuator.html#actuator.endpoints">here</a>. It's definitely worth adding these endpoints to your wordlist. In fact, that's how I discovered the endpoint, while directory bruteforcing the target.</p>
<h2 id="heading-heapdump">Heapdump</h2>
<p>The /<a target="_blank" href="https://docs.spring.io/spring-boot/docs/current/actuator-api/htmlsingle/#heapdump">heapdump</a> endpoint returns a heap dump from the application’s JVM. It provides a dump file with hprof extension, which is a binary file that can be opened and examined in a memory analyzer tool.</p>
<p>When you visit the /heapdump endpoint, it will automatically download the file on your machine.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1664718267590/fNE11SlPf.png" alt="Download heapdump.png" /></p>
<h2 id="heading-visual-vm">Visual VM</h2>
<p>Once you have downloaded the file, you need to find a way to open the hprof file and find something interesting, with clear security impact. One way to read the hprof file is by using Visual VM Memory Analyzer tool. Visual VM is a tool that helps you read hprof files, and extract meaningful data out of the dump. You can download VisualVM from <a target="_blank" href="https://visualvm.github.io/">here</a>. There is no installation required, you just need to download the tool and run the executable.</p>
<p>After downloading the tool, you can now import the heapdump file in Visual VM. Open the tool -&gt; Go to File -&gt; Load -&gt; Import your file.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1664712791076/4igPrQRvr.png" alt="Visual VM summary.png" /></p>
<p>On successfully importing the file, Visual VM will give you an initial summary of the dump data on the screen. This includes the server information like JVM information, heap size, classes information, environment information, etc. You can certainly explore by yourself if you know what you're doing and look for interesting objects and classes. There are more than one way of exploitation from here on.</p>
<p>However, since we are looking for a security impact here, a much easier and quicker way of achieving that is simply executing OQL queries on the heapdump data to fetch sensitive information.</p>
<h2 id="heading-oql">OQL</h2>
<p><a target="_blank" href="https://wiki.eclipse.org/MemoryAnalyzer/OQL">OQL</a> stands for Object Query Language. It is very similar to SQL and used by Memory Analyzer to find interesting data from heapdump using SQL-like queries. OQL represents classes as tables, objects as rows, and fields as columns.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1664713161382/EXBu_-M7v.PNG" alt="OQL Console.PNG" /></p>
<p>You can open the OQL console in Visual VM to run queries by clicking on the Summary dropdown, and selecting OQL console option.</p>
<p>This should open the OQL window in Visual VM where you can now enter and run queries.</p>
<h2 id="heading-building-queries">Building queries</h2>
<p>As mentioned earlier, OQL queries are similar to SQL, and allow you to query data from the heapdump. From a security impact standpoint, some of the sensitive information we can try and search for in the dump is probably things like session tokens, JWTs, hardcoded credentials, API keys, AWS credentials, etc.</p>
<p>First, I just tried to search for the term "AWS", and that in itself got me a lot of data to look at. There were URLs I could connect to, references to credentials I could try, etc.</p>
<pre><code>select s <span class="hljs-keyword">from</span> java.lang.String s where s.toString().contains(<span class="hljs-string">"AWS"</span>)
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1664713946282/LWz037Wp0.png" alt="AWS Query.png" /></p>
<p>The number preceding the variable name is the line where the reference of the variable is. For example, the AWS_SECRET_ACCESS_KEY is preceded by java.lang.String#80962. If we wanted to check the value/usage, we can right click on the variable name, click on 'Open Class in New Tab' and then scroll to the line 80962.</p>
<p>If you are familiar with the format of certain tokens: JWT always begins with "ey...." or AWS_ACCESS_KEY_ID always begins with "AKIA.....", you can tweak your query to directly search for those as well:</p>
<pre><code>select s <span class="hljs-keyword">from</span> java.lang.String s where s.toString().contains(<span class="hljs-string">"AKIA"</span>)
select s <span class="hljs-keyword">from</span> java.lang.String s where s.toString().contains(<span class="hljs-string">"ey"</span>)
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1664714973949/K6_JSApER.png" alt="AWS Access Key ID.png" /></p>
<p>You can also try to fetch database strings or other data related to the DB configuration using keywords related to the DB. For example:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1664717805482/Ya3WyJAk7.png" alt="PostGRES.png" /></p>
<p>This is how we can extract sensitive information from a heap dump when the Spring boot actuator's /heapdump endpoint is exposed in production.</p>
<p><em>For further reading on this, do check out this awesome research paper: https://www.exploit-db.com/docs/50459 </em></p>
<p><em>For any questions, feel free to reach out on  <a target="_blank" href="https://twitter.com/ar6aaz">Twitter</a></em></p>
]]></content:encoded></item><item><title><![CDATA[Learning how to hack AEM Web Apps]]></title><description><![CDATA[I had to cancel my Diwali vacation plan for some reason. Now, I had 10 days off work not knowing what to do. So, I decided to jump on Hackerone and practice some hacking to make good use of this time. Luckily, I managed to find six bugs in the first ...]]></description><link>https://a6z.co/learning-how-to-hack-aem-web-apps</link><guid isPermaLink="true">https://a6z.co/learning-how-to-hack-aem-web-apps</guid><category><![CDATA[#cybersecurity]]></category><category><![CDATA[Security]]></category><dc:creator><![CDATA[Mohammed Arbaaz Shaikh]]></dc:creator><pubDate>Sat, 06 Nov 2021 17:52:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636220910699/-cyin3Sqa.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I had to cancel my Diwali vacation plan for some reason. Now, I had 10 days off work not knowing what to do. So, I decided to jump on Hackerone and practice some hacking to make good use of this time. Luckily, I managed to find six bugs in the first five days itself. This post is about the first two of those bugs, that I found on a web app running Adobe Experience Manager.</p>
<p>I logged into Hackerone, found a good broad scope private program and opened the main website on my browser. Usually, the first thing I do when I visit a website is check what Wappalyzer can tell me about the application. (Wappalyzer is a browser extension that shows what technology a web application is using).</p>
<p>In this case, Wappalyzer detected the CMS the website was using – Adobe Experience Manager (AEM). I had heard of AEM misconfigurations before. I had a few links and tweets bookmarked in my browser for the same, but I never really got the time to check any of it out. With a good ten days in hand, this was the perfect chance to finally get started with AEM hacking.</p>
<h2 id="great-but-how-do-i-start">Great, but how do I start?</h2>
<p>Twitter. Yes, that’s a good start. I started searching for tweets with the search query and hashtag “AEM #bugbounty”. I found a bunch of tweets with a bunch of test cases that I could try. But not knowing anything about AEM, it didn’t make sense to jump to exploitation directly. I stumbled upon a tweet that talked about the research Mikhail Egorov had done on AEM over the last few years, and I found links to a couple of talks where he had presented his research. (Highly recommend you check these talks,  <a target="_blank" href="https://www.youtube.com/watch?v=EQNBQCQMouk&amp;t=10s">here</a>  and  <a target="_blank" href="https://www.youtube.com/watch?v=BFQ9qQSBH6Y">here</a> ).</p>
<h2 id="what-next">What next?</h2>
<p>Watching the talks certainly helped. I knew more about AEM’s architecture than I did before. To summarize, AEM has a 3-layer architecture. The three layers are: Author, Publisher and Dispatcher layer. Author Instance is where the content is posted, Publisher is the instance that the user interacts with using the Dispatcher.</p>
<p>Dispatcher is the only security mechanism that protects publisher by stopping requests that do not meet policy. And things start getting really bad if the Dispatcher policy is not set correctly. Dispatcher bypasses are quite common, and a dispatcher can eventually expose servlets that ideally should not be exposed. In other words, Dispatcher bypasses allow to talk to insecure components of the publisher instances. </p>
<p>This can lead to Information Disclosure, XSS, SSRF and a lot of other issues. For the scope of this post, we will talk about the two issues I came across: Information Disclosure through QueryBuilderJsonServlet and HTML Injection via MergeMetadataServlet.</p>
<h2 id="cve-2016-0957">CVE-2016-0957</h2>
<p>The dispatcher policy blocks requests when you try to access the QueryBuilderJsonServlet at the endpoint /bin/querybuilder.json However, it can be bypassed if the rules aren’t strict enough by appending the following to the endpoints.</p>
<ul>
<li>https[:]//aemsite/bin/querybuilder.json/a.css</li>
<li>https[:]//aemsite/bin/querybuilder.json/a.html </li>
<li>https[:]//aemsite/bin/querybuilder.json/a.ico </li>
<li>https[:]//aemsite/bin/querybuilder.json/a.png </li>
<li>https[:]//aemsite/bin/querybuilder.json;%0aa.css</li>
<li>https[:]//aemsite/bin/querybuilder.json/a.1.json </li>
<li>https[:]//aemsite/bin/querybuilder.json;%0aa.css  </li>
<li>https[:]//aemsite/bin/querybuilder.json.servlet.css  </li>
<li>https[:]//aemsite/bin/querybuilder.json.servlet.html</li>
<li>https[:]//aemsite/bin/querybuilder.json.servlet.ico </li>
<li>https[:]//aemsite/bin/querybuilder.json.servlet.png</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636191546118/j_W0idfy0.png" alt="image.png" />
Slide from: https://speakerdeck.com/0ang3el/securing-aem-webapps-by-hacking-them?slide=10</p>
<p>In my case .;a.css worked and I was able to bypass the dispatcher to access the QueryBuilderJsonServlet.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636191737303/VtjR9i9XY.png" alt="image.png" /></p>
<p>Cool, dispatcher bypassed. But how is it a security issue? There seems to be no impact here, right? The response to this request has not really retrieved any sensitive information. I had the same question and so I reached out to another security researcher on Twitter who seemed to know his AEM stuff. The guy suggested I read up on how to build queries manually on QueryBuilder.</p>
<p>So, that’s what I tried next. I started reading on how to build queries manually in Adobe’s docs. Also watched a couple YouTube playlists until I figured out a thing or two. I checked AEMSecurity’s Twitter account and found a couple of queries there as well. Fast forward, I came up with the following:</p>
<ul>
<li>https[:]//aemsite/bin/querybuilder.json.;a.css?path=/home&amp;p.hits=full&amp;p.limit=-1</li>
<li>https[:]//aemsite/bin/querybuilder.json.;a.css?path=/etc&amp;p.hits=full&amp;p.limit=-1</li>
<li>https[:]//aemsite/bin/querybuilder.json.;a.css?type=nt:base&amp;limit=-1</li>
<li>https[:]//aemsite/bin/querybuilder.json.;a.css?path=/content/dam&amp;p.hits=full&amp;p.limit=-1</li>
<li>https[:]//aemsite/bin/querybuilder.json.;a.css?path=/libs/granite/core/content/login&amp;p.hits=full&amp;p.limit=-1</li>
<li>https[:]//aemsite/bin/querybuilder.json.;a.css?path=/libs/granite/core/content/login/clientlib/login.less&amp;p.hits=full&amp;p.limit=-1</li>
<li>https[:]//aemsite/bin/querybuilder.json.;a.css?type=nt:file&amp;fulltext=*zip</li>
<li>https[:]//aemsite/bin/querybuilder.json.;a.css?path=/content&amp;type=cq:Page&amp;p.limit=1000</li>
<li>https[:]//aemsite/bin/querybuilder.json.;a.css?path=/content&amp;type=cq:Page&amp;p.limit=1000</li>
<li>https[:]//aemsite/bin/querybuilder.json.;a.css?fulltext=*xml</li>
<li>https[:]//aemsite/bin/querybuilder.json.;%0aa.css?p.hits=full&amp;property=rep:authorizableId&amp;type=rep:User</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636192055121/8qVIrytaz.png" alt="image.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636192152804/atvlRG-_L.png" alt="image.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636192176309/AVKeFsm4c.png" alt="image.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636192186732/YPkpPUv8y.png" alt="image.png" /></p>
<p>The above sample queries expose user information, UUIDs, paths on server, files on server, server snapshots, packages, etc.
I reported this immediately and it turned out to be a duplicate, someone had already reported it.</p>
<h2 id="mergemetadataservlet-html-injection">MergeMetaDataServlet HTML Injection</h2>
<p>I also found the MergeMetadataServlet exposed on the same web app, so I tried to look into exploiting that as well. The bypass for this one was quite simple, just had to add the .css extension to the metadata endpoint.</p>
<p>https[:]//aemsite/libs/dam/merge/metadata.css?path=/etc&amp;.ico</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636192251076/Jl8aClIh9.png" alt="image.png" /></p>
<p>As seen in the screenshot above, the data we input in the path parameter is reflected back on the webpage. Chance for a classic reflected XSS. I immediately started testing for reflected XSS, but got blocked by the WAF in place.</p>
<p>The WAF was blocking almost all HTML tags, =' " and other special characters, onXXX eventHandlers and a bunch of other stuff. After a series of failed attempts to achieve XSS, I ended up reporting it as an HTML injection. Apparently, h1,h2,li,a and a few other tags were not blocked by the WAF.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636193267853/aRBj1_5wo.png" alt="HTML Injection.PNG" /></p>
<p>Note: The response of the MergeMetadataServlet is normally in JSON. In order to execute the HTML, we need to change the Content-Type of the response from application/json to text/html. The simplest way to do that is to append the endpoint with an HTML filename (check above screenshot). The /dMr.html in the URL ensures the server changes the Content-Type of the response to HTML.</p>
<h2 id="resources">Resources</h2>
<p>There is a lot more to security misconfigurations on AEM. There is a possible SSRF attack via Opensocial (Shindig) proxy, ReportingServicesProxyServlet, SalesforceSecretServlet, AutoProvisioningServlet. There is a possible XSS via VideoPlayer.swf, SuggestionHandlerServlet, WCMDebugFilter and MergeMetaDataServlet. There are possible DoS attacks as well. If GroovyConsole is enabled on the web server, it could directly lead to RCE as well. I highly recommend going through Mikhail Egorov’s presentations and AEMSecurity’s Twitter account for more details on these:</p>
<ul>
<li><a target="_blank" href="https://www.youtube.com/watch?v=EQNBQCQMouk&amp;t=13s">Talk 1</a></li>
<li><a target="_blank" href="https://www.youtube.com/watch?v=BFQ9qQSBH6Y">Talk 2</a></li>
<li>https://labs.f-secure.com/blog/securing-aem-with-dispatcher/</li>
<li>https://experienceleague.adobe.com/docs/experience-manager-65/administering/security/security-checklist.html?lang=en</li>
<li>Automating Dispatcher checks: https://github.com/0ang3el/aem-hacker </li>
<li>https://twitter.com/aemsecurity</li>
</ul>
<p>Until next time :)</p>
]]></content:encoded></item><item><title><![CDATA[Testing Password Reset functions]]></title><description><![CDATA[Password Reset is one of the most common features in web applications. Every website that requires you to make an account also implements a way to reset your password. And while it is one of the most commonly implemented functions, it is also one of ...]]></description><link>https://a6z.co/testing-password-reset-functions</link><guid isPermaLink="true">https://a6z.co/testing-password-reset-functions</guid><category><![CDATA[hacking]]></category><category><![CDATA[#cybersecurity]]></category><category><![CDATA[Testing]]></category><category><![CDATA[Security]]></category><category><![CDATA[hack]]></category><dc:creator><![CDATA[Mohammed Arbaaz Shaikh]]></dc:creator><pubDate>Sun, 13 Jun 2021 18:26:40 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1623608327473/6wtlwsyAQ.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Password Reset is one of the most common features in web applications. Every website that requires you to make an account also implements a way to reset your password. And while it is one of the most commonly implemented functions, it is also one of the least tested for security vulnerabilities. There are many ways an attacker could potentially get access to any user's account if the password reset implementation is weak.</p>
<p><strong>Note:</strong> Some of the attacks in this post require you to intercept traffic and manipulate requests/responses. So, having some knowledge of Burp Suite/OWASP ZAP will certainly help as you read through the article.</p>
<h3 id="case-1-host-header-injection">Case 1: Host Header Injection</h3>
<ol>
<li>Go to Reset Password page</li>
<li>Turn on Burp Proxy</li>
<li>Request password reset for your email and intercept the request</li>
<li>Manipulate the Host header in the request to a website you control, say attacker.com</li>
<li>Forward the request</li>
<li>If the password reset link that you receive in your email contains attacker.com as the host instead of the actual website, the implementation is vulnerable</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1623582300773/SzC6GcCI6.png" alt="host header.PNG" /></p>
<p>If the Host header does not work, you can even try your luck with the 
<code>X-Forwarded-Host: attacker.com</code> header instead.</p>
<p>The reason why this is a security issue is because if the user clicks on the attacker.com link in the email, it will send a request on the attacker.com server where the attacker can easily harvest the reset token from the URL from his server's logs. </p>
<p>This usually happens in PHP applications when the password reset link is built using <code>https://$_SERVER['HTTP_HOST']/resetpassword?token=wcsajcdncsdklcsdnkvcsdk</code> </p>
<p>A simple mitigation would be to use $_SERVER['SERVER_NAME'] instead of $_SERVER['HTTP_HOST'] to build the password reset link.</p>
<h3 id="case-2-http-parameter-pollution">Case 2: HTTP Parameter Pollution</h3>
<p>Using HTTP Parameter Pollution, an attacker can introduce multiple parameters with the same name into the request. In case of Password Reset, we can add another email parameter within our password reset request.</p>
<ol>
<li>Intercept Password Reset Request in Burp.</li>
<li>Add another parameter email in the request </li>
<li>Add attacker's email in the new parameter</li>
</ol>
<p>If the web app is vulnerable, the email with password reset link will be sent to both the emails in the request.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1623583664878/ktpXbgt42.png" alt="http parameter pollution.PNG" /></p>
<p>You can also try some other variations of this:</p>
<p>URL encoding a space character: <code>email=victim@email.com%20email=attacker@email.com</code> </p>
<p>Adding a pipe: <code>email=victim@email.com|email=attacker@email.com</code> </p>
<p>Adding a cc mail: <code>email="victim@email.com%0a%0dcc:attacker@mail.com"</code> </p>
<p>Adding a bcc mail: <code>email="victim@mail.com%0a%0dbcc:attacker@mail.com</code> </p>
<h3 id="case-3-manipulating-json">Case 3: Manipulating JSON</h3>
<p>Many times, the request parameters are passed as JSON objects to the reset password API. But the good news is, you can still do the same manipulations for JSON objects as well.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1623584760088/btpSRFPzy.png" alt="json.PNG" /></p>
<p>Some other things you can try with JSON:</p>
<p>Pass an array: <code>{"email":["victim@mail.com","attacker@mail.com"]}</code></p>
<p>Pass wildcard operator in array: <code>{"email":["victim@mail.com","*"]}</code></p>
<p>Pass null in array: <code>{"email":["victim@mail.com","null"]}</code> </p>
<p>Pass null: <code>{"email":"null"}</code> </p>
<p>Pass wildcard operator: <code>{"email":"*"}</code> </p>
<p><strong>Note:</strong> JSON is funny, and different parsers work with JSON objects differently. For example, if two identical parameters are passed, Python may parse the second parameter first and Ruby may parse the first parameter first. This can result in interesting behavior across applications when we pass multiple parameters with the same key, or no parameters, or wildcards, etc. </p>
<p>And so, always try payloads like {"email":"*"} in every request that uses JSON and see how the application responds. Sometimes, wildcards or nulls on API endpoints can return highly sensitive data of all users, or error messages with sensitive info, etc.</p>
<h3 id="case-4-token-reuse">Case 4: Token Reuse</h3>
<p>Password reset tokens should expire once used. Users should not be able to use the same password reset links multiple times. While this cannot be exploited in real life unless you have some way of getting the victim's access token, but it is still not a good practice to implement password reset in one of the following ways.</p>
<p>Case 4.1: </p>
<ol>
<li>Request password reset for person@email.com </li>
<li>Open the password reset link</li>
<li>Reset the password</li>
<li>Try to use the same link again to reset the password again</li>
<li>If the link doesn't expire and same link can be used again, the web application is vulnerable.</li>
</ol>
<p>Case 4.2:</p>
<ol>
<li>Request password reset for person@email.com </li>
<li>Do not use the reset link. Keep the link say L1</li>
<li>Request password reset for person@email.com again</li>
<li>Do not use the new reset link L2 as well</li>
<li>After requesting L2, now try using L1 to reset the password</li>
</ol>
<p>L1 should not work. If L1 can still be used after requesting L2, the implementation of password reset is not secure as L1 should auto expire once L2 is requested.</p>
<h3 id="case-5-password-reset-token-leakage-via-referer-header">Case 5: Password Reset Token Leakage via Referer header</h3>
<p>The Referer header is an HTTP Request Header that helps web servers identify where request is coming from. When you make a request from webpage 1 to webpage 2, the Referer header is added to the request for webpage 2 to identify that the request came from webpage 1. This information is used for logging, caching and analytics.</p>
<p>However, this also means that requests originating from the password reset page may also leak the password reset token via the the Referer header. Sometimes, web applications have footers or sidebars with links to third party websites, links to the company's social media accounts, etc. And the Referer header may leak the token to these external links.</p>
<ol>
<li>Request password reset.</li>
<li>Open the password reset link.</li>
<li>Start Burp proxy and turn the intercept on.</li>
<li>Click on any of the third party links/ social media links on the password reset page.</li>
<li>You may see the password reset token being leaked in the Referer header.</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1623597549956/nZk6F0Z1u.png" alt="referer header.PNG" /></p>
<p>Again, this is more of a misconfiguration than a security issue as you would normally only have links to trusted websites on your web page. But this is definitely worth mentioning as this is a high risk issue for CMS' and LMS' which allow you to customize what links appear on UI.</p>
<h3 id="case-6-hidden-parameters">Case 6: Hidden Parameters</h3>
<p>This is a rather rare case where on requesting the password reset token, the reset link does not have the email parameter on UI. It only asks the user for new password. But when you intercept the request through a proxy like Burp, you can see that there is a hidden parameter email that goes along with the password.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1623598902217/2DobwynO8.png" alt="hidden param.PNG" /></p>
<p>In this case, you can just edit the email parameter in Burp and reset password for any user's account. This works only when the web server just validates if the token is valid and does not check which email the token links to.</p>
<h3 id="case-7-2fa-bypass">Case 7: 2FA Bypass</h3>
<p>Many applications implement password reset by sending an OTP to the user's email. And only when the user enters the right OTP, the application redirects the user to the password reset page.</p>
<p>OTP is probably not the best way to implement password reset as there are many ways of bypassing OTPs. In case there is no rate limiting implemented by the web server, bruteforcing a 6 digit OTP is just a matter of minutes with a tool like Burp Intruder. There are many other ways of bypassing 2FA like response manipulation, IP Rotate to get past rate limiting, etc.</p>
<h3 id="case-8-guessing">Case 8: Guessing</h3>
<p>This involves guessing the password reset token after observing how the token is generated multiple times. This is quite time consuming and complicated but very effective if it works. There is no general methodology but you can try a few things to figure out how the token is built. </p>
<p>Ideally, you would create atleast 3 accounts on the website and request multiple password reset tokens from each account. Then you can start looking at patterns in all these password reset tokens.</p>
<ol>
<li><p>Look at the password reset token for visual clues. Sometimes you can identify how the token was generated by just looking at the string. For example, if the token starts with 'ey' and is a long string separated by 2 dots in between, the token is most likely a JSON Web Token(JWT). Similarly, you can visually identify if the token is Base64 encoded, MD5 hash, etc by the token characters and length.</p>
</li>
<li><p>Sometimes, the token may contain the user ID for which password reset is requested. You may notice this after requesting the password reset token multiple times for the same account and observing if there is a fixed part. You may even see this in payload data of a JWT.</p>
</li>
<li><p>After multiple attempts of password reset, you might notice that the token has a fixed part and a variable part that changes after every attempt. At such times, it is important to investigate if the variable part is the timestamp. One way to do it is to request multiple password reset links at the same time instant by using something like Burp Intruder. If the tokens requested at the same time instant have the same variable part, it is probably the timestamp in some form. You might be able to use it to construct your own token even if you're not able to completely decode the timestamp format.</p>
</li>
<li><p>Figuring out the fixed part of the token is the most difficult. Typically, you would like to collect basic information of the user like email, first name, last name, user ID and try to construct the fixed part out of this. You can try encoding and hashing the data against MD4, MD5, SHA1, SHA256, etc. In case the token is a JWT, you can go to a site like jwt.io and try signing all this collected information with context specific keys like company name, etc.</p>
</li>
</ol>
<p><em>This article will be updated as I come across new techniques.</em></p>
<p><em>For any questions, feel free to reach out on  <a target="_blank" href="https://twitter.com/ar6aaz">Twitter</a> or  <a target="_blank" href="https://instagram.com/theblockchainblog">Instagram</a></em></p>
<p>Until next time.</p>
]]></content:encoded></item><item><title><![CDATA[What is IDN Homograph Attack?]]></title><description><![CDATA[Yesterday, I came across an interesting tweet from Simone(@evilsocket on Twitter). In the tweet, he put a link to  goᴏgle.com which on clicking, redirects to his Twitter account. Try it, click on the link in  this tweet  and see where you land up at....]]></description><link>https://a6z.co/what-is-idn-homograph-attack</link><guid isPermaLink="true">https://a6z.co/what-is-idn-homograph-attack</guid><category><![CDATA[2Articles1Week]]></category><category><![CDATA[hacking]]></category><category><![CDATA[cybersecurity]]></category><category><![CDATA[Security]]></category><category><![CDATA[Hashnode]]></category><dc:creator><![CDATA[Mohammed Arbaaz Shaikh]]></dc:creator><pubDate>Sat, 30 Jan 2021 11:53:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1612007705701/2niSh6ktg.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Yesterday, I came across an interesting tweet from Simone(<a target="_blank" href="https://twitter.com/evilsocket">@evilsocket</a> on Twitter). In the tweet, he put a link to  <a target="_blank" href="http://goᴏgle.com">goᴏgle.com</a> which on clicking, redirects to his Twitter account. Try it, click on the link in  <a target="_blank" href="https://twitter.com/evilsocket/status/1354871353464270860">this tweet</a>  and see where you land up at. Weird, right?</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1612005503994/ReoVc8YH_.png" alt="image.png" /></p>
<p>The link looks legit, yet it takes you to his Twitter account. Did he just hack Google?</p>
<p>Not really. In order to understand what is happening here, we will need to first understand IDN homographs.</p>
<h3 id="idn">IDN</h3>
<p>IDN stands for Internationalized Domain Names. It is a mechanism for handling domain names that contain characters other than normal ASCII characters. For example, domain names can contain Latin characters, Cyrillic characters, etc. But these International Domain Names can still not be represented in their Unicode format in URLs.</p>
<p>In comes Punycode. Punycode is a technique to represent these Unicode characters in their ASCII form. The corresponding ASCII code post Punycode conversion is in the form of hyphens, numbers and letters.    </p>
<p>So let’s try to decode <a target="_blank" href="http://goᴏgle.com">goᴏgle.com</a> and see what its Punycode representation is.
Head over to https://www.punycoder.com/ (Don’t worry, this is not a homograph link)</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1612005678415/0h7ilEwvF.png" alt="IDN.png" /></p>
<p>Next, paste the URL <a target="_blank" href="http://goᴏgle.com">goᴏgle.com</a> in the text box and click on ‘Convert to Punycode’.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1612005733239/EdrDHyRUy.png" alt="DN2.png" /></p>
<p>There it is, xn--gogle-n29a.com is the unmasked URL in Punycode format that was hiding behind the International Domain Name <a target="_blank" href="http://goᴏgle.com">goᴏgle.com</a>. So what Simone(<a target="_blank" href="https://twitter.com/evilsocket">@evilsocket</a>) probably did, was he bought the domain xn--gogle-n29a.com and redirected all requests on the domain to his Twitter profile.</p>
<p>If you’re interested in knowing more about the ToASCII and ToUnicode functions that are used for the conversion, you can get more details on  <a target="_blank" href="https://tools.ietf.org/html/rfc3490#page-10">RFC3490 here</a> .</p>
<p>Now comes the interesting part. How can an attacker leverage the use of IDN homographs?</p>
<h3 id="phishing">Phishing</h3>
<p>The first and obvious way is phishing. Majority of us would definitely click on the Google link from that tweet without hesitation. So imagine an attacker does this on an application that requires login. He can easily mass harvest credentials of users by creating an identical phishing page on the IDN homographed domain.</p>
<p>Another way would be using these domains to download and install malware on the computers of users who visit the site.</p>
<h3 id="url-redirects">URL Redirects</h3>
<p>URL redirection is another scenario where an attacker could use IDNs. For instance, let’s say we have an application target.com . The application has redirects that are accepted as valid only when the redirects are to the same origin target.com/*. An attacker can replace any of the letters in URL with Cyrillic characters. And if the server is not configured to convert the hostname to Punycode before validating the URL, it could redirect the user to the malicious URL.</p>
<blockquote>
</blockquote>
<p>Original URL: http://target.com/login?redirectURL:http://google.com</p>
<p>Malicious URL: http://target.com/login?redirectURL:<a target="_blank" href="http://goᴏgle.com">http://goᴏgle.com</a></p>
<p>The difference in the two URLs is not noticeable to the naked eye(here it is because hashnode is secure) but if a user clicks on the second URL, it will lead him to the malicious website. The attacker can potentially escalate the redirect to XSS if he can load and executes Javascript from the redirected URL.</p>
<h3 id="password-reset">Password Reset</h3>
<p>IDNs can also be used on Password Reset functionality of applications to change password of any user. For example, let’s say arbaaz@gmail.com has an account on target.com. An attacker can send a password reset request for <a target="_blank" href="arbaaz@gmáil.com">arbaaz@gmáil.com</a> (notice the á).</p>
<p>If the password reset functionality is not configured to convert the email to Punycode and then validate it, it will send the password reset link to <a target="_blank" href="arbaaz@gmáil.com">arbaaz@gmáil.com</a>, i.e. xn--arbaaz@gmil-s7a.com in its ASCII converted form.</p>
<p>An attacker can buy the domain xn--arbaaz@gmil-s7a.com and get the credentials for arbaaz@gmail.com by requesting password reset on <a target="_blank" href="arbaaz@gmáil.com">arbaaz@gmáil.com</a></p>
<p>So that is how IDN homographs work. I will leave you with  <a target="_blank" href="https://hackerone.com/reports/861940">this report</a>  where a security researcher was able to able to get a user’s OAuth token on SEMRush using IDN homographs.</p>
<p><em>For any questions, feel free to reach out on  <a target="_blank" href="https://twitter.com/ar6aaz">Twitter</a> or  <a target="_blank" href="https://instagram.com/theblockchainblog">Instagram</a></em></p>
<p>Until next time.</p>
]]></content:encoded></item><item><title><![CDATA[Code your own Port Scanner using Python]]></title><description><![CDATA[Nmap
Nmap is one of the most important Information Gathering tools used by a Penetration Tester. Nmap or network mapper is a port scanning program that finds open ports on the target host. Based on which port is open, the penetration tester can furth...]]></description><link>https://a6z.co/code-your-own-port-scanner-using-python</link><guid isPermaLink="true">https://a6z.co/code-your-own-port-scanner-using-python</guid><category><![CDATA[2Articles1Week]]></category><category><![CDATA[Python]]></category><category><![CDATA[hacking]]></category><category><![CDATA[coding]]></category><category><![CDATA[Python 3]]></category><dc:creator><![CDATA[Mohammed Arbaaz Shaikh]]></dc:creator><pubDate>Tue, 26 Jan 2021 07:51:23 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1611647408347/_Glm3gdFT.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="nmap">Nmap</h3>
<p>Nmap is one of the most important Information Gathering tools used by a Penetration Tester. Nmap or network mapper is a port scanning program that finds open ports on the target host. Based on which port is open, the penetration tester can further structure their plan of attack.</p>
<p>Nmap is a great tool and offers more than just finding open ports. It can be used to enumerate what services are running on the open ports and in some cases, also to find the exact version of the service running on that port. It also has some more advanced features like NSE(Nmap Scripting Engine) or the flags that it offers as commands, but its most important utility is the port scanning functionality.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611643316944/Br3N-LEbD.png" alt="nmap scan.png" /></p>
<p>Today, we will code a simple Nmap like port scanner using Python that will tell us which ports on a given host are open.</p>
<h3 id="imports">Imports</h3>
<p>We will start with importing the modules we need to build our simple port scanner.</p>
<p>First, we need the socket module. We will use its functions to establish a TCP connection to the target ports on a target host. So, let’s import it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611643328459/iTjV_-jtz.png" alt="import.png" /></p>
<p>Also, just to make our output look pretty, we will display the open ports in green and closed ports in red. For that, we will import termcolor module.</p>
<h3 id="code">Code</h3>
<p>Next, we need to create a socket instance.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611643392099/nNylBnXnW.png" alt="socket object.png" /></p>
<p>In the first line, we create the socket instance. The first parameter AF_INET refers to the address family of IPv4 addresses. We are using this because the input to our scanner will be the IPv4 Address that our program will scan. SOCK_STREAM, the second parameter, because we’re creating a TCP socket and will be using the TCP protocol for connection.</p>
<p>The setdefaulttimeout() function takes the number of seconds as a parameter. In our case, we will set the default timeout for new sockets to 1 second.</p>
<p>In the third line, we take the target's IPv4 address as input from user and save it in the host variable. We will use this variable to connect to the host later.</p>
<p>Now, we will set up a for loop to iterate through the number of ports in a particular range.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611643743392/FkvXAL5p8.png" alt="for loop.png" /></p>
<p>We will scan the first 1000 ports. You can change the range if you want to. We will pass the port number in every iteration to the portScanner() function. But we haven't coded our portScanner() function yet, so let's do that now.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611643832144/IhGU8Wf2k.png" alt="portScanner function.png" /></p>
<p>The portScanner() function is a simple if else conditional loop. The connect_ex() function will try to establish a connection to the host given by the user and at the port passed by the for loop's current iteration.</p>
<p>You can use connect() instead of connect_ex() as well, but you have to remember to surround it by try-except. On the other hand, connect_ex() returns a 1 or 0 indicating success or failure of the operation.</p>
<p>If we manage to connect to the target port successfully, we will simply print out the port number and a message that the port is open. Else, we will print the said port is closed.</p>
<p>Let’s have a look at the complete code now.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611644036166/e9CuZAPdO.png" alt="portScanner.png" /></p>
<h3 id="time-to-test">Time to Test</h3>
<p>Now, it is time to check if our code works. To test the code, close your editor and run the code using python3 command.</p>
<p>The command for running the code is:</p>
<blockquote>
<p>python3 filename.py</p>
</blockquote>
<p>Enter the host IP address you want to scan. I’m going to enter the IP of my Windows 7 virtual machine.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611644178107/gBlk51wxl.png" alt="output.png" /></p>
<p>The scan will continue for some time. Once it reaches an open port, it will print it out in green.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611644436226/qJf-wBs0g.png" alt="output2.png" /></p>
<p>To speed up the scan and have a clear terminal, you can comment the print statement for closed ports.</p>
<p>And with that, we have completed our Simple Port Scanner in Python.</p>
<h3 id="what-next">What next?</h3>
<p>You can modify this simple port scanner to make it more user friendly. For example, our simple scanner only scans IP Addresses as of now. We can write a function that translates domain names to addresses. Next, instead of scanning for 1000 ports, we can ask the user to input the ports or port range he wants to scan.</p>
<p><em>For any questions, feel free to reach out on  <a target="_blank" href="https://twitter.com/ar6aaz">Twitter</a> or  <a target="_blank" href="https://instagram.com/theblockchainblog">Instagram</a></em></p>
<p>Until next time.</p>
]]></content:encoded></item><item><title><![CDATA[Understanding Gas in Ethereum]]></title><description><![CDATA[Ethereum is more than just a cryptocurrency. The Ethereum Blockchain serves as a platform where you can build and deploy decentralized applications or DApps. These DApps are governed by Smart Contracts, which are basically If-This-Then-That rules tha...]]></description><link>https://a6z.co/understanding-gas-in-ethereum</link><guid isPermaLink="true">https://a6z.co/understanding-gas-in-ethereum</guid><category><![CDATA[2Articles1Week]]></category><category><![CDATA[Blockchain]]></category><category><![CDATA[Ethereum]]></category><category><![CDATA[Hashnode]]></category><category><![CDATA[technology]]></category><dc:creator><![CDATA[Mohammed Arbaaz Shaikh]]></dc:creator><pubDate>Sat, 23 Jan 2021 15:33:24 GMT</pubDate><content:encoded><![CDATA[<p>Ethereum is more than just a cryptocurrency. The Ethereum Blockchain serves as a platform where you can build and deploy decentralized applications or DApps. These DApps are governed by Smart Contracts, which are basically If-This-Then-That rules that help to validate and verify transactions.</p>
<h3 id="transactions">Transactions</h3>
<p>A transaction in Ethereum is not just limited to transfer of Ether (Ethereum’s native cryptocurrency). Transactions in Ethereum can also be operations that are performed by Smart Contracts. When you interact with the Ethereum Blockchain in any way to modify or update the state of Ethereum Network, you are essentially executing a transaction.</p>
<h3 id="ethereum-virtual-machine">Ethereum Virtual Machine</h3>
<p>A Virtual Machine is a machine that emulates a normal computer but isn’t physically present on the base host. Ethereum Virtual Machine is no different. EVM runs on every Ethereum node and is responsible for executing transactions. However, executing these transactions on the Ethereum Virtual Machine requires consumption of resources and hence, it comes at a cost. We refer to this cost as Gas in the Ethereum world.</p>
<h3 id="gas">Gas</h3>
<p>Just like your car consumes gas to go from place A to B, operations and computations on the Ethereum blockchain also consume gas to execute. Every Smart Contract written in Solidity comprises of some lines of code. And every line of code consumes gas to execute. The amount of gas required by a computation is different for different operations. For example, an addition operation may require x units of gas, a multiplication operation may require y units of gas, etc.</p>
<p>The operations of smart contract are executed by miners on the blockchain. So, the gas cost of all transactions and operations is paid to the miners. In a way, the concept of gas is similar to the concept of transaction fees in Bitcoin, which is also paid to the miners.</p>
<p>Gas is measured in terms of Gas units, which can be converted to Ether to calculate the price. The reason why a separate entity (gas) was introduced to measure the computational efforts needed to execute a transaction instead of Ether itself, is because of the high volatility of the price of Ether. Having a fixed gas price solves that problem of determining the amount of Ether needed as fees.</p>
<h3 id="gas-price-limit">Gas Price Limit</h3>
<p>Just like Bitcoin’s transaction fees, the sender of an Ethereum transaction can specify the maximum gas they are willing to pay for the transaction to go through. If this gas limit is set too low a value, no miner will pick that transaction and it will not get executed.  At the same time, if the maximum gas limit is set too high, the sender will be overpaying the miners for a relatively less amount of computational effort. So, how to know the ideal gas price limit for a transaction?</p>
<p><em>ethgasstation.info</em> is a website that suggests gas price at any moment in the network. It recommends Gas prices in Gwei that will ensure that your transaction goes through.</p>
<h3 id="gas-significance">Gas Significance</h3>
<p>Since every transaction and operation in Ethereum requires some gas cost to execute, it enables Smart Contract developers to write efficient code with minimal operations (and thus minimal gas price). This also adds an additional layer of security to the network and protects it from any entity with malicious intention of clogging the network.</p>
<p>This is because if an entity tries to clog the network with code entering an infinite loop, the entity will quickly run out of gas to pay for each operation and the code will stop executing. It keeps both users and miners safe from bad code.</p>
<p><em>For any questions, feel free to reach out on  <a target="_blank" href="https://twitter.com/ar6aaz">Twitter</a> or  <a target="_blank" href="https://instagram.com/theblockchainblog">Instagram</a></em></p>
<p>Until next time.</p>
]]></content:encoded></item><item><title><![CDATA[How I accidentally found my first bug]]></title><description><![CDATA[Last year in July, I tried to test myself and signed up on Intigriti, a popular bug bounty platform. With college being shut down due to COVID and my job waiting on my college degree, I had spent the free time in lockdown studying different security ...]]></description><link>https://a6z.co/how-i-accidentally-found-my-first-bug</link><guid isPermaLink="true">https://a6z.co/how-i-accidentally-found-my-first-bug</guid><category><![CDATA[2Articles1Week]]></category><category><![CDATA[Bugs and Errors]]></category><category><![CDATA[Testing]]></category><category><![CDATA[hacking]]></category><category><![CDATA[Software Testing]]></category><dc:creator><![CDATA[Mohammed Arbaaz Shaikh]]></dc:creator><pubDate>Sat, 16 Jan 2021 12:01:23 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1610797873314/RIQTA6DEg.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Last year in July, I tried to test myself and signed up on Intigriti, a popular bug bounty platform. With college being shut down due to COVID and my job waiting on my college degree, I had spent the free time in lockdown studying different security vulnerabilities in web applications. I figured bug bounty programs would be a good place to put into practice what I had learnt.</p>
<h3 id="the-realization">The Realization</h3>
<p>Bug bounties are tough. They really are. The competition in public bug bounty programs is crazy and it is very difficult to find bugs as a beginner. To add to that, there are professional hunters out there who have built and setup their automation frameworks on VPSs that automate most of their processes. Leaving no low hanging fruits for you as a beginner (Not being salty, they absolutely deserve it for their hard work).</p>
<p>It took me a month to find my first bug on a public program after which I started getting private invites.</p>
<h3 id="the-struggle">The Struggle</h3>
<p>I have this habit of using Firefox in Incognito mode to search for stuff and have Burp Suite running in a normal Firefox window when I'm testing any web application. And funnily enough, that habit found me the bug!</p>
<p>I was going through the web app of the program in question, let’s call it <em>target.com</em> from here on. I had tried a number of things on <em>target.com</em> already, but couldn’t find a bug. My failed attempts included finding XSS, SQLi, IDORs, checking the password reset functionality, testing the JWT implementation and a lot of other things. But even after a week of sticking to the same program, no success!</p>
<h3 id="the-accident">The Accident</h3>
<p>I was about to give up on my nth program and move on to the (n+1)th when something happened. I was on my normal browser window, logged in into the application. Burp’s content discovery had found me a bunch of endpoints in the application that were exposing some Javascript files. I had read enough bug bounty writeups where people found access tokens and other sensitive information in JS files. So I decided to go through those files before calling it quits.</p>
<p>One by one, I was copying the endpoints from Burp and opening them in my browser window. Because I was logged in, the application was allowing me to access the endpoints as well. This one time however, I accidentally copied an endpoint from Burp and paste it into the incognito browser window, that I use to Google stuff. That’s when it happened!</p>
<h3 id="open-redirect">Open Redirect</h3>
<p>The JS file didn’t load because I wasn’t logged into the web application in the incognito window. The browser took me to <em>target.com’s</em> Login Page. I noticed the URL and found something interesting. The URL looked like this:</p>
<blockquote>
<p>https://target.com/login?targetURL=/path/of/js/file.js</p>
</blockquote>
<p>Upon login, the application was going to take me straight to the JS file endpoint and not to the Dashboard. It was using the targetURL parameter to redirect me.</p>
<p>I immediately thought this could potentially be vulnerable to Open Redirect. And so, I changed the value of the targetURL parameter to https://maliciouswebsite.com</p>
<p>The complete URL now looked like </p>
<blockquote>
<p>https://target.com/login?targetURL=https://maliciouswebsite.com/</p>
</blockquote>
<p>I put my login credentials and hit enter. And the application now redirected me to maliciouswebsite.com!</p>
<p>For those who don’t know what Open Redirect is, an Open Redirect is simply when an attacker is able to redirect users from the target web application to another malicious web application controlled by the attacker. In this case, the attacker would be able to redirect the user from target.com to maliciouswebsite.com using the targetURL parameter.</p>
<h3 id="why-is-this-a-security-issue">Why is this a Security Issue?</h3>
<p>Open Redirect on its own is not considered as a big security issue, especially in bug bounty programs. The most an attacker could do, is lead the user to a malicious phishing website that looks exactly like the target application.</p>
<p>But Open Redirects can be chained with many other security issues to increase their impact. Some chaining methods include:</p>
<ul>
<li><p>Open Redirect to trigger XSS (Cross Site Scripting)</p>
</li>
<li><p>Open Redirect to steal tokens (OAuth, JWT Tokens, etc)</p>
</li>
<li><p>Open redirect on Login/Password Reset pages to steal credentials</p>
</li>
<li><p>Open Redirect chained with SSRF (Server Side Request Forgery)</p>
</li>
</ul>
<p>The above chaining methods drastically increase the impact of an Open Redirect Vulnerability. At the time I found the bug, I did not know much about chaining, so reported it just as an Open Redirect.</p>
<p>But I'll leave you with these reports of Open Redirect chained with XSS vulnerability in  <a target="_blank" href="https://hackerone.com/reports/260744">Twitter</a> and <a target="_blank" href="https://hackerone.com/reports/125791">Uber</a>.</p>
<p><em>For any questions, feel free to reach out on  <a target="_blank" href="https://twitter.com/ar6aaz">Twitter</a> or  <a target="_blank" href="https://instagram.com/theblockchainblog">Instagram</a></em></p>
<p>Until next time.</p>
]]></content:encoded></item><item><title><![CDATA[Why do we need Ethereum 2.0?]]></title><description><![CDATA[Ethereum is currently in the process of moving from the current Ethereum architecture(Proof of Work) to Ethereum 2.0 (Proof of Stake).
Ethereum 2.0 is the biggest upgrade to the Ethereum mainnet since the launch of Ethereum back in 2015. Ethereum 2.0...]]></description><link>https://a6z.co/why-do-we-need-ethereum-20</link><guid isPermaLink="true">https://a6z.co/why-do-we-need-ethereum-20</guid><category><![CDATA[2Articles1Week]]></category><category><![CDATA[Blockchain]]></category><category><![CDATA[Ethereum]]></category><category><![CDATA[Cryptocurrency]]></category><dc:creator><![CDATA[Mohammed Arbaaz Shaikh]]></dc:creator><pubDate>Wed, 13 Jan 2021 17:23:52 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1610558618462/gc6InPo8I.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Ethereum is currently in the process of moving from the current Ethereum architecture(Proof of Work) to Ethereum 2.0 (Proof of Stake).</p>
<p>Ethereum 2.0 is the biggest upgrade to the Ethereum mainnet since the launch of Ethereum back in 2015. Ethereum 2.0 comes with some big improvements to the Ethereum blockchain to tackle some of its problems inherent from day one. In this post, we will learn what the issues of Ethereum are and why we need Ethereum 2.0.</p>
<h3 id="proof-of-work">Proof of Work</h3>
<p>The Ethereum Blockchain currently uses the Proof of Work mechanism to reach consensus. In Proof of Work, miners compete with each other to solve a cryptographic puzzle. The miner who solves the puzzle first gets a reward for mining the block.</p>
<p>In order to become a miner, an Ethereum user must set up a full node on his/her computer. They also need to have some expensive hardware(GPUs/ASICs) that will ensure they solve the puzzle before other miners. This results in consumption and wastage of massive amount of electricity.</p>
<h3 id="the-problems-with-ethereum-10">The problems with Ethereum 1.0</h3>
<p>The current architecture of Ethereum (PoW) makes it extremely secure, there is no denying that. But the current Ethereum architecture also happens to have some flaws.</p>
<p>For example, Scalability and Accessibility are two of the biggest flaws of the current Proof of Work Ethereum Blockchain. The main goal of Ethereum 2.0 is to overcome these flaws of Ethereum 1.0. It plans to do so by moving from Proof of Work to Proof of Stake Consensus mechanism.</p>
<h3 id="scalability">Scalability</h3>
<p>The current Ethereum Blockchain mines blocks sequentially, with a limit on the size of data that can be added to a block. This is a problem because it restricts or limits the amount of data that is processed in a given amount of time.</p>
<p>When the number of transactions to be processed exceeds the amount of data that can be added to a block, many transactions have to wait for subsequent blocks to be confirmed. And hence, the current Ethereum architecture is not very scalable to handle many transactions. Ethereum 2.0 solves this problem using Shard Chains.</p>
<h3 id="accessibility">Accessibility</h3>
<p>It has become very difficult for an individual to run a full node and start mining new blocks on the Ethereum blockchain. The mining hardware is quite expensive for an individual to start in the first place.</p>
<p>Moreover, a miner also needs to reside in an area where the electricity costs are comparatively less because of the energy consumption in the entire process of PoW mining.</p>
<p>This however, becomes profitable for companies and mining pools. Governments usually charge businesses and companies comparatively less for their electricity consumption. Normal individuals cannot compete with these companies and this leads to centralization of power in the mining process.</p>
<p>Proof of Stake in Ethereum 2.0 will try to reduce the centralization of power and will make mining more accessible to individuals interested in validating the blocks.</p>
<p>That is it for this post. I hope you found it useful and learnt something new.</p>
<p>Feel free to reach out on Twitter(<a target="_blank" href="https://www.twitter.com/ar6aaz">@ar6aaz</a>) or Instagram(<a target="_blank" href="https://www.instagram.com/theblockchainblog/">@theblockchainblog</a>)</p>
<p>Until next time.</p>
]]></content:encoded></item><item><title><![CDATA[Understanding Hash Cryptography In Blockchains Part 2: Five Requirements of a Cryptographic Hash Function]]></title><description><![CDATA[In  Part One , we saw what a cryptographic hash function is and in  this  short five minute introduction to Blockchain, we saw how it used in a Blockchain. Today, I will try to explain the five requirements of a good cryptographic hash function.
A go...]]></description><link>https://a6z.co/understanding-hash-cryptography-in-blockchains-part-2-five-requirements-of-a-cryptographic-hash-function</link><guid isPermaLink="true">https://a6z.co/understanding-hash-cryptography-in-blockchains-part-2-five-requirements-of-a-cryptographic-hash-function</guid><category><![CDATA[2Articles1Week]]></category><category><![CDATA[Blockchain]]></category><category><![CDATA[Cryptography]]></category><category><![CDATA[Ethereum]]></category><dc:creator><![CDATA[Mohammed Arbaaz Shaikh]]></dc:creator><pubDate>Thu, 07 Jan 2021 17:32:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1610040751253/-Zg1PhPLf.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In  <a target="_blank" href="https://www.arbaaz.info/understanding-hash-cryptography-in-blockchains-part-1">Part One</a> , we saw what a cryptographic hash function is and in  <a target="_blank" href="https://www.arbaaz.info/blockchain-in-five-minutes">this</a>  short five minute introduction to Blockchain, we saw how it used in a Blockchain. Today, I will try to explain the five requirements of a good cryptographic hash function.</p>
<p>A good cryptographic hash function must possess the following five properties:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1610039820014/T3Jis96zY.jpeg" alt="Five Requirements of Hash Function.jpg" /></p>
<h3 id="one-way">One way</h3>
<p>A cryptographic hash function must always be one way. That is, it should be possible to find the hash from an input easily. But, the reverse must not be possible. By no means should the input be recovered from the hash. This one way functionality of hashes is the reason why passwords are usually hashed before they are stored in the database. </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1610039552310/Z5Q_36jPE.jpeg" alt="one way hash function.jpg" /></p>
<p>So even if someone manages to get access to the database, they still won’t be able to reverse the hash.</p>
<h3 id="deterministic">Deterministic</h3>
<p>A cryptographic hash function must be deterministic. For a given input value, the output must always give the same hash value if passed through the same cryptographic hash function. In addition, two copies of the same document should also always give the same hash when passed through the same cryptographic function.</p>
<h3 id="fast-computation">Fast Computation</h3>
<p>The cryptographic hash functions undergo a number of complex mathematical computations before they produce the hash. These computations make the hash one way, so they are important and can’t be ignored. </p>
<p>However, computers must also be able to perform these complex mathematical calculations involved in producing the hash in a short period of time. This property of producing the hash in a short time is also known as the hash functions being computationally efficient.</p>
<h3 id="must-withstand-collisions">Must withstand collisions</h3>
<p>A collision is a situation when the hash function gives the same output value for two different inputs. The perfect analogy for this is having two human beings with same fingerprints. The probability of two human beings having the same fingerprint is one in 64 million. Similarly, no two unique inputs should produce the same hash as output. This property of a hash function withstanding collisions is very important for blockchain based applications.</p>
<h3 id="avalanche-effect">Avalanche Effect</h3>
<p>The hashes generated from an input must not have any visible pattern of hash generation. This is because no user should be able to find a hidden way of guessing the hash; else they will be able to break the hash function easily. And so, for every single bit change in the input, the output hash should change completely. This is called the Avalanche effect.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1610039881165/nu7vyg3ar.jpeg" alt="avalanche effect sha256.jpg" /></p>
<p>So, “hello” and “Hello” will produce completely different hashes without showing any pattern.</p>
<p>These are the five important characteristics of any good cryptographic hash function. I hope you enjoyed this post.</p>
<p>Feel free to reach out on Twitter(<a target="_blank" href="https://twitter.com/ar6aaz">@ar6aaz</a>) or Instagram(<a target="_blank" href="https://www.instagram.com/theblockchainblog/">@theblockchainblog</a>)</p>
<p>Until next time.</p>
]]></content:encoded></item><item><title><![CDATA[Understanding Hash Cryptography In Blockchains: Part 1]]></title><description><![CDATA[Introduction
Hash Cryptography is one of the main pillars of any Blockchain. It is what makes blockchains what they are, a securely linked chain of blocks. And today, we’re going to learn why.
What is the easiest way for us to uniquely identify human...]]></description><link>https://a6z.co/understanding-hash-cryptography-in-blockchains-part-1</link><guid isPermaLink="true">https://a6z.co/understanding-hash-cryptography-in-blockchains-part-1</guid><category><![CDATA[2Articles1Week]]></category><category><![CDATA[Blockchain]]></category><category><![CDATA[Ethereum]]></category><category><![CDATA[Cryptography]]></category><category><![CDATA[Cryptocurrency]]></category><dc:creator><![CDATA[Mohammed Arbaaz Shaikh]]></dc:creator><pubDate>Sat, 02 Jan 2021 07:37:16 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1609571524159/LoZk0UDAa.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="introduction">Introduction</h3>
<p>Hash Cryptography is one of the main pillars of any Blockchain. It is what makes blockchains what they are, a securely linked chain of blocks. And today, we’re going to learn why.</p>
<p>What is the easiest way for us to uniquely identify humans?</p>
<p>“Just by looking at them” is not the answer. There are too many people with the same hairstyle, similar facial structure, skin tone and almost all other visual factors.</p>
<p>I’m going to save you time, and tell you the answer.
Fingerprint.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1609571600570/9whmP-zNq.jpeg" alt="fingerprint.jpg" /></p>
<p>The easiest way to uniquely identify humans is by their fingerprints. Almost every human has a unique fingerprint. And this can be(and is) used to uniquely identify us.</p>
<p>What about digital documents? Or a piece of text? Or an audio file? Or an entire Operating System?! How to identify these uniquely?</p>
<p>The answer is same. Digital fingerprint.</p>
<h3 id="digital-documents">Digital Documents</h3>
<p>Hash Cryptography helps us find these digital fingerprints. You take a piece of information (could be a pdf, a text, or a movie), pass it through a cryptographic hash function and the output you will receive is the hash (or digital fingerprint) of that document.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1609571654249/DRazCQMXm.png" alt="hash-cryptography-digital-fingerprint.png" /></p>
<p>In the  <a target="_blank" href="https://arbaaz.info/blockchain-in-five-minutes">previous post</a> , we saw how the chain of blocks is linked using the Previous Hash field in the Bitcoin Blockchain. The Previous Hash and the Hash field are computed using a cryptographic hash function.</p>
<p>The cryptographic hash function used in this case is SHA256. SHA stands for Secure Hash Algorithm, a family of many cryptographic hash functions like SHA256, SHA512, SHA128, etc.
SHA256 was developed by the NSA (National Security Agency) and the code was later made open source. The 256 in the name denotes the number of bits it takes in memory. It is a 64 character long hexadecimal hash where 4 bits represent each hexadecimal number. </p>
<p>Below is an example SHA256 hash of the input string "Hello"</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1609572383725/CSUwNECT4.png" alt="sha256.png" /></p>
<h3 id="bitcoin-blockchain">Bitcoin Blockchain</h3>
<p>In the Bitcoin Blockchain, the current hash is computed by giving the Data Field and the Previous Hash field as input to the SHA256 function, and the function returns the output i.e. the hash or fingerprint of the given data.</p>
<p>You can use the SHA256 or any modern cryptographic hash functions to find the hash (fingerprint) of any piece of information. You can find the hash value of documents, strings, executables, binaries, movies, entire operating systems, etc.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1609571869465/9XK3tQwgq.jpeg" alt="one way hash function.jpg" /></p>
<p>An important property of cryptographic hash functions is that they are one way. Which means, you can go from a document to finding its hash, but not the other way. You cannot recover a document from its hash.  This is what makes hashes secure and protects the immutability of blockchains.</p>
<p>In addition to being one way, a good cryptographic hash function should have five important properties. We will cover these five properties in detail in the next post.</p>
<p>Until next time.</p>
<p><em>Feel free to reach out on Twitter(<a target="_blank" href="https://twitter.com/ar6aaz">@ar6aaz</a> ) or Instagram(<a target="_blank" href="https://www.instagram.com/theblockchainblog/">@theblockchainblog</a> )
</em></p>
]]></content:encoded></item><item><title><![CDATA[Blockchain in Five Minutes]]></title><description><![CDATA[Hello World!
I’m sure you’ve stumbled upon this word called ‘Blockchain’ in the last few years. Today, if you use the words “Blockchain based” as a prefix to whatever you’re selling, you’re guaranteed to make 2x sales. The hype is real.
Anyway, we’re...]]></description><link>https://a6z.co/blockchain-in-five-minutes</link><guid isPermaLink="true">https://a6z.co/blockchain-in-five-minutes</guid><category><![CDATA[Blockchain]]></category><category><![CDATA[Ethereum]]></category><category><![CDATA[technology]]></category><dc:creator><![CDATA[Mohammed Arbaaz Shaikh]]></dc:creator><pubDate>Tue, 22 Dec 2020 17:52:24 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1608917483355/i3ulbADiW.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello World!</p>
<p>I’m sure you’ve stumbled upon this word called ‘Blockchain’ in the last few years. Today, if you use the words “Blockchain based” as a prefix to whatever you’re selling, you’re guaranteed to make 2x sales. The hype is real.</p>
<p>Anyway, we’re running out of time, I’ve only got five minutes to explain this. So let's start. </p>
<h3 id="what-is-a-blockchain">What is a Blockchain?</h3>
<p>A Blockchain is a continuously growing list of records called blocks, which are linked and secured using cryptography. Sounds too Wikipedia-ish, I know. Let’s break it down.</p>
<p>First, let’s understand what a block is.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1608657812912/FZh6HjQze.png" alt="Blockchain-Cryptographic-Hash.png" /></p>
<p>Block is the fundamental unit or the smallest indivisible part of a Blockchain. The image above shows what a block looks like. A block has many fields, but for the purpose of this post, we will consider only its three main fields viz. Data, Previous Hash and Hash.</p>
<p>The Data field of the block contains the information you want to store in your blockchain. Could be a vote in a blockchain based voting application, or a birth certificate in a blockchain based certificate registration application. In case of Bitcoin, the block stores Bitcoin transactions in its data field.</p>
<p>We’ll come back to the Previous Hash field later.</p>
<p>Next, we have the Hash field. The hash field contains the hash of the block.</p>
<h3 id="what-are-hashes-though">What are hashes though?</h3>
<p>A hash is a unique fingerprint of a piece of information. Hashes look different depending on the hashing algorithm, but usually, it is an alphanumeric string that looks like this: <em>185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969 </em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1608658035524/0EumWJNp9.png" alt="sha256.png" /></p>
<p>You give the hashing algorithm some input, and get the hash(fingerprint) in return as output. The goal is to find to a unique signature of all the information input to the algorithm. You can find a hash of a string, a pdf file or even an entire Operating System! Play around with  <a target="_blank" href="https://emn178.github.io/online-tools/sha256.html">this site</a>  to understand how different hashes are generated for different inputs.</p>
<p>In our case, we give the hashing algorithm the data field and the previous hash field as input, and get the (current block’s) hash as output. Check the image below for reference. This hash value of a block is very important. Because in future, if someone tries to change even one bit of information in any of the past blocks, the entire hash computed for those blocks changes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1608658165228/gbIPYh9AR.png" alt="what-is-a-blockchain.png" /></p>
<p>The hash of a block serves two purposes. One, it is the signature or fingerprint of that block. Second, it serves as the previous hash field in the next block. The previous hash field that is used to produce the hash of the current block comes from the previous block. <em>(I know it sounds confusing at first, but read it a couple more times with the above picture in mind and you'll get it)</em></p>
<p>If some hacker tries to change or modify the information in the data field of a block, it changes the hash of that block completely. And consequently, it changes the previous hash field of the next block and so on. The blockchain realizes something is wrong as all the hashes are computing to be different. This raises an alarm and the network reverts back to its original unmodified state, making the blockchain an immutable ledger.</p>
<p>This ‘unhackable’, or as I like to call it, ‘difficult to hack’ nature of blockchain will be much easier to understand when we discover the Distributed Peer-To-Peer network of blockchains. But that’s a topic for another day.</p>
<p>In conclusion, <em>a Blockchain is just a growing list of records called blocks, that are chained or linked to each other using cryptographic hashes.</em></p>
<p>That is it for my five minute explanation of Blockchain. Hope you found it helpful!</p>
<p>Feel free to reach out on Twitter(<a target="_blank" href="https://twitter.com/ar6aaz">@ar6aaz</a>) or Instagram(<a target="_blank" href="https://www.instagram.com/theblockchainblog/">@theblockchainblog</a>)</p>
<p>Until next time.</p>
]]></content:encoded></item></channel></rss>