You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/generic-methodologies-and-resources/pentesting-network/glbp-and-hsrp-attacks.md
+40-5Lines changed: 40 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,8 @@ FHRP is designed to provide network robustness by merging multiple routers into
13
13
14
14
Cisco's creation, GLBP, functions on the TCP/IP stack, utilizing UDP on port 3222 for communication. Routers in a GLBP group exchange "hello" packets at 3-second intervals. If a router fails to send these packets for 10 seconds, it is presumed to be offline. However, these timers are not fixed and can be modified.
15
15
16
+
GLBP for IPv6 uses multicast **FF02::66** over UDP/3222, and the virtual MAC format becomes `0007.b4xx.xxyy` (AVF ID is in the last byte). Timing and attack surface remain the same as in IPv4, so hijack techniques still work in dual‑stack networks.
17
+
16
18
### GLBP Operations and Load Distribution
17
19
18
20
GLBP stands out by enabling load distribution across routers using a single virtual IP coupled with multiple virtual MAC addresses. In a GLBP group, every router is involved in packet forwarding. Unlike HSRP/VRRP, GLBP offers genuine load balancing through several mechanisms:
@@ -35,6 +37,20 @@ For interactions, GLBP employs the reserved multicast address 224.0.0.102 and UD
35
37
36
38
An attacker can become the primary router by sending a GLBP packet with the highest priority value (255). This can lead to DoS or MITM attacks, allowing traffic interception or redirection.
Craft the payload bytes to mimic the GLBP header (version/opcode/priority/weight/VRID). Looping the frame ensures you win the AVG election if authentication is absent.
53
+
38
54
### Executing a GLBP Attack with Loki
39
55
40
56
[Loki](https://github.com/raizo62/loki_on_kali) can perform a GLBP attack by injecting a packet with priority and weight set to 255. Pre-attack steps involve gathering information like the virtual IP address, authentication presence, and router priority values using tools like Wireshark.
@@ -75,6 +91,8 @@ Monitoring and intercepting traffic can be done using net-creds.py or similar to
75
91
76
92
HSRP is a Cisco proprietary protocol designed for network gateway redundancy. It allows the configuration of multiple physical routers into a single logical unit with a shared IP address. This logical unit is managed by a primary router responsible for directing traffic. Unlike GLBP, which uses metrics like priority and weight for load balancing, HSRP relies on a single active router for traffic management.
77
93
94
+
HSRPv1 uses multicast **224.0.0.2** and virtual MAC `0000.0c07.acXX`; HSRPv2 and HSRPv2 for IPv6 use **224.0.0.102 / FF02::66** and virtual MAC `0000.0c9f.fXXX`. UDP destination port is **1985** for IPv4 and **2029** for IPv6.
95
+
78
96
#### Roles and Terminology in HSRP
79
97
80
98
-**HSRP Active Router**: The device acting as the gateway, managing traffic flow.
@@ -91,6 +109,26 @@ HSRP comes in two versions, HSRPv1 and HSRPv2, differing mainly in group capacit
91
109
92
110
HSRP attacks involve forcibly taking over the Active Router's role by injecting a maximum priority value. This can lead to a Man-In-The-Middle (MITM) attack. Essential pre-attack steps include gathering data about the HSRP setup, which can be done using Wireshark for traffic analysis.
b"\x00\x02\xff\x03\x00\x00\x00\x01"# Hello, priority 255, group 1
120
+
)
121
+
send(pkt, iface="eth0", inter=1, loop=1)
122
+
```
123
+
124
+
If authentication is **not** configured, continuously sending hellos with higher priority forces peers into *Speak*/*Listen* states and lets you become *Active*, redirecting traffic through your host.
125
+
126
+
**HSRP authentication corner cases**
127
+
128
+
- Legacy plain-text auth is trivially spoofable.
129
+
- MD5 authentication only covers the HSRP payload; crafted packets can still rate-limit/DoS control planes. NX-OS releases previously allowed DoS against authenticated groups (see Cisco advisory CSCup11309).
130
+
- On many ISP / VPS shared VLANs, HSRPv1 multicasts are visible to tenants; without auth you can join and preempt traffic.
131
+
94
132
#### Steps for Bypassing HSRP Authentication
95
133
96
134
1. Save the network traffic containing HSRP data as a .pcap file.
@@ -135,9 +173,6 @@ Executing these steps places the attacker in a position to intercept and manipul
If a container is started with `--uts=host`, it joins the host UTS namespace instead of getting an isolated one. With capabilities such as `--cap-add SYS_ADMIN`, code in the container can change the host hostname/NIS name via `sethostname()`/`setdomainname()`:
81
+
82
+
```bash
83
+
docker run --rm -it --uts=host --cap-add SYS_ADMIN alpine sh -c "hostname hacked-host && exec sh"
84
+
# Hostname on the host will immediately change to "hacked-host"
85
+
```
79
86
87
+
Changing the host name can tamper with logs/alerts, confuse cluster discovery or break TLS/SSH configs that pin the hostname.
In cases where after decompiling the APK it's possible to see the unknown/assemblies/ folder with the `.dll` files inside it, so it's posible to use [**dnSpy**](https://github.com/dnSpy/dnSpy) directly over the `.dlls` to analyze them.\
38
-
However, sometimes, it's found the `assemblies.blob` and `assemblies.manifest` files inside the unknown/assemblies/ folder. The tool [pyxamstore](https://github.com/jakev/pyxamstore) can be used for unpacking the `assemblies.blob` file in Xamarin apps, allowing access to the .NET assemblies for further analysis:
37
+
In cases where after decompiling the APK it's possible to see the unknown/assemblies/ folder with the `.dll` files inside it, it's possible to use [**dnSpy**](https://github.com/dnSpy/dnSpy) directly over the `.dlls` to analyze them. However, sometimes the `assemblies.blob` and `assemblies.manifest` files are inside the unknown/assemblies/ folder. The tool [pyxamstore](https://github.com/jakev/pyxamstore) can unpack the `assemblies.blob` file in Xamarin apps, allowing access to the .NET assemblies for further analysis:
Some recent Xamarin/MAUI builds store compressed assemblies using the **XALZ** format inside `/assemblies.blob` or `/resources/assemblies`. You can quickly decompress them with the [xamarout](https://pypi.org/project/xamarout/) library:
xa = xalz.XamarinCompressedAssembly(os.path.join(root, f))
54
+
xa.write("decompressed/"+ f)
42
55
```
43
56
44
57
iOS dll files are readily accessible for decompilation, revealing significant portions of the application code, which often shares a common base across different platforms.
45
58
59
+
> **AOT on iOS**: managed IL is compiled into native `*.aotdata.*` files. Patching the DLL alone will not change logic; you need to hook native stubs (e.g., with Frida) because the IL bodies are empty placeholders.
60
+
46
61
### Static Analysis
47
62
48
-
Once the `.dll`s are obtained it's possible to analyze the .Net code statically using tools such as [**dnSpy**](https://github.com/dnSpy/dnSpy)**or**[**ILSpy**](https://github.com/icsharpcode/ILSpy)**t**hat will allow to modify the code of the app. This can be super useful to tamper the application to bypass protections for example.\
63
+
Once the `.dll`s are obtained it's possible to analyze the .Net code statically using tools such as [**dnSpy**](https://github.com/dnSpy/dnSpy)or[**ILSpy**](https://github.com/icsharpcode/ILSpy)that will allow modifying the code of the app. This can be super useful to tamper the application to bypass protections for example.\
49
64
Note that after modifying the app you will need to pack it back again and sign it again.
50
65
66
+
> dnSpy is archived; maintained forks like **dnSpyEx** keep working with .NET 8/MAUI assemblies and preserve debug symbols when re-saving.
67
+
51
68
### Dynamic Analysis
52
69
53
70
Dynamic analysis involves checking for SSL pinning and using tools like [Fridax](https://github.com/NorthwaveSecurity/fridax) for runtime modifications of the .NET binary in Xamarin apps. Frida scripts are available to bypass root detection or SSL pinning, enhancing analysis capabilities.
@@ -58,17 +75,36 @@ Other interesting Frida scripts:
Updated **Frida-xamarin-unpin** (Mono >=6) hooks `System.Net.Http.HttpClient.SendAsync` and swaps the handler to a permissive one, so it still works even when pinning is implemented in custom handlers. Run it after the app starts:
The tool [Uber APK Signer](https://github.com/patrickfav/uber-apk-signer) simplifies signing multiple APKs with the same key, and can be used to resign an app after changes have been performed to it.
0 commit comments