Re: Who's paying the piper?
Actually, there isn't really such a master database.
AIUI, there are five registries which tie blocks of IP addresses to organisations via AS numbers. An AS is an Autonomous System - put simply, consider it a bubble within which the owner can do their own thing routing wise, and with one or more points where it connects to "other systems". And there are a lot of these ASs. Now you could argue that these five registries could be your central points of control, but in practice I suspect that if one of them were subverted in such a way, there could be moves to replace it with something not subverted - though there are technical issues there in terms of keeping everything in sync so you don't get two organisations claiming the same IP block. But they do not have the power to prevent a route being advertised anyway.
Each AS advertises the IPs within it using a routing protocol called BGP4 (Border Gateway Protocol) - so each of its neighbours knows about those IPs. All the routers running the internet exchange information via BGP, so those IPs in an AS will eventually find their way into each router - even if it's 10 or 20 hops away. Yes, it is a MASSIVE table.
But, there is a problem here in that BGP relies on honesty - each router is expected to be honest about what routes it knows. This does break down from time to time - sometimes accidentally, sometimes maliciously.
There was a case some years ago where some small ISP somewhere accidentally published a route that sent all internet traffic through it. Needless to say, they couldn't handle the traffic so it ended up going in the bit bucket and the internet started to disappear (a bit like Wesley Crusher's accidental warp bubble making the universe disappear for those within it). And as mentioned above, when a change is made, it doesn't replicate to the entire internet instantly, so when they fixed it, it was still a few hours before everything got back to normal.
And there have been cases where "unusual" routes appeared - sending certain traffic via countries with questionable motives.
A third misuse I've read about involves criminals finding unused blocks of addresses, temporarily claiming them via BGP - and then using their "clean" reputation to make it easier to send spam.
I've not been following development, but I believe there have been efforts to add some security to BGP - but I think that's difficult given that for every AS to know about every other AS, it has no choice but to accept routing information from it's direct neighbours which will include information about routes many hops away.