<?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 Pratyaksh Singh on Medium]]></title>
        <description><![CDATA[Stories by Pratyaksh Singh on Medium]]></description>
        <link>https://medium.com/@singhpratyaksh10?source=rss-21e3403e41f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DP6v0PlfOuFrLlbhA9WORw.jpeg</url>
            <title>Stories by Pratyaksh Singh on Medium</title>
            <link>https://medium.com/@singhpratyaksh10?source=rss-21e3403e41f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 06:46:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@singhpratyaksh10/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[Analyzing a Phishing Campaign that Tricks Victims into Submitting their Credentials]]></title>
            <link>https://singhpratyaksh10.medium.com/analyzing-a-phishing-campaign-that-tricks-victims-into-submitting-their-credentials-809aeb1498a0?source=rss-21e3403e41f------2</link>
            <guid isPermaLink="false">https://medium.com/p/809aeb1498a0</guid>
            <category><![CDATA[phishing]]></category>
            <category><![CDATA[social-engineering]]></category>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[threat-hunting]]></category>
            <dc:creator><![CDATA[Pratyaksh Singh]]></dc:creator>
            <pubDate>Sun, 07 Apr 2024 18:13:20 GMT</pubDate>
            <atom:updated>2024-04-07T18:13:20.154Z</atom:updated>
            <content:encoded><![CDATA[<p>Analyzing a Phishing Campaign that Tricks Victims into Submitting their Credentials</p><p>Hi all!</p><p>During my Threat research journey, I surf a lot of forums to learn about trending phishing techniques and ongoing campaigns. Recently I came across this Reddit <a href="https://www.reddit.com/r/hacking/comments/1bii9jp/found_this_phishing_site_take_a_look_at_the_code/">Post</a>.</p><p>The post talked about an ongoing phishing campaign that aims to steal the Facebook and Instagram credentials of an unsuspecting user by tricking them into an online celebrity voting contest.</p><p>Following is the tale of exploring and reporting this scam to the relevant stakeholders.</p><h3>This phishing Campaign</h3><p>Below is the phishing domain:</p><pre>https://desicourtesy.vercel.app/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I5w8netkBoWZT_YOi2yfmA.png" /><figcaption>The homepage of the phishing website</figcaption></figure><p>As can be seen, the phishing page is designed to attract the audience who are generally into a lot of social media and celebrity chit-chats. These victims are not all, however, a majority of them are non-tech savvy and are easy to trick as they do not suspect such websites. The reason is that lots of marketing, PR etc agencies keep organizing such campaigns on a regular basis and this phishing campaign fits right in between without being easily noticed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N5sF3WhPPe8wJ-EnIKIVRQ.png" /><figcaption>The phishing website was built to cast online votes</figcaption></figure><p>Once you click on the voting button you are presented with a very basic and newbie UI. This prompt provides you the option to cast your vote either by Facebook or Instagram. Once you click on either of the above choices you are redirected to a Facebook/Instagram login phishing page as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vbXeWJh8ORw_xjLsTclHAQ.png" /></figure><p>Now when I tried entering random credentials to check where the requests are being made by analyzing the “Network” tab of the inspect element, it wasn’t very fruitful as all the requests being made were getting invalidated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6DiR3ojxYNqnUmoBgOQHdw.png" /></figure><p>From the Reddit post, I also knew to check for JS files to look for the Firebase key. Upon analysing the JS files, I came across a file named firebase.js which was entirely obfuscated. I used this <a href="https://obf-io.deobfuscate.io/">JS-deobfuscate </a>website to get the JS to make sense and I found the API key and the Firebase instance URL of this phishing website</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4YEtlhVRNcFpG6UV2RiFuQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ErxksM6EeDomZHNNLjECug.png" /></figure><p>Upon visiting the Firebase URL, I could observe thousands of credentials of the victims who cast their votes on the above-shared phishing website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FURPe3GYK6u1dZmjA2p6RQ.png" /></figure><h3>Delivery Mechanism</h3><p>The delivery of this phishing website was quite simple. Unsuspecting victims were flooded with a simple message requesting them to cast their vote in support of a user[scammer]. These scammers created fake Facebook and Instagram profiles, slid into the DMs of their victims and shared the phishing links with them. Below is a screenshot of a similar scenario.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V-DjwhuR8aBDKiCJ-h-xug.png" /><figcaption>Phishing link distribution via text message.</figcaption></figure><h3>Hunting such websites!</h3><p>Coming across this website was pure luck, this does not mean we cannot identify other similar phishing websites. Let’s have a look at how can we find them. We are going to use <a href="http://urlscan.io/">urlscan.io</a> for this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wp6wHD8_HzYSZLcunHCYOg.png" /><figcaption>urlscan.io</figcaption></figure><p>Scanning the above website on urlscan.io gives you the following results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*902C2XNWSqdiWBpEtLFgLQ.png" /></figure><p>The above screenshot reveals things like the IP where the website is hosted, moreover it has already been marked as “Malicious” by Google. Diving further into this, we can also check the HTTP requests the website makes. To do so, move to the <strong>HTTP </strong>section of urlscan.io</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*lpu-xc9jELP0LUD5Z9vEDA.png" /><figcaption>Resources the phishing website loads up</figcaption></figure><p>It can be observed that the phishing website is fetching lots of resource files such as media, scripts etc. We can use the hash of these files being fetched and scan the hash to find similar phishing websites which use the same file. Just click on any of the unique files and click on the hash, a new window will pop-up displaying other phishing websites.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c35IQQEnm_m2_A54IAPItA.png" /><figcaption>Unique file hash from desicourtesy.vercel.app</figcaption></figure><p>Above we have chosen the firebase.js file because that most probably would be a JS file with some custom changes and personally identifiable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H-3FphjSeUZw-5-C4ggNBg.png" /><figcaption>Other phishing websites using the same file implemented by desicourtesy.vercel.app</figcaption></figure><p>Below are some other similar websites hosting the above firebase.js file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oUFIPVTlq9JIIX0xzN3uiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5qGQSIWjPiZUzb0_9r_UzA.png" /></figure><p>Additionally, you could also scan the IP used to host the website to broaden your research. Let us take the IP of the newly found phishing website and scan it for other similar sites.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*RUVHgeGfqEgymF7PFCf6iw.png" /></figure><p>Digging more into this we can find more websites. However, we shall keep that for later blogs. Thanks for reading. Cheers!!</p><p>Thanks, <a href="https://twitter.com/thebitdoodler">Anshu</a> for proofreading the blog.</p><p>The credits for finding this phishing website go to the Reddit user <a href="https://www.reddit.com/user/sab50312/">sab50312</a> who shared the above post in <a href="https://www.reddit.com/r/hacking/comments/1bii9jp/found_this_phishing_site_take_a_look_at_the_code/">r/hacking</a>.</p><p>You can connect with me on <a href="https://twitter.com/mr_fr3qu3n533">Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=809aeb1498a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A short insight to code review]]></title>
            <link>https://singhpratyaksh10.medium.com/a-short-insight-to-code-review-2acef0ae9a6a?source=rss-21e3403e41f------2</link>
            <guid isPermaLink="false">https://medium.com/p/2acef0ae9a6a</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[source-code]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[code-review]]></category>
            <dc:creator><![CDATA[Pratyaksh Singh]]></dc:creator>
            <pubDate>Sun, 07 May 2023 13:48:03 GMT</pubDate>
            <atom:updated>2025-04-24T05:24:35.290Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey everyone!! I hope you are doing well.</p><h3>Why this blog?</h3><p>When I started gaining skills in penetration testing, the initial months of my learning involved copy-pasting the payloads and replicating what others did. I had no idea how to perform a pentest/hacking, this made most of my hacking a distasteful experience. I realized the obvious problem was my learning approach, I was too occupied with finding vulnerabilities but never cared to know about the reasons why a vulnerability exists.</p><p>To change my approach I started learning a bit of programming and started coding tools either in Python or Bash that I used daily. When I started my first internship, I insisted my seniors assign me static source code analysis projects. Not only my seniors assigned me the project, but they also helped me complete it successfully by guiding me throughout the project. While performing my first code review on an actual project, I for the first time understood why a vulnerability existed in an application. This experience gave me a perspective on how developers think and what mistakes they commonly make while programming, this is what got me started in reviewing codes and helped me become better at my skills.</p><p>I knew I wasn’t alone to go through this experience and many still do thus I decided to write this blog. Now without any further ado, let us jump right into the basics of it, or what I’ve learnt so far.</p><h3>What is code review?</h3><p>Secure code review is the process of examining an application’s source code to improve the overall security posture of the application. It can either be automated(language, framework-specific) or can be manual. The goal is not just to identify the security flaws within the source code but also to provide valid mitigation and to introduce secure code practices within the development cycle to prevent the preparation of insecure code implementation.</p><p>Benefits of learning source code review:</p><ol><li>Gives you a deeper understanding of how a developer thinks and how functionalities can be exploited.</li><li>If you are a Pentester, you’d understand why a bug exists in the first place.</li><li>It helps you find more bugs in real-life, now that you know how a developer thinks and implements a piece of code, you can find a workaround for the same functionality and exploit it.</li><li>It helps you find sensitive info related to your target, acute instances like AWS keys, auth tokens, API keys, hardcoded credentials, exposed files, and more.</li></ol><h3>How to review code?</h3><p>Before learning the proper way of reviewing code, in the initial days of my code review, I primarily focused on security misconfiguration and hard-coded sensitive information.</p><p>Consider, if my target code was based on ASP.NET, I was focused on the primary findings like:</p><h4>1. Sensitive hardcoded info like credentials, API key, Secret tokens etc</h4><p>Import the code you’re reviewing in any code editor(I prefer VS Code) and start grepping for keywords such as:</p><ul><li>password / pwd / passwd / pass / password / admin_passwd / adminpasswd / adminPass</li><li>API_Key / apikey / api-key</li><li>Secret / Secrect_key / skey / private key / private_key / pkey</li></ul><p>You can grep for more keywords by using a wordlist from GitHub. Here is one that I follow, <a href="https://github.com/random-robbie/keywords/blob/master/keywords.txt">https://github.com/random-robbie/keywords/blob/master/keywords.txt</a></p><h4>2. Security misconfiguration</h4><p><strong><em>a. Custom Errors</em></strong></p><p>Take the below XML as an example, here we are checking whether the ASP.NET code has implemented custom error handling, if not, sensitive information can be disclosed on the client side via stack trace or default errors.</p><ul><li><strong>Misconfigured code:</strong></li></ul><pre>&lt;configuration&gt;<br>   &lt;system.web&gt;<br>      &lt;customErrors mode=&quot;Off&quot;&gt;</pre><ul><li><strong>Secure code:</strong></li></ul><pre>&lt;customErrors mode=&quot;RemoteOnly&quot;  <br>  defaultRedirect=&quot;customerror.htm&quot;&gt;  <br>    &lt;error statusCode=&quot;404&quot; redirect=&quot;customerror404.htm&quot;/&gt;  <br>&lt;/customErrors&gt;</pre><p><strong><em>b. HTTPOnly misconfiguration+</em></strong></p><p>HTTPOnly is a cookie attribute that helps mitigate client-side scripts from accessing protected cookies. If disabled, any malicious client-side scripts can access these cookies to later escalate the security flaw. in ASP.NET within the web.config file, below is how you define the HTTPOnly cookie attribute.</p><ul><li><strong>Misconfigured code:</strong></li></ul><pre>&lt;configuration&gt;<br>   &lt;system.web&gt;<br>      &lt;httpCookies httpOnlyCookies=&quot;false&quot;&gt;</pre><ul><li><strong>Secure code:</strong></li></ul><pre>&lt;configuration&gt;<br>   &lt;system.web&gt;<br>      &lt;httpCookies httpOnlyCookies=&quot;true&quot;&gt;</pre><p>Similarly, you too can start reviewing codes by focusing on finding security misconfigurations within the code you’re reviewing based on the language. A simple Google search will help you find resources.</p><p>From the above examples, it may seem to some that code review is just grepping for keywords and eventually finding vulnerabilities. However, to an extent it is true but as for code review in its entirety, the above example will not take you far enough.</p><p>Reviewing code involves skills such as pattern recognition, programming, identification of vulnerable elements/functions and a lot more. Take the below example:</p><pre>...<br>string userName = ctx.getAuthenticatedUserName();<br>string query = &quot;SELECT * FROM items WHERE owner = &#39;&quot; + userName + &quot;&#39; AND itemname = &#39;&quot; + ItemName.Text + &quot;&#39;&quot;;<br>sda = new SqlDataAdapter(query, conn);<br>DataTable dt = new DataTable();<br>sda.Fill(dt);<br>...</pre><p>The above is a SQL code snippet and it has nothing that has been discussed before in this blog. To review this code we will have first to understand what is happening here.</p><blockquote>The above code dynamically constructs a SQL query wherein the query returns data where the “owner” matches the user name. Hereby performing a direct concatenation of user input “userName” with the SQL query rather than using parameterized statements to eliminate any SQL injection vulnerabilities.</blockquote><p>Ideally, the above SQL query should be built as follows:</p><pre>SELECT * FROM items WHERE owner = {{username}} AND itemname = {{itemName}};</pre><p>Although an attacker can manipulate the above query to perform an SQL Injection attack here by breaking the SQL query by entering the below-mentioned payload as the value for the itemName user input</p><p>payload&#39; OR &#39;1&#39;=&#39;1</p><p>The above statement would make the final query as:</p><pre>SELECT * FROM items WHERE owner = &#39;Attacker&#39; AND itemname = &#39;payload&#39; OR &#39;1&#39;=&#39;1&#39;;</pre><p>The OR &#39;1&#39;=&#39;1 makes the SQL query perform in an unintended manner as now the usage or OR condition and providing a True condition i.e. &#39;1&#39;=&#39;1&#39; makes the query return all the data regardless of their owners.</p><p>The fault in implementation makes the code snippet vulnerable to SQL injection attacks.</p><p>So, the question arises is how do you review such codes? How do you review a source code with millions of lines of code? It might seem overwhelming but trust me there are multiple efficient ways to review code. We will discuss more about code review in the coming parts of this series. Until then you can go through a Twitter thread I posted for learning source code review which you can find <a href="https://twitter.com/mr_fr3qu3n533/status/1573046662167425024">here</a>.</p><p>I’ve kept this blog short and simple to give you an insight into what code review can be and how you too can get started with it. I’ll share more with you guys soon.</p><p>## References:</p><ul><li><a href="https://cwe.mitre.org/data/definitions/89.html">https://cwe.mitre.org/data/definitions/89.html</a></li><li><a href="https://www.c-sharpcorner.com/UploadFile/a53555/owasp-sharp5-security-misconfiguration-hardening-your-Asp-Net-a/">https://www.c-sharpcorner.com/UploadFile/a53555/owasp-sharp5-security-misconfiguration-hardening-your-Asp-Net-a/</a></li></ul><h4>You can find me here!!</h4><ul><li><a href="https://twitter.com/mr_fr3qu3n533">mr_fr3qu3n533</a></li><li>Write me a <a href="/service/mailto:fr3qu3n533@gmail.com">Mail</a> here.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2acef0ae9a6a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s have a SAML talks!]]></title>
            <link>https://infosecwriteups.com/lets-have-a-saml-talks-402559b34d4e?source=rss-21e3403e41f------2</link>
            <guid isPermaLink="false">https://medium.com/p/402559b34d4e</guid>
            <dc:creator><![CDATA[Pratyaksh Singh]]></dc:creator>
            <pubDate>Sun, 21 Mar 2021 15:37:20 GMT</pubDate>
            <atom:updated>2021-03-26T08:28:29.085Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey all 👋</p><p>How’s everyone doing?! Hope you are fine and keeping yourself productive. This article will only focus on SAML basics and few vulnerabilities associated with it.</p><h3># The Introduction</h3><p>A proper definition of SAML would be, “SAML(<strong>Security Assertion Markup Language)</strong> is an XML based SSO(Single Sign On)Authentication mechanism which transfer user identity data between Identity Providers(IdP) and Service Providers(SP) to authenticate users to access their requested resources without asking for credentials everytime”.</p><p>In layman’s term, “SAML is that one friend(Identity Provider) of yours in the town you live in, who knows every vendor(Service provider) of that town and as he has authorized you(you being his friend) every other vendor provide you their services without any further enquiries.”</p><p>It comes with advantages such as:</p><ul><li>No need to type in credentials</li><li>No need to remember and renew passwords</li><li>No weak passwords</li></ul><p>The implementation of SAML seems logical as most organization would already know the identity of the users as they are logged into their Active Directory domain or Intranet. So, it would also make sense to log the user into other 3rd party applications like web-app application (gmail, Outlook, Micrsoft Office etc).</p><h3># How does the SAML Authentication works?</h3><p>Before we jump into the technical explanation, let us first go through few terminologies.</p><ul><li><strong>Identity Providers:</strong> An identity provider (IdP) is a service that stores and verifies user identity. IdPs are typically cloud-hosted services, and they often work with single sign-on (SSO) providers to authenticate users.</li><li><strong>Service Providers: </strong>Trusts the identity provider and authorizes the given user to access the requested resource.</li><li><strong>SAML Assertions: </strong>An XML document that is sent to the service provider by the Identity provider that contains user authorization. This is sent over an HTTP browser redirect.</li></ul><p>There are 3 types of SAML Assertions:</p><ul><li><strong>Authentication assertion</strong> proves the identity of the user and simultaneously yields user’s logged in time &amp; the authentication method used.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*zVOZDYB1JDLTEFVzhjgZmQ.gif" /><figcaption>SAML Authentication assertion Example</figcaption></figure><ul><li><strong>Attribution assertion </strong>that provides the service provider with SAML attributes. SAML attributes are the data about the logged in user.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*zURstj9wamu4SZ2sXjmTyg.gif" /><figcaption>SAML attribute assertion Example</figcaption></figure><ul><li><strong>Authorization assertion </strong>contains proof that a certain user has been authorized to access a specified resource.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*zRlhwLMsE62nrcg0RlyTbQ.gif" /><figcaption>SAML Authorization <em>assertion Example</em></figcaption></figure><p>Microsoft Active Directory or Azure are common identity providers. Salesforce and other CRM arrangements are generally specialist co-ops, in that they rely upon a identity providers for client validation.</p><p>So let’s try to make sense of all this.</p><p>Consider you are logged into a system that acts as a identity provider (Microsoft AD). Let us assume that the user also wants to access any 3rd party application like Salesforce.</p><p>The SAML Authentication flow for above would look like:</p><ol><li>You access any Microsoft AD over the internet.</li><li>The application Microsoft AD identifies you, the user, and redirects you to the identity provider(IdP) which prompts you for your valid credentials(Username, Password &amp; maybe your 2fa authentication). This is what an authentication request would look like.</li><li>Now you establish a session with the Identity Provider by logging into it.</li><li>The Identity Provider crafts and authentication response in form of an XML document, containing the user data like email, username etc, now the Identity provider signs this document with an <a href="https://www.ssl.com/faqs/what-is-an-x-509-certificate/">X.509</a> certificate.</li><li>Now when logged into Microsoft AD(Identity Provider), you try to access a 3rd party application like Salesforce(Service Provider). You request resources from Salesforce and it redirects you to Identity Provider(i.e. Microsoft AD) with an SAML request.</li><li>The SAML request is passed on to the Identity Provider( Microsoft AD) via browser(user-agent), which now sends back an SAML response(XML Document) which was crafted before in step 4 and digitally signed with an X.509 Certificate to the browser(user-agent).</li><li>The browser(user-agent) now passes the same SAML response back to the Service Provider (Salesforce).</li><li>Service Provider(Salesforce) after receiving the SAML response from the Identity Provider(Microsoft AD) via the browser(user-agent) now authenticates the user without asking for credentials.</li></ol><blockquote>Mind you that during all this process the Service Provider has the knowledge of existence of the Identity Provider, thus the reason why a Service Provider would trust the Identity Provider, to authenticate any user.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*fKv4cWqciTI9KQsTsFlkKA.png" /><figcaption>SAML Flow Visualization.</figcaption></figure><p>Summing it all up, I’d say that SAML authentication gives you access to one service which eventually grants to you access to all other associated services.</p><h3># SAML Configuration</h3><p>Any SAML configuration is done on two associated entities of SAML i.e. IdP &amp; SP. The configuration of IdP is important as it should be aware of the fact where the users should be redirected when they try to access any SP. And the SP needs to be configured because it needs to know that the SAML assertion sent by IdP can be trusted.</p><p><strong>Configuring IdP</strong></p><p>SAML assertion format is provided by SP and are set by IdP. Below are few key elements of any SAML assertion that are needed to be set by any admin.</p><p><strong># EntityID:</strong> It’s a unique name for any SP. The format/syntax may vary. See example below.</p><pre>&lt;EntityDescriptor entityID=&quot;urn:mace:incommon:example.edu&quot;&gt;</pre><p><strong># Assertion Consumer Service(ACS):</strong> The location of the URL where the SAML assertion will be sent. See example below</p><pre>https://example.edu/SAML/consume</pre><p><strong># ACS validator:</strong> A safety mechanism in form of an REGEX that ensures that the SAML assertion goes to the specified ACS.</p><pre>^https:\/\/example\.edu\/saml\/consume\/$</pre><p><strong># Attributes: </strong>The SAML assertion attribute contains info about the user.</p><pre>&lt;saml:AttributeStatement&gt;<br>    &lt;saml:Attribute FriendlyName=&quot;fooAttrib&quot; Name=&quot;SFDC_USERNAME&quot; NameFormat=&quot;urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified&quot;&gt;<br>        &lt;saml:AttributeValue xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:type=&quot;xs:string&quot;&gt;<br>            user@example.edu<br>        &lt;/saml:AttributeValue&gt;<br>    &lt;/saml:Attribute&gt;<br> &lt;/saml:AttributeStatement&gt;</pre><p><strong>SP Configuration</strong></p><p>Here the information we deal with is provided by the IdP and set at the SP.</p><p><strong># X.509 Certificate: </strong>A certificate provided by the IdP which is passed through the SAML assertion and is used to verify the Public key.</p><p><strong># Issuer URL: </strong>Contains information about the IdP in order to validate SAML assertion received from the IdP provided URL.</p><pre>&lt;saml:Issuer&gt;https://example.edu/saml/id/metadata.php&lt;/saml:Issuer&gt;</pre><blockquote><a href="https://duo.com/blog/the-beer-drinkers-guide-to-saml">Read more about SAML Configuration here</a></blockquote><h3># Vulnerabilities and attacks</h3><p>Now that we are done with the basic concept of SAML, we can now move onto the attacks and vulnerabilities associated with SAML. I obviously can’t explain them all here so I’ll be listing few out here with resources. In my next article I might explain them till then read the resources here.</p><p># 1. <a href="https://www.youtube.com/watch?v=h7ViO5YUuFA">Identity Theft attack</a></p><p># 2. <a href="https://www.cyberark.com/resources/threat-research-blog/golden-saml-newly-discovered-attack-technique-forges-authentication-to-cloud-apps">Golden SAML</a></p><p># 3. <a href="https://www.idm-360.com/idm360/the-dangers-of-saml-replay-attacks/">SAML Replay Attack</a></p><p># 4. <a href="https://advisories.dxw.com/advisories/publicly-exploitable-command-injection-in-ruby-saml-0-7-2-library-can-root-the-host/">SAML Command Injection</a></p><p>References:</p><ul><li><a href="https://docs.oracle.com/cd/E27515_01/common/tutorials/authz_saml_assertion.html">https://docs.oracle.com/cd/E27515_01/common/tutorials/authz_saml_assertion.html</a></li><li><a href="https://duo.com/blog/the-beer-drinkers-guide-to-saml">https://duo.com/blog/the-beer-drinkers-guide-to-saml</a></li><li><a href="https://developers.onelogin.com/saml">https://developers.onelogin.com/saml</a></li><li><a href="https://www.varonis.com/blog/what-is-saml/">https://www.varonis.com/blog/what-is-saml/</a></li></ul><p>Follow me on twitter: <a href="https://twitter.com/mr_fr3qu3n533">@mr_fr3qu3n533</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=402559b34d4e" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/lets-have-a-saml-talks-402559b34d4e">Let’s have a SAML talks!</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[Let us Traceback -A HTB WriteUp]]></title>
            <link>https://medium.com/seconset/let-us-traceback-a-htb-writeup-b7b727ffdf78?source=rss-21e3403e41f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7b727ffdf78</guid>
            <dc:creator><![CDATA[Pratyaksh Singh]]></dc:creator>
            <pubDate>Thu, 03 Sep 2020 09:22:13 GMT</pubDate>
            <atom:updated>2020-09-03T09:22:13.290Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey folks, today we are going to go through Traceback machine on HTB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/0*UDb4YZC6Gmll0Qwq.png" /></figure><p>Let us jump right into it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*bSDjvAVkcqFCLJo1" /></figure><p>First we perform “<strong>nmap</strong>” scan:</p><blockquote>nmap -sC -sV 10.10.10.181</blockquote><pre>Starting Nmap 7.80 ( https://nmap.org ) at 2020-07-18 16:45 IST<br>Stats: 0:00:57 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan<br>SYN Stealth Scan Timing: About 99.99% done; ETC: 16:46 (0:00:00 remaining)<br>Nmap scan report for 10.10.10.181<br>Host is up (0.49s latency).<br>Not shown: 998 closed ports<br>PORT   STATE SERVICE VERSION<br>22/tcp open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey:<br>|   2048 96:25:51:8e:6c:83:07:48:ce:11:4b:1f:e5:6d:8a:28 (RSA)<br>|   256 54:bd:46:71:14:bd:b2:42:a1:b6:b0:2d:94:14:3b:0d (ECDSA)<br>|_  256 4d:c3:f8:52:b8:85:ec:9c:3e:4d:57:2c:4a:82:fd:86 (ED25519)<br>80/tcp open  http    Apache httpd 2.4.29 ((Ubuntu))<br>|_http-server-header: Apache/2.4.29 (Ubuntu)<br>|_http-title: Help us<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel<br>​<br>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>Nmap done: 1 IP address (1 host up) scanned in 82.78 seconds<br>​</pre><p>Nothing much here apart from a ssh service information.</p><p>We are also given another open port i.e. port:80 this means that a http service is also currently running.</p><p>let us now visit the site</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*x_-P8dtEtU95P2Ngg6bQvg.png" /></figure><p>Hmm…Let us first examine the source code of the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*j0ZESVbRDoI87rBnYImWUw.png" /></figure><p>Hmm…the comment obviously is giving us a hint about the web shells.</p><p>Let us all try to find those web shells, just copy the comment and search for the string in your browser.</p><p>The very first link I got was <a href="https://github.com/TheBinitGhimire/Web-Shells">“this”.</a></p><p>Here you get a bunch of web shells out of which you need to figure out the one we are going to work with….</p><p>To do so…. Just copy the names of all the web shell into a file and then run the “dirb” command with these web shells as the wordlist. 🐒</p><p>Once you find the correct web shell, you can now visit that shell by adding <a href="http://[ip]/webshell_name.php">http://[ip]/webshell_name.php</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*C5yPs64SdyDL00phJPHaTw.png" /></figure><p>Interesting, we get a login page, the username and password can be found in the web shell itself. Use them to log in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*gHvAu3q3J9uo0I8L4Re_HA.png" /></figure><p>Now that you are in, navigate to the /home/webadmin/.ssh/ directory, delete the authorized_keys file on the server.</p><p>Now you need to upload your own ssh key onto the server.</p><p>To create the ssh-key use the command “ssh-keygen” in the .ssh/ directory and change the name of the newly generated file id_rsa.pub to authorized_keys and then upload it onto the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*YCqtHvzEXY1n9iY4X1yYUg.png" /></figure><p>Deleting the old key :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*Z7zdZsNWLzKIGYlLHQq9ng.png" /></figure><p>Upload the newly generated SSH key:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*44StFP8ALQtegIfDhlrFiA.png" /></figure><p>Once the ssh file is uploaded onto the server, use the command</p><p>ssh webadmin@10.10.10.181 -i id_rsa</p><p>This command will get you the access to the web admin shell on the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*UkrzaZsQeYRuGD8pLCcEQg.png" /></figure><p>Voila, we are in. Let us see what we can find in the directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*ZHz1jlPDMnPk4TEngavHmA.png" /></figure><p>Hmmm…..interesting, we are getting to know about a tool to practice LUA. If you do not know what LUA is I recommend you to do a quick google search regarding it.</p><p>Let us look into the file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*bF1XXk__YncyPrn_kUBsqw.png" /></figure><p>Let us try to find the file related to Lua, using the “find” command in Linux. Now go try to find some exploit for lua.</p><p>After researching i got this <a href="https://gtfobins.github.io/gtfobins/lua/">site</a></p><p>Now before moving forward let us just check the privilege the user webadmin has, to do this type the command, sudo -ll, this command tells us which commands can the user run wit escalated privileges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*tRTGRtcp4z-Fk4OtYbBWvg.png" /></figure><p>We can see that the user webadmin has the access to the instance ‘luvit’ which has to be executed as user ‘sysadmin’.</p><p>Let us go ahead and execute the command:</p><p>use the command: sudo -u sysadmin /home/sysadmin/luvit</p><p>-u: flag is used to indicate to run a command as some specific user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*c9DX7HtRtOdEStdEfBnWqw.png" /></figure><p>Let us move to the sysadmin home directory, and see what we can find there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*Pui8dENifm0EiWMwp-DgPA.png" /></figure><p>Yaaay, we finally got our user hash.</p><p>Now let us go hunt down the root hash….</p><p>Rememeber the ‘Welcome to Xh4H land’ when we first logged into the webadmin server?</p><p>That message basically comes from a motd file that contains a “message of the day”, this file generally exist in the /etc/ folder in linux.</p><p>Let us see if we can find it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*2GKUr9owfaou3lQLSPAZOA.png" /></figure><p>We can clearly see that the file ‘00-header’ contains the string saying, “Welcome to Xh4H land”. Also looking at the file type of this file, we come to know that this is a shellscript.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*yonKitGPXTPCWB321zQj6g.png" /></figure><p>Looking at the permissions of the file we see that we do have the ‘write’ permission allowed for the file ‘00-header’. This means we can edit the file.</p><p>Let us see if we can find a way to get the root hash using this file…</p><p>Edit the file and put the following commands into it</p><ul><li>cat /root/root.txt</li><li>echo done.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*Eu3Fe5aAGWqYwSlb9njT_A.png" /></figure><p>After doing this again log into the server using ssh, use the command, ssh webadmin@10.10.10.181 -i id_rsa</p><p>And you’ll be given the root hash along with the welcome message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*g9FMw8AJ8YL2kjJneDjnOw.png" /></figure><p>There you go, we have successfully completed this machine.</p><p>Thanks for reading this write up. Every share and likes would encourage me to write some more. See you in the next one. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7b727ffdf78" width="1" height="1" alt=""><hr><p><a href="https://medium.com/seconset/let-us-traceback-a-htb-writeup-b7b727ffdf78">Let us Traceback -A HTB WriteUp</a> was originally published in <a href="https://medium.com/seconset">SecOnset</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>