Search This Blog

Thursday, May 5, 2022

HTTP Basics

Hacking is a skillset built upon other skillsets. Its a culmination of various fields of IT. In this post, I want to diverge from the low level vulnerability exploitation and expound on one of the most important topics in IT, which are some basics on Networking, HTTP and web servers and how we can discover vulnerabilities within websites, in the next set of blog posts. The Internet has become an efficient medium of information and resource retrieval the world has ever known since inception. This has me giving a brief crash course of the basics of networking, specifically, the workings of the internet. Networking is at the core of the way the Internet works. Networks, in non-technical terms, are systems, devices and computers that are all able to communicate and request information and data amongst each other. Within this transfer of data, there are certain rules and regulations that these networks follow and adhere to as well as different data transfer mediums...but that's another rabbit hole for another post.

Within networking is a protocol that the web functions under, along with many other services other than the web. TCP, which is also, Transmission Communication Protocol is basically a network communication standard that allows for applications and computer devices to transfer data over a network. TCP is the standard protocol that other services such as FTP, SMB, SSH and other services use.

Whenever you browser to access the internet, you always use a browser. This "browser" is simply software catered to the average user to communicate over HTTP with servers connected all around the world and give you the flexibility and ability to request for various pieces of information and resources that you want. Understanding the core functionalities of the web will allow you to understand how the web vulns are found and how you can also find them out to. The browser is also known to be playing the role of the "client".

Every website you access online is hosted on a web server, also known as an HTTP Server. A "server" is simply a computer system or even hardware dedicated to providing a service, or a host of services for that matter. This "web server" is in charge of handling "client" based requests as well handles code and also hosts and keeps all these information and data or "web pages" in a form of files and are mostly handled by system administrators. To be more technical, HTTP (Hyper Text Transfer Protocol) is a protocol that is in charge of transferring hypermedia documents. If you know one or two things about websites, one of the things you're introduced to is the fact that websites are primarily coded in HTML, CSS and Javascript, but that's also out of scope.

HTTP, SMB, FTP and many other services are all data transfer protocols that are under the TCP/IP standard. HTTP, functions on port 80. So basically, the websites you access on your browser access websites over the port 80. Every service (which in total are 65335) all have a specific port assigned to it by default, but they can all be configured to other ports if needed. HTTP functions over port 80 by default, and is a request-response protocol. This means that as you use your browser to search for a resource such as "cat photos" on google, you are sending a "request" to where the "google.com" server. As a result, the "google.com" server will send a "response" to your web browser, which in this case, will be the cat photos you weirdly requested for lol.


kaizen@kaizen-box:~# curl -I http://kaizensec.blogspot.com
HTTP/1.1 301 Moved Permanently
Location: https://kaizensec.blogspot.com/
Content-Type: text/html; charset=UTF-8
Date: Thu, 05 May 2022 18:03:46 GMT
Expires: Thu, 05 May 2022 18:03:46 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
X-XSS-Protection: 1; mode=block
Server: GSE
Transfer-Encoding: chunked
Accept-Ranges: none
Vary: Accept-Encoding


Under the hood of http requests sent to web servers for resource retrival, there are "request headers" sent to the web server that assist the server to know where the respective request is coming from such as the LOCATION of where the request is meant to go to, the content type CONTENT-TYPE of the request, which is typically going to be "text/html" along with other additional headers. The server sends back "response headers" which contain the 

Another component to the effective functioning of the web is DNS. Networks are comprised of different devices connected to each other with the ability to transfer data. How does a computer device know where to send data to? It is done by the use of IP Addresses. IP Addresses, specifically, IPV4, are 32bit octets that allows devices to be identified for the purpose of data transfer over a network.

                                      ##### Example Of An IP Address ##### 

                                              10 . 10 . 17 . 28 

I can be about 90% certain that you've seen these before. The remaining 10% is just in case you haven't. There are quite a bit to what pertains to IP Addresses, such as subnetting and the different IP Classes but that will be for another deeper post on Networking.

The miracle of DNS is that, we have millions of servers all around the world that are all hosting web sites and other additional services. Imagine if we had to remember IP Addresses in order for us to access websites. Our human brain will give up eventually on retaining such a plethora of information or rather, more of a major incovenience. Instead DNS was created, which is also known as Domain Name System. It's essentially a protocol under TCP/IP that resolves IP Addresses to Domain Names. Consider the following:


kaizen@kaizen-box:~# host kaizensec.blogspot.com
kaizensec.blogspot.com is an alias for blogspot.l.googleusercontent.com.
blogspot.l.googleusercontent.com has address 216.58.223.129
blogspot.l.googleusercontent.com has IPv6 address 2c0f:fb50:4002:800::2001


The host utility on my local machine allows users/sysadmins/hackers to be able to identify the IPV4 and IPV6 addresses of various domains. This blog has a domain name called 'kaizensec.blogspot.com' and the IP Address of this domain is 216.58.223.129. A Domain Name allows us humans to be able to remember these sites in order for us to access them later on, rather than remembering IP Addresses. DNS servers are the servers responsible for resolving these IP Addresses to their respective Domain Names.

This is a brief intro to HTTP, how websites work, what servers are and how they work as well as how DNS assist the whole process to be much more easier than what it could've been. Consider this a crash course on how you can better understand how HTTP works and how the internet works, in a nutshell. As you've probably noticed, if you wish to be proficient in hacking or even thrive in the IT industry, this knowledge is but a pre requisite because almost everything runs through networking. Let's just say the benefit is that you use networking on a daily basis so at least you got some points under your belt (unless you're from a parallel universe where we're still in the stone ages... if that's the case then I dont know what to tell you). At least now you have a higher view of how the internet works. Note that there are more detailed technicalities of how all these play out but this is enough for you to build a base for more advanced topics. I probably missed out a couple of things but for the most part, this seems to cover enough for the absolute beginner to grab a hold of and understand at a fundamental level.

No comments:

Post a Comment