THM – Walking An Application – Part 3

This is my notes from the Junior Pentesting course at TryHackMe. This course takes you through the basics and some advanced topics regarding penetration testing.


Introduction

  • View Source – Use your browser to view the human-readable source code of a website.
  • Inspector – Learn how to inspect page elements and make changes to view usually blocked content.
  • Debugger – Inspect and control the flow of a page’s JavaScript
  • Network – See all the network requests a page makes.

Exploring The Website

An excellent place to start is just with your browser exploring the website and noting down the individual pages/areas/features with a summary for each one.

An example site review for the Acme IT Support website would look something like this:

FeatureURLSummary
Home Page/This page contains a summary of what Acme IT Support does with a company photo of their staff.
Latest News/newsThis page contains a list of recently published news articles by the company, and each news article has a link with an id number, i.e. /news/article?id=1
News Article/news/article?id=1Displays the individual news article. Some articles seem to be blocked and reserved for premium customers only.
Contact Page/contactThis page contains a form for customers to contact the company. It contains name, email and message input fields and a send button.
Customers/customersThis link redirects to /customers/login.
Customer Login/customers/loginThis page contains a login form with username and password fields.
Customer Signup/customers/signupThis page contains a user-signup form that consists of a username, email, password and password confirmation input fields.
Customer Reset Password/customers/resetPassword reset form with an email address input field.
Customer Dashboard/customersThis page contains a list of the user’s tickets submitted to the IT support company and a “Create Ticket” button.
Create Ticket/customers/ticket/newThis page contains a form with a textbox for entering the IT issue and a file upload option to create an IT support ticket.
Customer Account/customers/accountThis page allows the user to edit their username, email and password.
Customer Logout/customers/logoutThis link logs the user out of the customer area.

Viewing the Page Source

The page source is the human-readable code returned to our browser/client from the web server each time we make a request.

The returned code is made up of HTML ( HyperText Markup Language), CSS ( Cascading Style Sheets ) and JavaScript, and it’s what tells our browser what content to display, how to show it and adds an element of interactivity with JavaScript.

How do I view the Page Source?

  1. While viewing a website, you can right-click on the page, and you’ll see an option on the menu that says View Page Source.
  2. Most browsers support putting view-source: in front of the URL for example, view-source:https://www.google.com/
  3. In your browser menu, you’ll find an option to view the page source. This option can sometimes be in submenus such as developer tools or more tools.

Let’s view some Page Source!

Code starting with <!– and ending with –> are comments. Comments are messages left by the website developer, usually to explain something in the code to other programmers or even notes/reminders for themselves. These comments don’t get displayed on the actual webpage. This comment describes how the homepage is temporary while a new one is in development. View the webpage in the comment to get your first flag.

Links to different pages in HTML are written in anchor tags ( these are HTML elements that start with <a ), and the link that you’ll be directed to is stored in the href attribute.

Many websites these days aren’t made from scratch and use what’s called a framework. A framework is a collection of premade code that easily allows a developer to include common features that a website would require, such as blogs, user management, form processing, and much more, saving the developers hours or days of development.

Viewing the page source can often give us clues into whether a framework is in use and, if so, which framework and even what version. Knowing the framework and version can be a powerful find as there may be public vulnerabilities in the framework, and the website might not be using the most up to date version. 

Developer Tools – Inspector

Developer Tools

Every modern browser includes developer tools; this is a tool kit used to aid web developers in debugging web applications and gives you a peek under the hood of a website to see what is going on. As a pentester, we can leverage these tools to provide us with a much better understanding of the web application.

Inspector

The page source doesn’t always represent what’s shown on a webpage; this is because CSS, JavaScript and user interaction can change the content and style of the page, which means we need a way to view what’s been displayed in the browser window at this exact time. Element inspector assists us with this by providing us with a live representation of what is currently on the website.

As well as viewing this live view, we can also edit and interact with the page elements, which is helpful for web developers to debug issues.

Developer Tools – Debugger

Developer Tools – Debugger

This panel in the developer tools is intended for debugging JavaScript, and again is an excellent feature for web developers wanting to work out why something might not be working. But as penetration testers, it gives us the option of digging deep into the JavaScript code. In Firefox and Safari, this feature is called Debugger, but in Google Chrome, it’s called Sources.

We can return some of the formattings by using the “Pretty Print” option, which looks like two braces { } to make it a little more readable, although due to the obfustication, it’s still difficult to comprehend what is going on with the file. If you scroll to the bottom of the flash.min.js file, you’ll see the line: flash[‘remove’]();

This little bit of JavaScript is what is removing the red popup from the page. We can utilise another feature of debugger called breakpoints. These are points in the code that we can force the browser to stop processing the JavaScript and pause the current execution.

Developer Tools – Network

Developer Tools – Network

The network tab on the developer tools can be used to keep track of every external request a webpage makes. If you click on the Network tab and then refresh the page, you’ll see all the files the page is requesting. 


With the network tab open, try filling in the contact form and pressing the Send Message button. You’ll notice an event in the network tab, and this is the form being submitted in the background using a method called AJAX. AJAX is a method for sending and receiving network data in a web application background without interfering by changing the current web page.

Similar Posts

  • THM – NMAP The Network Mapper – Part 2

    Table Of ContentsIntroductionNmap switchesOverview  Introduction When a computer runs a network service, it opens a networking construct called a “port” to receive the connection. Ports are necessary for making multiple requests or having multiple services available.  For example, when you load several webpages at once in a web browser, the program must have some way of determining which tab…

  • Command And Control – C2 Framework

    This is a list of Command and control (C2) servers that I’ve tested. Table Of ContentsCobalt StrikeCovenantInstallation and setupLisenersGruntsPowershell-Empire with StarkillerPoshC2GodGenesisMetasploitSliverLinks and tutorialInstallSliver and MetasploitBeacon vs sessionGenerating HTTP(S) Implants with certificateExtensions (Armory)CheatsheetExample getting beacon with msfBypassing defender with staged process hollowingHavoc C2InstallInstall the dependenciesUbuntu 20.04 / 22.04Kali and other Debian based Distros only.Debian 10/11Building the…

  • AV Evasion 101: Essential Techniques and Concepts

    Table Of ContentsSourceGood toolsMalware forums/channels/discordTest payload against AVDefcon – Writing custom backdoor payloads with C#Step by Step for obfuscating codeAV Evasion MindMap – From Start to finishGeneral AV Evasion cheatsheetCheck AV – Running, Exclusion, DisableWindows FirewallPowershell – ASMI bypass methods, Disable AV, etcAMSI BypassBypass CLM (Constrained Language Mode)Bypass loggingDisable MS Defender (Require elevation)Add folder exclusionLSASS…

  • THM – Command Injection – Part 11

    This is my notes from the Junior Pentesting course at TryHackMe. This course takes you through the basics and some advanced topics regarding penetration testing. Table Of ContentsWhat is Command Injection?Discovering Command InjectionExploiting Command InjectionDetecting Blind Command InjectionLinux WindowsRemediating Command InjectionVulnerable FunctionsInput sanitisationBypassing FiltersPractical: Command InjectionWhat user is this application running as?What are the contents of…

  • THM – Web Fundamentals – Part 10

    Table Of ContentsHow Do We Load Websites?  More HTTPS – Verbs and request formats Cookies  How Do We Load Websites?   Finding the server  A DNS request is made initially. DNS is like a giant phone book that takes a URL and turns it into an IP. You dont have to remember the IP of websites.   The IP address uniquely identifies each internet connected devices, like a web servere or your computer. They are formed of 4 groups of number, each 0-255 (x.x.x.x) and called an octect. Loading some content …

  • THM – Common Linux Privilege Escalation – Part 20

    This is a continued series where I document my path through different tryhackme courses. I recommend everyone that wants to learn cyber security to subscribe to tryhackme.com and take the courses there. Table Of ContentsDirection og Privilege EscalationEnumerationAbusing SUID/GUID FilesFinding SUID BinariesExploiting Wriitable /etc/passwdEscaping Vi EditorExploiting CrontabExploitning PATH Variable Direction og Privilege Escalation Two main…