r/programming • • May 21 '16

Reverse Engineering a Mysterious UDP Stream in My Hotel

http://wiki.gkbrk.com/Hotel_Music.html
7.1k Upvotes

349 comments sorted by

319

u/c0cky_ May 21 '16

I wish the audio file was uploaded :(

83

u/anza_power May 21 '16

Would've been a more exciting reveal than just telling us what it was.

17

u/razazah May 22 '16

Would've been a great rick roll

62

u/Oceanswave May 21 '16

Yep, me too, just a sample.

→ More replies (3)

46

u/Xodet May 21 '16

https://www.youtube.com/watch?v=jj0ChLVTpaA

Better than nothing ¯_(ツ)_/¯

42

u/[deleted] May 21 '16

21

u/DaemonXI May 21 '16

There was a segment of This American Life dedicated to this music.

10

u/philipwhiuk May 21 '16

That explains why I've heard that track so much then.

10

u/zacketysack May 21 '16

I like this one that I heard in a game: https://www.youtube.com/watch?v=cw11meDvtLw

6

u/TRUMPOTUS May 21 '16

Goddammit I'm sitting here listing to fucking elevator music. What is my life....

7

u/jesse_dev May 21 '16

it's a popular trend actually. welcome to /r/vaporwave :)

2

u/takua108 May 22 '16

How can we be discussing video game elevator music without bringing up this? https://www.youtube.com/watch?v=9xMWvzDLl5c

8

u/HighRelevancy May 21 '16

Jesus christ that's horrible

7

u/AntiProtonBoy May 21 '16 edited May 21 '16

Challenge: How long can you endure listening to this?

Log your time here.

edit: 2:32

6

u/[deleted] May 21 '16

36:27

I need something better to do with my damn life...

2

u/Is_This_Democracy_ May 21 '16

This is like some super shitty take on AoM music.

2

u/mszegedy May 21 '16

Huh. It could be music for some video game. Reminds me of DKC's music

2

u/1RedOne May 22 '16

Knew what it was going to be before I opened it. Best hold music ever.

→ More replies (2)

1

u/Mteigers May 22 '16

I'm pretty sure that music is used all over in the TV show Better Off Ted.

1

u/invalidusernamelol May 22 '16

Is that the music from Better Off Ted?

1

u/[deleted] May 21 '16

1

u/PM_ME_NSFWS Jul 17 '16

How to make that kind of text? what is it called?

1.1k

u/Ecio78 May 21 '16

Now the next step would be: is there a way to block the originalaudio stream and broadcast something else, like for example satanic verses, Hitler's speeches or maybe just plain simple death metal music?

567

u/cowens May 21 '16

It is UDP and unencrypted, so flooding the network with your own UDP packets could work.

510

u/caskey May 21 '16

Unfortunately without suppression of the original, they would (at best) stutter between the two streams, and at worst desync. The 8 bytes probably contain a sequence number and a stream id.

The interesting vector (to me) would be finding an exploit in the playback devices via the mp3 decoder. The fact that the guest network and at least part of the hotel infrastructure network aren't segregated is the major wtf.

125

u/scrottie May 21 '16

This is a fun way to find out the implementation details of the receiver. If there's a sequence field, it may use the last packet received with the right sequence for any given timeslot/fraction of a second. Or perhaps if sequence numbers are used, it discards duplicate packets with the same sequence. That makes the problem one of either transmitting data with the correct sequence immediately before or immediately after the elevator music.

If it buffers packets without a sequence, the buffer likely has a fixed size and any excess packets get discarded. Then the problem can mostly be solved by transmitting the death metal much more quickly than the elevator music. If sent 100 times faster, then the death metal would keep the buffer full most of the time, and only about 1:100 elevator music packets would slip in. That would stutter and sound like garbage after the buffer filled, but if the buffer size could be computed, then the buffer could be filled all at once in a big burst, allowed to drain (with some elevator music slipping in), then filled again, and repeat.

13

u/Firewolf420 May 21 '16

Perhaps we could find some way to get the original broadcaster to sign off

2

u/xmsxms May 22 '16

This can be protected against by having a shared key with hashed sequence numbers. Essentially an "encrypted" rolling code, similar to what garage door and car remotes use.

0

u/[deleted] May 21 '16

[deleted]

54

u/hungry4pie May 21 '16

Or just corrupt the audio stream. Because really, that's all dubstep is.

67

u/MC_Mooch May 21 '16

Dubstep is just fucked up elevator music

-/u/hungry4pie

→ More replies (7)

34

u/superPwnzorMegaMan May 21 '16

the hotel infrastructure network aren't segregated is the major wtf.

You're expecting to much from a hotel. Its hardly mission critical for them to have random people hack their elevator music.

15

u/dipique May 22 '16

It's not even preferable!

6

u/caskey May 22 '16

The implication is that they might not have a segregated network at all for front office, customer database/erp, premium services, checkout, etc. That's the fail.

In fact it was demonstrated last August at either BSidesLV or defcon (went to both forgot which had the talk) that the attacker was able to stream premium content without paying, change automatic lobby displays, and initiate automated checkout of people in other rooms all from the guest entertainment network.

N.b., this poc was at a major property, not a tiny random hotel.

56

u/kyle_n May 21 '16

They could have been on separate subnets, with that UDP stream routed through to the "guest" network. There wasn't enough data to know that in his write up.

47

u/trogdor3222 May 21 '16

Perhaps, but routing multicast traffic across networks is actually not so straightforward. I've seen a lot of IT infrastructure teams struggle to get this right. You need slightly more intelligent networking equipment in order to forward along the IGMP subscription requests (and the subsequent traffic back to whoever requested it)....or everybody just needs to be within the same broadcast domain.

117

u/peppaz May 21 '16

I put whiteout on a bee once.

It died.

21

u/Googie2149 May 21 '16

I don't know how this was relevant, but thanks for the laugh I guess

→ More replies (9)
→ More replies (5)
→ More replies (2)

32

u/sesstreets May 21 '16

Who knows what else you could find with a simple net scan

47

u/boomerxl May 21 '16

Wasn't there an article published not too long ago where the writer easily gained access to other room's smart lighting systems when he discovered the last byte of the IP address was the room number?

43

u/OutWeRoll May 21 '16

This is the article I believe he was referring to if anyone is curious:

https://mjg59.dreamwidth.org/40505.html

→ More replies (1)

7

u/[deleted] May 21 '16

If the packets have a sequence number and the clients reorder the packets before playing them, then you could try filling their reordering buffer ahead. Unless the client overwrites the buffer when new packets come along, it would start throwing away the original ones and only play yours.

10

u/princessvaginaalpha May 21 '16

sequence number

Im a newbie, but I just learned from a Lemmle book that UDP does not do any sequencing. Am I on the wrong line of thought?

84

u/kiskae May 21 '16

Just because UDP doesn't do sequencing doesnt mean that some protocol using UDP doesn't implement it. Its important in cases where you only want to listen for new messages (only accept messages with a higher sequence id), not old messages that might be delayed.

→ More replies (3)

26

u/[deleted] May 21 '16

Right, but that doesn't mean that the data in the packets can't have a sequence number. UDP streaming often uses that along with a "jitter buffer" on the client that reorders the packets in the correct order within a certain time frame.

6

u/princessvaginaalpha May 21 '16

My knowledge is shallow. i will continue learning. thanks for the pointers.

24

u/[deleted] May 21 '16

Just a tip, networking is far easier to understand in practice than in theory. Try learning a framework like Twisted to experiment with your own protocols and suddenly all that theory in those 500-page textbooks will make much more sense!

→ More replies (8)
→ More replies (3)

11

u/snarkyxanf May 21 '16

People have already mentioned that sequencing can be added at the application layer. I wanted to comment about why.

Sequencing, repeat request for lost packets, dealing with congestion and timeouts, all those details are hard to program correctly.

One incredibly common case is that all the bytes in a sequence are needed in a defined order to be processed. Therefore TCP provides a standard, optimized, widely available method for that. Networks can tune the performance of TCP to help any applications using it.

However, if you have a situation where not all the bytes are needed, or the ordering of them is not essential...what restrictions you have could be nearly anything. Obviously you need some of the data, and the bytes can't be arbitrarily shuffled, but how much mixing and loss, and what to do about it depends a lot on the application.

Maybe you only need a certain fraction, maybe you can process out of order, interpolate, or skip some. For example, an audio stream needs most of the data in order, but can skip small chunks in silence, while phone SMS messages can show up in any order, but half a message, or a single message Yoda speech order in good is not. So UDP exists as a way for applications to use the IP network stack while taking on the burden of dealing with customized requirements.

5

u/boran_blok May 21 '16

You are correct. But that just means it is up to the sender and receiver to implement it themselves.

2

u/Nick0h May 21 '16

My theory is that those elevator guys came in with a shitty music steaming box and said: "hey dudes we need a wifi key and you need to install this simple music streaming box into your rack (it's only 8 RU) and put it in the data vlan, it's that simple [mainly because that's how we sold the solution in our tender]." Anyway, they did that because they were just general networking monkeys and realised it didn't work because multicast is disabled on the internal network by default. The network team spend 10+ hours trying to make it work before the only guy that knows anything about networking comes back from leave (Jeff, he went to Mykonos for 9 days). He points out this observation.. The networking team start to configure multicast and igmp snooping when Jeff says no you nitwits leave it off and put it on the guest network, because I went through this process 3 years ago on that guest SSID when that fuckwit brought his Apple TV into suite 5 and demanded we fix it....fuck that guy...

→ More replies (1)
→ More replies (18)

4

u/Ecio78 May 21 '16

I think so, just wondering what would happen with the overlap of the original stream.. Probably you'll need to try to kill the original source.. Or maybe not, if the player reproduces both streams in parallel, or overlapping, it would be even nicer :)

0

u/[deleted] May 21 '16

[deleted]

→ More replies (3)

80

u/scrottie May 21 '16

My immediate first thought, too.

Brainstorming here, you can't interrupt a UDP packet stream like you can a TCP with injected RSTs or anticipating the sequence number of the next packet and getting yours their first (making the real one get rejected as being redundant), but you may be able to wait until the elevator music host tries to renew the DHCP lease and racing the DHCP server to assign it an IP in a different subnet that's useless for broadcasting on that subnet.

If you can't take the elevator music machine off of the network, the audio devices at the end of the connections likely employ simple buffers that discard packets when overfilled. Sending 1000 deathmetal packets (all the same, for that fraction of a second) per 1 elevator music packet would likely mean that only one in a thousand time slices would be the elevator music instead of deathmetal. I strongly suspect that this would work great.

Theoretically, you could modify the ethernet adapter's firmware to instead of taking the broadcast of the pre-amble and MAC of the elevator music machine to mean that it shouldn't talk to instead mean that it should talk, and DoS the transmission at the wire level, but that would be more involved than the author probably has time for during their hotel stay. When UDP packets go missing, there's no automatic transmit, so they're just gone.

29

u/TK-427 May 21 '16

You might be able to knock it offline with a ping flood or some other target DOS attack. A good network scan would go a long way here, possibly revealing more interesting targets since seeing multicast traffic indicates the guest network is not DMZd.

51

u/TangerineX May 21 '16

I can't believe you guys are spending this much time trying to DDOS elevator music

36

u/[deleted] May 22 '16

Never let utility or a cost/benefit analysis of your free time get in the way of solving a fun puzzle.

15

u/Askee123 May 21 '16

Tl;dr: Silicon valley's dick joke

4

u/matholio May 21 '16

Would be interesting to learn more about the transmitting device. I wonder if it's an appliance or a Application running on a server. Admin port, SNMP etc.

1

u/StrmSrfr May 22 '16

The receiver probably takes either the first packet received with a given sequence number or the last. Either way, it would probably be simple enough to time it so that your packet is the winner.

16

u/[deleted] May 21 '16

This would change "it's just elevator music" to "I can make the elevators pray to satan!"

1

u/spookyttws May 21 '16

Or just "Tenacious D".

3

u/Baublehead May 21 '16

I'd go for episodes of Caillou.

1

u/kryptoparty May 22 '16

Strange to compare metal with Hitler's speeches.

1

u/Ecio78 May 22 '16

It's just because I think they could irritate some people, I am not comparing them \m/

→ More replies (1)

89

u/Buckwheat469 May 21 '16

What you probably found out was that the audio systems in each floor might run Linux and the UDP stream is from a pulseaudio server.

Here's a hint that pulseaudio might be the server. While the link is a bug report, it could be that the hotel is using it as a feature.

17

u/CalcProgrammer1 May 21 '16

I set up a pulseaudio stream once and found that it basically DDOSed my VPN connection. I have a bridged OpenVPN hosted by my router and it is only 10Mbps, it ran awfully slow for some reason and it took forever to determine that Pulseaudio streaming to another PC on the same switch in my basement was the cause.

15

u/6C6F6C636174 May 21 '16

What the hell??? Checking my systems now. Been having weird wi-fi issues for months and haven't found an explanation yet.

1

u/willrandship May 22 '16

Network-crippling bug? Low priority.

One more entry to add to my list of things I hate about pulseaudio.

299

u/lucasvb May 21 '16

Guy got fooled. They're clearly hiding a NES ROM distribution system over the hotel masking it as generic elevator music.

He could've been playing some sweet NES classics now instead of listening to elevator music.

41

u/dwmfives May 21 '16

It's actually an Intelligence programmed called "Monkey Grinder." Using always on listening devices in modern phones, agencies can build data on people by associating unique patterns undetectable by human ear with cell phones, tracking location even with location turned off and a weak tower signal.

28

u/monocasa May 21 '16

You joke, but given the technology behind Shazaam et al. that's probably within the realms of doable for an ultra authoritarian state actor.

37

u/dwmfives May 21 '16

Oh I'm not joking, do some googling. Facebook has openly admitted to listening to always on mics.

28

u/rydan May 21 '16

They also store everything you didn't submit on Facebook. Like if you start typing a reply to someone then stop without submitting it, that just got logged.

22

u/G00dCopBadCop May 21 '16

And if you "delete" something (even from years ago that was a private note to yourself) it never goes away. You're simply hiding it from yourself. I haven't trusted Facebook in a long time.

Another story, I used to have the FB messenger app and every time I opened it, it asked me if I wanted to add all the contacts in my phone. Of course I told it no every single time but it continued to ask me, until one day my contacts just showed up in the app so I deleted the messenger app and the Facebook app itself.

Mark Fuckburger. I want my data back.

9

u/Mutoid May 22 '16

I want my data back.

I'm sure they'll send you a copy of their file on you if you ask nicely.

→ More replies (2)
→ More replies (7)
→ More replies (1)

6

u/TheSecretExit May 22 '16

Hidden in each packet is frame input for the ROMs they're sending. Not only can he play classic Nintendo titles, he can also watch people in other rooms do their playthroughs.

150

u/panorambo May 21 '16 edited May 22 '16

I don't know much about hotels, and I always looked down upon the way they install and maintain their Wi-Fi access points, for better or worse, but the idea that they multicast their elevator music to their elevator(s) -- I find it interesting and a good application of UDP [multicast]. Then again, they probably use some off-the-shelf equipment like "Elevator Music Box 1" which can be set up by a climbing baby, so who knows.

96

u/caskey May 21 '16

Also elevator already has power but not hardwired for network (moving and all that). Easier to retrofit an aftermarket wireless device to the cars.

27

u/netburnr2 May 21 '16

i find it hard to believe that elevators aren't often networked especially ones with cameras and card readers

31

u/caskey May 21 '16

I'm not saying they have no wiring, but a hoistway constructed in the 80's likely only has the circuits needed for the stuff that was needed then. Modern elevators use CAN bus like in cars and that wouldn't be suited to audio transport either.

Anything's possible. Elevators are now part of the internet of things, as scary as that sounds.

13

u/b1ackcat May 21 '16

You can definitely transmit audio over CAN. It would be a really shitty thing to have to implement, but you could get it done.

13

u/caskey May 21 '16

wouldn't be suited

Does not mean impossible.

→ More replies (1)

8

u/[deleted] May 21 '16

To begin with, why can't the elevator music be stored and played locally?

0

u/[deleted] May 21 '16

[deleted]

→ More replies (2)

6

u/CalcProgrammer1 May 21 '16

The CAN systems we use at work run at 1Mbps and the highest bitrate mp3 is 320Kbps. You could definitely run an mp3 stream over CAN but it would eat a significant amount of your bandwidth. Also CAN has a lot of overhead because each frame only has room for 8 data bytes and the frame itself is fairly large, so you may not get 320Kbps easily but 128Kbps should be doable I'm sure with room to spare.

→ More replies (1)

3

u/adrianmonk May 21 '16

Not to mention emergency telephones.

However, it might still be cheaper to retrofit wifi if the elevator is already installed and working.

14

u/KarbonKitty May 21 '16

Elevators are actually pretty good Faraday cages, so setting up wireless receivers in them probably wouldn't be the best idea though. :)

34

u/TheWheez May 21 '16

Just put it on top then, would that work?

28

u/[deleted] May 21 '16

If anything it's one of the best places for line of sight networking in the whole building. An antenna pointing straight up the shaft is going to struggle to miss its receiver.

9

u/111poiss111 May 21 '16

Why antenna, if you could use LASERS

8

u/viroverix May 21 '16

Can't, phase shift when the elevator is moving.

→ More replies (2)
→ More replies (4)
→ More replies (1)

4

u/KarbonKitty May 21 '16

I guess so. I mean, that is obviously a solved problem, since it has been done time and again; it's just that I've been bitten by losing the cell signal a few times when entering the elevator, and this came to my mind. :) Anyway, if I'm not mistaken, the article says that the music has been playing in the corridors near the elevators, and not in the cars themselves?

2

u/argv_minus_one May 21 '16

Not that good. I still get a cell signal inside my apartment building elevator.

2

u/KarbonKitty May 21 '16

Perhaps it depends on the elevator in question; I've seen quite a few, but only tested one type in that regard. :)

3

u/mercurysquad May 21 '16

Why do you assume that the elevators aren't hardwired – because the guy captured the traffic over WiFi?

2

u/[deleted] May 22 '16

How could they be hard wired? They're moving all the time.

7

u/Captain_Cowboy May 22 '16

How do you suppose the lights inside an elevator work?

→ More replies (1)

1

u/Paradox May 22 '16

A lot of elevators are hardwired for network. They just replaced the old phone line (for the call box) with an ethernet cable, and stuff a voip phone in it.

15

u/[deleted] May 21 '16

My guess is that it was done because the elevators are constantly moving between routers, by mutlicasting across all access points to all devices, you don't have to worry about ip addressing. My guess, is that its not even issuing an IP to the elevator, but just having it listen on the frequency and playing what it takes in. As long as the elevators aren't issuing any commands, and the routers are following standard protocols, it wouldn't be violating and FCC rules. Plus having it run UDP like that means that you have a fraction of the network traffic associated with TCP. Its a bastardization of WIFI protocols, but it works.

I reread my message and it looks like I was advocating this. This is a terrible idea, and its what happens when people try to get clever, with no regard for future stability. I'm just going through my idea of what their justification might be.

14

u/[deleted] May 21 '16

[removed] — view removed comment

2

u/Ace417 May 22 '16

You assume the person doing the job had a set schedule to make it work right and not "make this work now! Ok it works. Don't touch it" kind of schedule.

Or they might not have a clue and just left it alone once it was working

1

u/1RedOne May 22 '16

I'd love to know more about how they setup their access points, why you dislike it, and how you think it ought to be done.

2

u/panorambo May 22 '16

They use consumer grade hardware, which has been proven time and again to not give any soft guarantees for service -- i.e. how many clients it can reliably route for, which for a hotel would pretty often be in the hundreds. The consumer grade plastic is a security hole ridden cheap-o product that can barely route 10 clients reliably and do not even get me started on UDP traffic (which is good for Skype) and also that they spoof your HTTP traffic and do funny things with HTTPS traffic as well. Like using session cookies to keep tracking you after you login with a Web page, instead of a goddamn industry standard. Frankly, there are few things I detest more than Web-based Wi-Fi authentication. When your browser re-caches pages you already had in cache as "You need to login to use our Hotel Wi-Fi".

So, enough critique -- how about a suggestion? So, get a Ubiquiti Networks product instead, which is maybe three times more expensive but gets you back on happy customers and saves you days of maintenance work annually, or get a Cisco in the worst case (they may be unreliable as well, and have security holes, although they are in another class than consumer grade stuff). Don't use Web-authentication, instead opt for a time-limited password which, if you really feel generous, can be printed on the receipt. Don't shape traffic -- nobody likes that. Throttle -- yes, that's necessary, shaping -- no. That's all. Even a small hotel with 20 rooms can buy the cheaper Ubiquiti product and they will become a legend on that point alone.

P.S. I thought the elevator music UDP multicasting was a good idea, so raising an eyebrow was meant as in "hmm...interesting!" not like "oooh boy".

1

u/TheCodexx May 22 '16

It's almost definitely an off-the-shelf unit, unless it's a major chain, in which case they might have their own vendor, but it still could be a prepackaged solution. Generally you just plug it in, attach it to the network, set up stuff to receive it, and put in some generic muzak CDs that are made for places like hotels or restaurants to play in the background.

1

u/m00nh34d May 22 '16

They just got the cheapest possible option. I don't know why you couldn't install a dedicated wireless router for each room (or perhaps a couple of rooms), backed up by decent bandwidth for each router, sure it sounds kind of expensive on the surface, but compare that to what they're already paying per room, for a TV, a cable box, cable subscription, other (increasingly redundant) electronic devices like PABX telephones, alarm clocks, etc.

Maybe there's a market there for a good hotel IP phone/data infrastructure to replace the existing stuff. Have a central hub in each room, providing IP phone, wireless (and maybe wired) data, TV services, etc.

494

u/[deleted] May 21 '16

Reading this makes me whish i would have payed more attention in my networking course.

174

u/LucaBrasi123 May 21 '16

That's okay, pick up a good networking book and work through it. I suggest Kurose and Ross, quite an interesting read.

37

u/s0n0fagun May 21 '16

I went through the Tannenbaum book. I thought it was pretty good. If you went through that book as well, how do the two compare?

9

u/[deleted] May 21 '16

Modern Operating Systems? It's great, I've gotten through the first 4 chapters and have learned a lot already. But far from an easy read.

15

u/[deleted] May 21 '16

I think it's rather Computer Networks.

→ More replies (1)
→ More replies (1)

7

u/PsionSquared May 21 '16

Kurose and Ross was actually the book we used for our networking class. Never actually picked it up though.

5

u/pvcalculator May 22 '16

Keith Ross was my professor for networking class. He makes learning so simple.

10

u/[deleted] May 21 '16

I second that book. Such a good read.

3

u/St_SiRUS May 22 '16

Studying it this semester, one of the better courses I've had so far

6

u/princessvaginaalpha May 21 '16

Yeah but im still only at ICND1 with lemmle. Going to ICND2 later and we'll see where it goes from there.

52

u/Captain_Sammy May 21 '16

There's also Beej's Guide to Networking. I love his style of writing, and he explains concepts in very simple terms.

1

u/EntityDamage May 21 '16

That's my go-to for gdb reference...Just simple explanation

15

u/gt_ht_jt_kt May 21 '16

This person is a high school student by the way... Insane!

1

u/xmsxms May 22 '16

Cool hwhip.

1

u/notfromkentohio May 21 '16

I can relate to this

→ More replies (6)

30

u/NZOR May 21 '16

Network guy here. A lot of speaker systems like that use multicast. Typically they are used for announcements or emergencies, like when you're at the store and someone says "CLEANUP ON AISLE 3" over the loudspeaker but it plays throughout the entire store.

9

u/danopia May 21 '16

Isn't it a pain to synchronize the playback when you have a lot of individual speakers in the same building?

14

u/[deleted] May 21 '16

Only if they are loud enough and spaced closely together enough will you notice.

Source: listen to colors on any military base, and it's guaranteed that you'll hear an echo. But in most department stores it's not necessary to have that many speakers that loud that close together, so you can usually only hear one at a time.

190

u/[deleted] May 21 '16

Such an anti-climactic ending.

394

u/Nilzor May 21 '16 edited May 21 '16

I kind of liked it. Such a nice break from all the "Omg app X is sending your mother-in-laws' underwear sizes to a chinese data farm - heads must roll"-blogs :) Good to hear that not all use of technology is sinister, yet reverse engineering is still fun!

25

u/[deleted] May 21 '16

Yeah but some hidden bug in one of the suites would have been cooler.

17

u/[deleted] May 21 '16

Door keys have read and write access?

52

u/Shmink_ May 21 '16

I liked it. We don't live in a Hollywood world.

→ More replies (2)

3

u/superherowithnopower May 21 '16

I mean, did we seriously expect it to be something else?

1

u/Antrikshy May 22 '16

I loved it!

44

u/[deleted] May 21 '16

Spoiler in the url

9

u/setuid_w00t May 21 '16

It would have been epic if it had been Rick Astley.

15

u/kaneda26 May 21 '16

So what's up with the mention of the NES ROM images?

26

u/HighRelevancy May 21 '16

file is a tool that looks at the first handful of bytes of a file and compares them to a list of known headers and decides which is most likely. For example, if you get a file that starts with hex FF D8, it's almost definitely a JPEG. Of course, if you generate enough random data or slice files randomly you'll probably find that sequence elsewhere by coincidence.

Same thing here, though I've no idea specifically what inspires a call of "NES ROM".

2

u/Ailure May 21 '16

Same thing here, though I've no idea specifically what inspires a call of "NES ROM".

Probably looks if the file starts with the string NES (or NE if it only checks the first two bytes), iNES ROM header reference.

3

u/ThisIs_MyName May 21 '16

Yep, the first 2 bytes (magic numbers) are saturated with file formats. Pretty much any random number you pick belongs so some obscure format.

1

u/kaneda26 May 21 '16

Ah. Ok. That makes sense. I appreciate it.

3

u/user_82650 May 21 '16

It's an example of why using file contents to determine the type is a bad idea.

2

u/[deleted] May 22 '16

What else would you use? Filename endings?

1

u/_zenith May 23 '16

Well, it's not necessarily bad - just expand the address space. I've sometimes used a simple strategy of hashing an identifier string with sha512. Gives you a pretty good chance it's not random! Particularly if you concatenate two hashes with the second one being derived from the former + some salt.

7

u/boarnoah May 21 '16

Whats the reasoning behind stitching the data together with offsets? i.e how did he come to the conclusion that it would work.

12

u/youstolemyname May 21 '16

Each packet has a header then the audio data starts.

13

u/Dash83 May 21 '16

This makes me want to learn how to use Wireshark. Tried it a few times, but far too much happening, didn't know where to begin to explore the traffic.

15

u/antiquegeek May 21 '16

The wireshark usage in this instance was actually pretty sparse. He just let it run and noticed the UDP on port 2048 was very large and regular. I would very much recommend using wireshark and learning more about it though, with wireshark and nmap you can do a lot of things that you probably couldn't even imagine.

5

u/Dash83 May 21 '16

I know he barely used it, but he noticed SOMETHING with it, and my experience is I get over flooded with info. Any Wireshark tutorials you would recommend?

5

u/antiquegeek May 21 '16

I would just recommend learning about different internet and program protocols. Maybe learn how to tell what ports are interesting and what ports are uninteresting. Learn the difference between encrypted and clear traffic and how to read them into usable formats. You can't really just "learn" Wireshark, you have to have a grasp on the underlying protocols and specifications you are dumping.

2

u/Dash83 May 21 '16

That makes sense. I was hoping for a little practical guide to get me started, but if there's no such thing, I'll brush up the old way.

4

u/PsionSquared May 21 '16

If you're targeting something on the Network, you can use something like Process Hacker to see what ports your programs are using, then eliminate traffic from those. Vice versa, you know which port to target for the program.

→ More replies (1)
→ More replies (2)

1

u/1RedOne May 22 '16

I found Wireshark impossible to understand, but grasped Fiddler almost immediately. A ton of fun, and I've discovered so many unpublished apis that have opened up some fun possibilities.

1

u/Dash83 May 22 '16

Sweet, I'll give it a shot. Thanks!

36

u/flnhst May 21 '16 edited May 21 '16

Sounds like something used for announcements and what not. EDIT: Besides the music, obviously.

24

u/Azuvector May 21 '16

From the article:

What the hell? I can't believe I spent time for this. It's just elevator music. It is played in the hotel corridors around the elevators. Oh well, at least I can listen to it from my room now.

→ More replies (6)

4

u/[deleted] May 22 '16

That's going to be the eventual punchline to the SETI project too.

3

u/amcsi May 21 '16

For a clickbait title, the disappointing conclusion was hilarious!

3

u/Tijai May 22 '16

So happy people like you exist tbh. Keep it up :)

5

u/engineered_academic May 21 '16

A lot of the distributed audio systems nowadays are skipping direct lines to speakers for network jacks distributed throughout the building connecting "zones" of speakers. Really they should be on separate networks or at least vlan'ed out from any public source.

2

u/HaileSelassieII May 21 '16

What a rollercoaster of emotion

2

u/[deleted] May 21 '16

This is amazing... now I want to learn.

2

u/2manygigs May 21 '16

The html file's name spoiled the ending for me :(

2

u/GiantNinja May 21 '16

Looks like someone else here reads hackernews too

→ More replies (2)

6

u/makeswordcloudsagain May 21 '16

Here is a word cloud of every comment in this thread, as of this time: http://i.imgur.com/fqYvsJm.png


[source ^code] [contact ^developer] [request word ^cloud]

3

u/gospelwut May 21 '16

That's really interesting. However, is there a more "automagic" analysis method here? I like Wireshark as much as the next guy, but for HTTP Fiddler is a much better experience (in most cases).

I have to imagine some algos could have caught the patterns the author caught via reading stdout.

3

u/i-get-stabby May 22 '16

Yes, it was probably an rtp stream. Wireshark by default won't recognize rtp unless there are some sdp signaling with it to help it know what it is. You can set in the preferences for the rtp protocol to decode without the signaling. Or you can right click on it and select to decode. There are some rtp analysis tools that can playback the audio if it is pcm but since it is mp3 there is the option to export the payload in wireshark. It then can be imported in to audacity to decode the mp3.

1

u/1RedOne May 22 '16

I don't think a multicast would appear on fiddler. But then again, I only use it to bind to a PowerShell or chrome session for working with APIs, so I'm probably just accustomed to filtering out traffic like this.

1

u/gospelwut May 22 '16

No, no. I mean, a more hand-holdy tool like Fiddler. I'm lazy you see. (i.e. a tool that does all the protocol reverse engineering legwork). Though, another poster indicated wireshark can do this with some decoding enabled.

3

u/Eigthcypher May 21 '16

He could have just pointed vlc at the multicast destination address to play it. Almost all of this was unnecessary to figure out what the stream was...

2

u/i-get-stabby May 21 '16

He could also had selected to decode the steam in wireshark as rtp and they goto telehpony > show all streams > stream analysis and click play

Edit: i just realized it was mp3 . He could gave saved payload as raw and imported into audacity

2

u/16nm May 22 '16

It's nice to know the methodology for decoding unknown streams though.

1

u/yakri May 21 '16

You know, it's weird having gotten to the point where nearly any discussion involving programming makes sense to me, and coming in on one of these networking related discussions and suddenly everything is fucking Klingon again.

1

u/civilframe May 21 '16

This is hilarious! Nice work.

1

u/atrigent May 21 '16

But what do the first 8 bytes mean?

Some other comments:

I wish file had a built-in way to scan for magic numbers. Is there some other tool which can do that?

file is actually slightly misidentifying the mp3 data. ADTS is actually a format that is used for AAC. It has some curious similarities to the older MPEG audio format, which mp3 uses, making them somewhat hard to tell apart. I can't find any discussion of the similarity of these formats.

1

u/Luuk3333 May 21 '16

That's so cool!

1

u/jvoorhis May 22 '16

Be sure to drink your Ovaltine.

1

u/Plop-plop May 22 '16

You are smarter than I.

1

u/NullTheFool May 22 '16

This is some really cool stuff. What kind of network analysis can I do in public locations like coffee shops and libraries that is still legal? Seems like a good source for fun programming projects and a good way to learn about netsec... or get arrested hence my question.

1

u/BourbonAndBlues May 22 '16

I stop by r/programming every now and then to remind myself I know nothing about programming. See you guys in another month or so!

1

u/thexavier May 22 '16

Happy adventures

1

u/BilgeXA May 22 '16

What a waste of packets to send elevator music in stereo.

1

u/Trained_Meatshield May 22 '16

Post the music!

1

u/ign1fy May 22 '16

This sounds like a phone system, in particular, NBX. We have this at my work and it's the hold music causing literally every light on every switch to blink continuously. Our desk phones have network ports on them, so the company (data) network and the phone system are sharing physical switches and cables.

1

u/khendron May 22 '16

At least it didn't say "be sure to drink your Ovaltine"

1

u/riveracct May 22 '16 edited May 22 '16

It started out like /r/programming meets /r/nosleep.

0

u/[deleted] May 21 '16

Basic packet analysis is reverse engineering. This fucking sub.

-3

u/mallardtheduck May 21 '16 edited May 21 '16

saving one packet as test.mp3 failed to played with mplayer and the file utility only identified this as test.mp3: data. There was obviously data in this packet and file should know when it sees MPEG Audio data

Do people not have even a basic understanding of how file formats work these days?

Of course that isn't going to work. File formats need headers to be useful. A random snippet of MP3 data is completely useless without knowing the header which contains such vital information as the bitrate, whether it's mono or stereo, etc. The 'file' utility works by looking for known "signature" bytes in the headers of common file formats, it can't just "know when it sees MPEG Audio data".

The article is good, but this part just made me cringe.

EDIT: Turns out the MPEG family of formats are unconventional in that they don't have headers like this. TIL.

11

u/tonyarkles May 21 '16 edited May 21 '16

MP3 and the MPEG family in general are exceptions to the rule. MP3 files don't strictly have a required header at the start of the file (unless you count ID3).

Instead the file is broken into frames, and each frame has a header. The Wikipedia page (design section) has the data in the header: https://en.m.wikipedia.org/wiki/MP3

Then, there's the frame data, which can be calculated as 144 * sample rate / bit rate. In this case, 144 * 192,000 / 44,100 = 627. That being quite close to the packet size they saw, plus the fact that dumping a single packet and removing the first few bytes resulted in file detecting the MP3 stream properly suggests to me that each packet contained a standalone MP3 frame. http://id3.org/mp3Frame

I agree with you in general. If it had been JPEGs, there's no way this would have worked. But the MPEG family of formats do support exactly what they were up to. If you're curious about video, look up MPEG-TS for the video transport stream. Lots of digital satellite streams are just raw MPEG-TS streams, and you can jump in in the middle of a program and the receiver picks up the stream just fine.

Edit: added a reference to the 144* equation

Edit 2: I looked back at the blog post again and noticed that file had identified the file as an "MPEG ADTS" file. That's a little different but the same concept: http://wiki.multimedia.cx/index.php?title=ADTS

0

u/BumFudhe May 21 '16

This was interesting.

→ More replies (1)