• Welcome to Professional A2DGC Business
  • 011-43061583
  • info@a2dgc.com

Onion Routing

03

Jul

Onion Routing

Jul 03, 2023

Blog Credit: Trupti Thakur

Image Courtesy: Google

Onion Routing

 

Onion routing is a technique for anonymous communication over a computer network. In an onion network, messages are encapsulated in layers of encryption, analogous to layers of an onion.

There is a large set of precautionary measures and best practices to make web browsing safer and more secure for users. Let’s say that you send an HTTPS request to a server and someone intercepts that request but that person can’t know what that message says because it’s encrypted. But you are still not satisfied with this level of security and want to take this to the next level i.e. you don’t even want anyone sniffing on your network to know which server you are contacting and if you are making any requests or not. This is where onion routing comes in.

The Onion Routing program consists of studies that investigate, design, construct and analyze anonymous communication networks. The focus is on realistic solutions for low-latency Internet-based connections that can withstand traffic analysis, eavesdropping, and other attacks from both outsiders (such as Internet routers) and insiders (such as hackers) (Onion Routing servers themselves). Onion Routing hides who is communicating with whom from the transport medium; the network just knows that communication is taking place. Furthermore, until the transmission leaves the OR network, the content of the conversation remains hidden from eavesdroppers.

 

How does onion routing work?

If you are browsing the internet on a normal web browser like Chrome, firefox, etc you request webpages by making simple GET requests to servers without any intermediary. It’s just a single connection between a client and a server and someone sniffing on your network can know which server your computer is contacting.

  • Onion routing does this differently. In onion routing, the connection is maintained between different nodes i.e. the connection hops from one server to another and when it reaches the last server on this circuit it is the server that we wanted to contact and it will process our request and serve us the desired webpage which is sent back to us using the same network of nodes.
  • Now you must think why is it called the onion router. It is because the message we send and the responses we receive are encrypted with different keys, with a unique key for encryption for every different hop or server visit.
  • The client has access to all the keys but the servers only have access to the keys specific for encryption/decryption to that server.
  • Since this process wraps your message under layers of encryptionwhich have to be peeled off at each different hop just like an onion that’s why it’s called an onion router.

Understanding Onion routing concept an example

Now suppose you are browsing the internet using Tor(the onion router) which is a special browser that lets you use the onion routers. You want to access YouTube but you live in China and since YouTube is banned in China you don’t want your government to know that you are visiting YouTube so you decide to use Tor. Your computer needs to contact a particular server to get the homepage of YouTube but it doesn’t directly contact that server. It does that through 3 nodes/servers/routers (these servers are maintained all over the world by volunteers) before that server so that no one can trace back your conversation with that server. To make this example simple I am using 3 nodes but a real Tor network can have hundreds of nodes in between.

 

  1. The client with access to all the encryption keys i.e key 1, key 2 & key 3encrypts the message(get request) thrice wrapping it under 3 layers like an onion which have to be peeled one at a time.
  2. This triple encrypted messageis then sent to the first server i.e. Node 1(Input Node).
  3. Node 1only has the address of Node 2 and Key 1. So it decrypts the message using Key 1 and realizes that it doesn’t make any sense since it still has 2 layers of encryption so it passes it on to Node 2
  4. Node 2has Key 2 and the addresses of the input & exit nodes. So it decrypts the message using Key 2 realizes that it’s still encrypted and passes it onto the exit node
  5. Node 3 (exit node)peels off the last layer of encryption and finds a GET request for youtube.com and passes it onto the destination server
  6. The server processes the request and serves up the desired webpage as a
  7. The response passes through the same nodes in the reverse direction where each node puts on a layer of encryptionusing their specific key
  8. It finally reaches the client in the form of a triple encryptedresponse which can be decrypted since the client has access to all the keys

 

How does it provide anonymity?

Imagine if there is a sniffer listening in at the first connection(client – input node) all it can know is the address of the input node and a thrice encrypted message that doesn’t make sense. So all the attacker/sniffer knows that you are browsing tor.
Similarly, if sniffing starts at the exit node all the sniffer sees is a server contacting another server but it can’t track the client or the source of the request generated.
But now you may think that if someone is listening in at Node 2 they will know the address of the input and exit and can trace the client and the destination server. But it’s not that simple, each of these nodes has hundreds of concurrent connections going on, and knowing which one leads to the right source and destination is not that easy. In our circuit, Node 2 is a middle node but it can be a part of another circuit on a different connection where it acts as the input node receiving requests or an exit node serving up webpages from various servers.

 

Vulnerability in Onion Routing

The only security flaw in onion routing is that if someone is listening in on a server at the same time and matches the request at the destination to a request made by a client on the other side of a network by analyzing the length and the frequency of the characters found in the intercepted request or response at the destination server and using that to match with the same request made by a client a fraction of a second (time-stamps on requests and responses can also be helpful in deducing that) and then tracking them down and knowing their online activity and shattering the idea of anonymity. This is pretty hard to do but not impossible. But removing this flaw from Tor is virtually impossible.

features of onion routing:

Encryption: Onion routing encrypts each layer of data, making it difficult for an attacker to intercept and decode the data.

Anonymity: Onion routing provides anonymity by masking the IP address of the sender and the receiver, making it difficult for an attacker to identify them.

Relays: Onion routing uses a series of relays to route data through the network, with each relay only aware of the previous and next relays in the chain, adding another layer of anonymity.

Decentralized: Onion routing is decentralized, with no central authority or control over the network.

Resistance to traffic analysis: Onion routing makes it difficult for an attacker to analyze the traffic patterns and identify the source and destination of the communication.

Hidden Services: Onion routing can also be used to provide hidden services, which allow websites and other services to be hosted on the network without revealing their location or IP address.

onion routing provides a powerful technique for enhancing the security and privacy of internet communications, particularly in situations where anonymity and resistance to traffic analysis are important. It is commonly used by activists, journalists, and others who require a high level of security and privacy in their online communications.

Advantages of Onion Routing:

Enhanced Security: Onion routing provides enhanced security by encrypting data multiple times and routing it through several servers, making it difficult for attackers to intercept or tamper with the communication.

Anonymity: Onion routing provides anonymity by masking the IP address of the sender and the receiver, making it difficult for anyone to identify them.

Resistance to Traffic Analysis: Onion routing makes it difficult for attackers to analyze the traffic patterns and identify the source and destination of the communication, thereby enhancing privacy and security.

Decentralized: Onion routing is decentralized, with no central authority or control over the network, making it more resilient to attacks.

Evades Censorship: Onion routing can help users bypass censorship and access content that may be restricted or blocked by governments or internet service providers.

Protects Whistleblowers: Onion routing can provide a safe and anonymous means for whistleblowers to communicate sensitive information without fear of reprisal or retaliation.

Enhances Privacy: Onion routing can help protect user privacy by preventing internet service providers, advertisers, and other third parties from tracking or monitoring their online activity.

Increased Accessibility: Onion routing can allow users to access content or services that may be geographically restricted or blocked, such as streaming services or websites.

Improved Network Performance: Onion routing can improve network performance by distributing traffic across multiple servers, reducing the load on any one server and potentially reducing latency.

Flexible Routing: Onion routing allows for flexible routing of data, as it is not limited to a specific route or set of nodes. This can allow for more efficient and customized routing based on network conditions or user preferences.

Secure Communications for Sensitive Data: Onion routing can provide secure communication channels for sensitive data, such as financial transactions, personal information, or confidential business communications.

Protection Against Network Surveillance: Onion routing can protect against network surveillance by government agencies or other malicious actors who may be monitoring internet traffic for surveillance purposes.

Cross-Platform Compatibility: Onion routing is compatible with multiple operating systems and devices, making it accessible to a wide range of users.

Disadvantages of Onion Routing:

Slow Performance: Onion routing can result in slow performance due to the multiple layers of encryption and the need to route data through several servers.

Limited Accessibility: Onion routing is not widely accessible, and users may need specialized software to use it.

Malicious Use: Onion routing can be used for malicious purposes, such as to facilitate illegal activities, making it a target for law enforcement agencies.

Vulnerability to Endpoints: While onion routing provides enhanced security and anonymity during transmission, the endpoints of the communication may still be vulnerable to attacks, making it important to secure the endpoints as well.

Resource Intensive: Onion routing can be resource-intensive, requiring a large number of servers to route data, which can result in high bandwidth usage and increased costs.

Vulnerable to Exit Nodes: The exit nodes of the onion routing network can be vulnerable to attacks, making it important to use reputable and trusted exit nodes.

Limited Quality of Service: Onion routing can result in limited quality of service, with slower connection speeds and reduced network capacity, which may not be suitable for certain applications such as streaming or online gaming.

Difficult to Debug: Debugging problems in onion routing networks can be difficult due to the multiple layers of encryption and the decentralized nature of the network.

 

Onion Routing In Simple Terms

Onion routing is a method of communicating anonymously over a computer network. Messages in an onion network are encapsulated in layers of encryption, similar to the layers of an onion.

To make web browsing safer and more secure for users, there is a large set of precautionary measures and best practices. Assume you send an HTTPS request to a server and someone intercepts it, but that person cannot read the message because it is encrypted. However, you are not satisfied with this level of security and wish to take it to the next level, i.e. you do not want anyone sniffing on your network to know which server you are contacting and whether or not you are making any requests. This is where the onion routing comes into play.

The Onion Routing program is made up of studies that look into, design, build, and analyze anonymous communication networks. The emphasis is on practical solutions for low-latency Internet-based connections that can withstand traffic analysis, eavesdropping, and other attacks from both outsiders (like Internet routers) and insiders (like hackers) (Onion Routing servers themselves). The network only knows that communication is taking place because onion routing hides who is communicating with whom from the transport medium. Furthermore, the content of the conversation is hidden from eavesdroppers until the transmission leaves the OR network.

What is the procedure for onion routing?

When you browse the internet using a standard web browser such as Chrome or Firefox, you request webpages by sending simple GET requests to servers with no intermediary. It is only a single connection between a client and a server, and anyone sniffing on your network can determine which server your computer is contacting.

 

  • This is done differently in onion routing. The connection is maintained between different nodes in onion routing, i.e. the connection hops from one server to another and when it reaches the last server on this circuit, it is the server that we wanted to contact and it will process our request and serve us the desired webpage, which is returned to us using the same network of nodes.
  • You’re probably wondering why it’s called the onion router. It’s because the messages we send and the responses we receive are encrypted with different keys, with each hop or server visit requiring a different key for encryption.
  • The client has access to all keys, but the servers only have access to the keys that are specific to that server’s encryption/decryption.
  • Because this process wraps your message in layers of encryption that must be peeled off at each different hop, it is referred to as an onion router.

An explanation of the onion routing concept

Now imagine you are using Tor (the onion router), a unique browser that enables you to use the onion routers, to browse the internet. Since YouTube is blocked in China, you want to access YouTube but you also don’t want your government to find out that you are doing so, so you choose to use Tor. To get the YouTube homepage, your computer must make contact with a specific server, but it does not do so directly. In order to prevent anyone from tracking the conversation you had with that server, it does this through three nodes/servers/routers (maintained by volunteers around the world) before that server. Although a real Tor network can have hundreds of nodes in between, I am only using 3 nodes in this example to keep things simple.

 

  • The client encrypts the message (get request) three times, wrapping it in three layers like an onion that must be peeled one layer at a time. This client has access to keys 1, 2, and 3.
  • This triple-encrypted message is then forwarded to Node 1, the first server (Input Node).
  • Only Node 2’s address and Key 1 are stored in Node 1. It uses Key 1 to decrypt the message but realizes that it is illogical because there are still two layers of encryption, so it sends the message to Node 2.
  • Key 2 and the addresses of the input and exit nodes are located on Node 2. It then transmits the message to the exit node after using Key 2 to decrypt it but realizing that it is still encrypted.
  • A GET request for youtube.com is discovered by Node 3 (the exit node), which removes the final layer of encryption and forwards it to the target server.
  • The requested webpage is delivered as a result of the server processing the request.
  • The response travels backward through the same nodes, each of which adds a layer of encryption using its unique key.
  • In the end, it is delivered to the client as a triple encrypted response that can be decrypted because the client has access to all the keys.

In what way does it offer anonymity?

Imagine that a sniffer is present at the first connection (client – input node) and that all it can decipher is the address of the input node and an illogical message that has been triple encrypted. Therefore, the spy or attacker is aware that you are using Tor to browse.

Similar to this, if sniffing begins at the exit node, all the sniffer sees is one server speaking to another, but it is unable to identify the client or the origin of the request.

However, you might now imagine that if someone were to listen in at Node 2, they would be able to trace the client and the destination server if they knew the addresses of the input and exit. But it’s not that easy; each node runs hundreds of connections simultaneously, making it difficult to determine which connection leads to the correct source and destination. Node 2 is a middle node in our circuit, but it can also be a part of another circuit on a different connection where it serves as an exit node dispensing websites from various servers or an input node receiving requests.

Attack Surface for Onion Routing

The only security hole in onion routing is that if someone is watching a server at the same time and compares a request made by a client on the other side of the network to a request made by a server at the destination by analyzing the length and frequency of the characters found in the intercepted request or response at the destination server and using that to match with the same request made by a client in a split second (time-stamps on requests and responses can also be used as a substitute for Even though it’s challenging, it’s not impossible. However, fixing this flaw in Tor is essentially impossible.

 

Blog By: Trupti Thakur

Recent Blog

BharatGenDec 23, 2024
The AI AgentsDec 18, 2024
The SORADec 17, 2024