So, its been long and I want to see if I still remember my networking knowledge tbh, and also something just came to mind that what if I can set up a lab network to demonstrate OSPF authentication methods?
OSPF Background: I will not discuss much, but it is one of the widely used open source protocol to run IGP routing. Open Short Path First can be configured to do internal routing. I will not get into the debate of EIGRP Vs OSPF because it never ends.
Very simple, but enough to explore all concepts. R1 and R2 connected over WAN link( that’s right, they are good old serial cables) and one individual network connections on both sides. R1 will advertise networks it knows about and obviously R2 does the same.
Why are we interested in networks and routing protocols? are they really important? what sort of information they can leak? what is the extent of the damage? well, routers do advertise networks, someone who pretends they are a router can join this network and advertise themselves as a router to know all networks getting published by every single OSPF router. That right there will give all internal networks information to attackers. attackers can then determine subnets, and even reduce their scanning footprint by selectively scanning known subnets. worst of all they can advertise better route and proxy, sniff all traffic and steal important information. Well, the million dollar question is how easy is it? if the company network is in the hands of a lazy admin, it will be super easy or else, it’s very tough.
I will list common configuration commands, but will not explain what they are for brevity. feel free to research them. I am also listing configuration commands on R2, and same will follow on R1
R1 and R2 Interface IP configurations:
R2 OSPF configuration:
Plain Text Authentication:
R2 Interface S2/0 configuration for OSPF authentication
R2 OSPF authentication verification
Once all the necessary configurations completed, I brought interfaces up(by default they are down because they are serial), they formed neighbour relationship, this is where we want to capture packets to see the exchange of messages between routers before they exchange routes. Following is exchange packet capture.
Let’s observe Frame 8: R1 is sending OSPF hello packet, if you look the content of hello packet you will see criteria that R2 needs to meet in order to form an adjacent neighbour relationship.
Bingo!!! it is clear that OSPF header packet contains information of Originating router, Area number, Auth type, and Auth data(which is the password we used i.e Secret)
First, I removed the above configuration from Interface s2/0 and made the following changes on both routers.
lets capture packets again and see how it looks.
And let’s look at the first packet to see if there is a change in the way router behaves
Sure enough, packets are getting encrypted but its MD5, MD5 can be cracked very easily.
The Secure Way:
Configure Keychain, and use strongest key length. key chains are handy and provide multiple benefits: separate key for every neighbour, separate cryptographic standards for every neighbour, key rotation, key expiry, key schedule and many more…
Key chain configuration(simple one)
Note: key chain names, and key names do not need to be same in order to form neighbour relationships.
Traffic analysis(packet capture):
finally to check our interface running strongest algorithm we can issue the following command.
Takeaways: OSPF does support multiple authentication methodologies, Clear text, MD5, No authentication, Cryptographic standards(HMAC-SHA-256/284/512) please choose the one which is strong enough and rotate keys so even when an attacker gets hold of key it will be too late since key might have changed already.