graph LR A[Client] --> B[Guard relay] B --> C[Middle relay] C --> D[Exit relay] D --> E[Destination website]
Blue Team: SysAdmin
How we as read team hackers, can attack our machine.
TODO: Here explain ghidra, reverse engineer some binaries.
TODO: Explain how ELF works, yara yara yara.
We did the medium one: binaries, there are other ones that are easy (such as reverse-engineering java apps, python (which as interpreter, should make the code available, etc). And other ones that are harder (firmware such as the IME or BIOS, etc).
Scope β discover hosts β enumerate ports/services β investigate each exposed service β identify plausible vulnerabilities/misconfigurations β validate them safely β once authorized access exists, enumerate the host β assess privilege boundaries
nmap, etc, etc.
See the OWASP guide, it is great, here in this slides weβll only show the tools.
https://owasp.org/www-project-web-security-testing-guide/
https://release-assets.githubusercontent.com/github-production-release-asset/91277330/87c4c000-357b-11eb-8c88-e5664025b5bc?sp=r&sv=2018-11-09&sr=b&spr=https&se=2026-08-27T13%3A25%3A43Z&rscd=attachment%3B+filename%3Dwstg-v4.2.pdf&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2026-08-27T12%3A24%3A52Z&ske=2026-08-27T13%3A25%3A43Z&sks=b&skv=2018-11-09&sig=9bW3D3aHuNRdTgMfjb0QBG1DTQ%2B7JKL%2F3uYtxKD6S5U%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc4NzgzNTA3OCwibmJmIjoxNzg3ODM0Nzc4LCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.e42mFUTCM6NeXlY7GGduyLwFCVjU8iCCnDRfWNJp2hk&response-content-disposition=attachment%3B%20filename%3Dwstg-v4.2.pdf&response-content-type=application%2Foctet-stream
Tor wraps a message in multiple encryption layers, sends it through several relays, and each relay removes only the layer intended for it.
graph LR A[Client] --> B[Guard relay] B --> C[Middle relay] C --> D[Exit relay] D --> E[Destination website]
Each relay knows only its immediate neighbor. The packet looks more or less like this:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TLS LINK LAYER (from client to guard) β
β Visible to ISP: From [Your IP] to [Guard Relay IP] β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β GUARD LAYER (Outer Onion Layer) β β
β β Visible to Guard: "Send this to Middle Node" β β
β β βββββββββββββββββββββββββββββββββββββββββββββββββ β
β β βββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β MIDDLE LAYER (Middle Onion Layer) β β β
β β β Visible to Middle: "Send this to Exit Node"β β β
β β β ββββββββββββββββββββββββββββββββββββββββ β β β
β β β ββββββββββββββββββββββββββββββββββββββββββ β β β
β β β β EXIT LAYER (Inner Onion Layer) β β β β
β β β β Visible to Exit: "GET /index.html" β β β β
β β β ββββββββββββββββββββββββββββββββββββββββββ β β β
β β βββββββββββββββββββββββββββββββββββββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
A typical Tor client builds a circuit with three roles.
| Relay | Sees sender? | Sees destination? | Main role |
|---|---|---|---|
| Guard / entry | Yes | No | First hop into Tor |
| Middle | No | No | Separates guard from exit |
| Exit | No | Yes | Connects to normal internet destinations |
The design avoids giving any single relay both the userβs IP address and the final destination.
graph TD A[1. Client downloads network consensus] --> B[2. Client chooses relays] B --> C[3. Client performs key agreement with guard] C --> D[4. Client extends circuit to middle] D --> E[5. Client extends circuit to exit] E --> F[6. Client opens streams over circuit]
Tor clients need to know which relays exist and what capabilities they advertise.
Specialized directory authorities vote on relay information and produce a signed network consensus. The consensus gives clients a shared view of the Tor network.12
graph LR A[Relays publish descriptors] --> B[Directory authorities vote] B --> C[Signed consensus] C --> D[Clients choose relays]
The first relay is called a guard or entry guard.
Rather than choosing a totally new first hop every time, Tor clients use a small set of guards for a period of time. This reduces the chance that, over many circuits, a malicious relay eventually becomes the first hop.
Security tradeoff:
An exit relay is the last Tor relay before traffic reaches a normal internet destination.
Exit relays can see destination metadata and may see unencrypted content if the user connects to a non-HTTPS service.
This is why Tor does not remove the need for end-to-end encryption (if youβre using the βnormalβ internet, not applicable for hidden-services).
graph LR C[Client] --> G[Guard] G --> M[Middle] M --> E[Exit relay] E --> W[example.com]
Some networks block public Tor relays.
Bridges are Tor relays that are not listed in the public relay consensus in the same way as normal relays. They help users connect when public Tor access is blocked.
graph LR U[User in censored network] --> B[Bridge] B --> G[Tor guard] G --> M[Middle] M --> X[Exit]
Bridges help with censorship resistance, not invisibility.
Tor Browser is more than βjust a browserβ.
It also tries to reduce browser-level tracking and fingerprinting by using consistent defaults, privacy protections, and isolation behavior.
Examples of browser-level risks:
Network anonymity can fail if the browser leaks identifying information.
An onion service is a service reached entirely through Tor (does not use the βnormalβ internet)
flowchart LR C["Client"] --> CT["Tor circuit"] CT --> R["Rendezvous point"] R --> ST["Tor circuit"] ST --> S["Onion service"]
Unlike normal Tor browsing:
.onion, which identify a cryptographic identity..onion address is a public-key identityFor a v3 onion service, the address contains the serviceβs Ed25519 public identity key.
.onion address means: βI want the service owning this public keyβ.onion name to a server IP (weβll see how it works using HSDirs)Tor does not store:
Instead, special relays called Hidden Service Directories (HSDirs) store an encrypted, signed onion-service descriptor.
A descriptor contains information needed to contact the service, especially:
flowchart LR S["Onion service"] -->|descriptor| H1["HSDir #3253"] S -->|descriptor| H2["HSDir #2356"] S -->|descriptor| H3["HSDir #8523"]
The real IP address of the onion service is not published.
The directory behaves like a DHT-like distributed hash ring.
For each time period (24 hours default):
flowchart TD A[".onion identity key"] --> B["Derive blinded key"] T["Current time period"] --> B B --> D["Descriptor index"] SR["Shared random value "] --> D D --> H["Responsible HSDirs"]
The shared random value is available on the concensus, and changes each 24 hours.
Important idea:
This makes descriptors harder to target permanently and avoids exposing the long-term service identity directly as the directory index.
The onion service first prepares several introduction points.
flowchart LR S["Onion service"] --> G1["Guard"] G1 --> M1["Middle"] M1 --> I1["Intro point 1"] S --> G2["Guard"] G2 --> M2["Middle"] M2 --> I2["Intro point 2"]
Then it:
ESTABLISH_INTRO.The introduction-point circuits remain available to receive connection requests.
.onion to introduction pointsWhen the user enters an onion address:
flowchart TD A["1. Read .onion"] --> B["2. Extract identity key"] B --> C["3. Derive blinded key"] C --> D["4. Find HSDirs"] D --> E["5. Download descriptor"] E --> F["6. Verify descriptor"] F --> G["7. Learn intro points"]
Before contacting the onion service, the client chooses a Tor relay to act as a rendezvous point (RP).
flowchart LR C["Client"] --> G["Guard"] G --> M["Middle"] M --> R["Rendezvous point"]
ESTABLISH_RENDEZVOUS + random rendezvous cookie.cookie => associated with this client circuitThe client chooses one introduction point from the descriptor and builds another Tor circuit to it.
flowchart LR C["Client"] --> CG["Guard"] CG --> CM["Middle"] CM --> I["Intro point"] S["Onion service"] --> SG["Guard"] SG --> SM["Middle"] SM --> I
INTRODUCE1 request containing, in encrypted/authenticated form, the information the service needs to reach the chosen rendezvous point.INTRODUCE2.The introduction point only acts as a mechanism for introduction. It is not used for the final data connection.
After receiving the introduction request, the onion service builds its own Tor circuit to the rendezvous point.
flowchart LR C["Client"] --> CG["Guard C"] CG --> CM["Middle C"] CM --> R["Rendezvous point"] S["Onion service"] --> SG["Guard S"] SG --> SM["Middle S"] SM --> R
RENDEZVOUS1 message containing the rendezvous cookie and handshake information.Once rendezvous succeeds, the introduction point and HSDirs are no longer in the data path.
flowchart LR C["Client"] C --> CG["Client guard"] CG --> CM["Client middle"] CM --> R["Rendezvous point"] R --> SM["Service middle"] SM --> SG["Service guard"] SG --> S["Onion service"]
Application traffic is protected with keys known to the client and onion service, while each side also retains the normal Tor circuit encryption on its half of the path.
The rendezvous point forwards Tor relay cells between the two circuits but does not terminate the end-to-end onion-service encryption.
sequenceDiagram participant S as Service participant I as Intro Point participant H as HSDir participant C as Client participant R as Rendezvous S->>I: ESTABLISH_INTRO S->>H: Publish descriptor C->>H: Fetch descriptor H-->>C: Intro points + keys C->>R: ESTABLISH_RENDEZVOUS R-->>C: RENDEZVOUS_ESTABLISHED C->>I: INTRODUCE1(RP, cookie) I->>S: INTRODUCE2 I-->>C: INTRODUCE_ACK S->>R: RENDEZVOUS1(cookie) R-->>C: RENDEZVOUS2 Note over C,S: End-to-end traffic flows via RP
Core idea: the .onion address identifies the service cryptographically, HSDirs tell the client how to introduce itself, and the rendezvous point connects two anonymous Tor circuits without learning either endpointβs real address.
.onion address.torsocks to route an applicationβs traffic through the Tor network, for example when connecting to a friendβs laptop.In computer networking, promiscuous mode is a mode for a wired network interface controller (NIC) or wireless network interface controller (WNIC) that causes the controller to pass all traffic it receives to the central processing unit (CPU) rather than passing only the frames that the controller is specifically programmed to receive. This mode is normally used for packet sniffing that takes place on a router or on a computer connected to a wired network or one being part of a wireless LAN. Interfaces are placed into promiscuous mode by software bridges often used with hardware virtualization.
See: https://en.wikipedia.org/wiki/Promiscuous_mode
https://wireless.docs.kernel.org/en/latest/en/users/documentation/modes.html
See: https://www.slideshare.net/slideshow/wps-pixie-dust-attack/64285203?nway-=

Cybersecurity - π Home