[HN Gopher] I hacked SONOS and YouTube the same day
       ___________________________________________________________________
        
       I hacked SONOS and YouTube the same day
        
       Author : lukastyrychtr
       Score  : 162 points
       Date   : 2022-02-03 17:54 UTC (5 hours ago)
        
 (HTM) web link (www.deadf00d.com)
 (TXT) w3m dump (www.deadf00d.com)
        
       | deadf00d wrote:
       | But wait... That's my article ! Thank you guys for reading and
       | sharing. I get so much great returns and kind messages. I'll keep
       | you updated for the app !
        
         | lucas_v wrote:
         | Hmm... Your profile seems to be created about a minute before
         | this comment was posted.
        
           | alex_young wrote:
           | Don't people usually create profiles shortly before they
           | decide to post something for the first time?
        
             | [deleted]
        
             | robbedpeter wrote:
             | Well it's definitely unusual to do it after.
        
           | motoxpro wrote:
           | That's not strange. They saw the article/someone told them it
           | was here, they signed up to say thank you...
        
             | WillPostForFood wrote:
             | _a minute before this comment was posted_
        
               | thatguy0900 wrote:
               | Yeah he should have preemptively made it yesterday to
               | comment on his article being posted by someone else today
        
           | deadf00d wrote:
           | Yeah, this has not been posted by me, but shared by a reader.
        
       | AmazingTurtle wrote:
        
       | makeworld wrote:
       | Interesting. I feel like the code could be simplified and be a
       | lot more resistant to YouTube changes by just using yt-dlp, and
       | selecting (or automatically extracting with ffmpeg) the audio-
       | only AAC format YouTube serves. That would get rid of the YouTube
       | request and MP4 parsing code.
        
         | X-Cubed wrote:
         | I'm not sure it would, as the article seems to say that Sonos
         | requires an ADTS container for the AAC audio, which YouTube
         | doesn't offer. So the app takes an MP4 container, filters its
         | contents to find the AAC audio blocks, then repacks them in an
         | ADTS container.
        
       | polishdude20 wrote:
       | Would the conversion of the MP4 be able to be done using ffmpeg?
        
         | mattmar96 wrote:
         | Yes, even as a stream. The author mentions that a streaming
         | conversion of mp4 to mp3 would be very difficult/impossible. I
         | actually built that exact system for a simple youtube->mp3
         | downloader. FFMpeg can perform a streaming mp4->mp3 conversion.
         | See here:
         | https://github.com/matttt/youtubesampler/blob/master/main.js...
        
       | winternett wrote:
       | Every day I'm frustrated by apps that I know were once highly
       | simple and functional.
       | 
       | The idea that we're paying for devices and apps that are
       | artificially limited and hobbled by others seeking more profit
       | really has me worried about the future.
       | 
       | For example, Winamp ran several years as a music player, although
       | it was not a very profitable operation, it functioned just like
       | every other consumer music player since the 70s, with play, stop,
       | track skipping, fast-forward, shuffle play etc...
       | 
       | Now music players have completely screwed up the model for a
       | music player. They more often don't function properly unless a
       | subscription is paid for.... They insert ads into music
       | playlists, they often skip more than one track, they don't truly
       | shuffle music, and they also add a ton of frustration with
       | buffering and connectivity issues into the simple process of
       | listening to music, even when I play my locally stored collection
       | of music on them.
       | 
       | The practice of reducing features in something as simple as a
       | music player, a device that is meant for enjoyment shows how grim
       | the concept of a software-driven world should be. Products are
       | rarely solving problems now, they are only introducing new and
       | stupid problems, and not innovating further. It's a huge problem
       | that should be addressed.
       | 
       | I'm tired of hobbled functionality, hack the planet. :P
        
         | lpapez wrote:
         | There are literally hundreds of simple (and open-source) music
         | players out there, including Winamp you mentioned and its
         | offspring. What is preventing you from using those? IMO, this
         | is the same argument like when people say "modern music sucks"
         | without ever searching for amazing new bands outside the
         | mainstream.
        
           | BiteCode_dev wrote:
           | Most people don't have the medium.
           | 
           | I have 30Go of music files on my laptop, that I carefull
           | update, and backup. I add to the collection once in a while.
           | 
           | But few do that anymore: no cd player in devices, and file
           | systems are being abstracted away remember?
           | 
           | So they listen to music on youtube, spotify, soundcloud, etc.
           | 
           | They don't own the music, hence they can't chose the player.
        
             | winternett wrote:
             | YouTube music offered to import my personal music library
             | (on my phone). I declined, because the last time I allowed
             | that to happen on Google Play Music (now retired) it was
             | covertly deleting music from my library, and carefully
             | picking which songs to play every time I used it.
             | 
             | You simply can't trust free apps any more. Probably can't
             | even trust many of the paid ones because making people buy
             | the same thing multiple times is more profitable for
             | opportunistic individuals.
             | 
             | Keep backups in multiple (independent) locations.
        
               | BiteCode_dev wrote:
               | Free as in free beer apps no.
               | 
               | But FOSS apps are still there for you.
               | 
               | VLC is to this day the best video players, across all OS,
               | and can read music.
               | 
               | It's as not convenient to play music though.
        
               | screature2 wrote:
               | re:FOSS music players I liked foobar2000 for music, esp.
               | if you wanted to play lossless formats like FLAC files
               | 
               | re:parent comment, i feel like the streaming "free" music
               | app/services are more iterations on radio stations rather
               | than iterations on music players since radio has ads,
               | pseudo random playlists, requirement to be "connected"
               | etc.
               | 
               | Maybe unpopular opinion, but in comparison w/radio, I
               | tend to think streaming actually looks pretty good.
        
           | winternett wrote:
           | Oh I still have (32 bit) Winamp on my desktop, and it works
           | great when I need it so far... The problem is that as Windows
           | creeps towards 64 bit compatibility only, I'll eventually
           | have to retire the original .exe(s) I've used, and change to
           | something that might be a terrible experience.... Even online
           | reviews and advice about what software to use is corrupted by
           | brigadeers and marketers, so it's a wild west of who you can
           | trust. I appreciate your advice, but you could just as well
           | be a developer trying to encourage me to use your app that
           | may have required in-app purchases (no offence).
           | 
           | Another tactic that developers now use is to have a fully
           | functional app in the first-downloaded instance, but then the
           | application slowly degrades as updates occur to encourage an
           | up-sell. As a dev myself, I've directly seen this happen with
           | apps I cannot specifically shame online.
           | 
           | I'm primarily referring to mobile apps. I have an SD card
           | with my music library on it. The choice of apps there gets
           | more complex... As phone makers remove SD card functionality,
           | and headphone jacks, and limit out of the box music players,
           | the ability to use my phone for music is also fading. I have
           | had apps corrupt my locally saved music library as well in
           | attempts to force me into buying streaming services perhaps,
           | I no longer trust many services in app stores.
        
             | bobsmooth wrote:
             | VLC is free and 64-bit. Not the most convenient for playing
             | music but it plays everything. I use MAX Tray Player which
             | is really old but still works. It's this great little
             | program that sits in your taskbar off to the side so it
             | doesn't take up icon or window space. I use it for internet
             | radio and I made a skin for it to match my dark theme.
             | 
             | trayplayer.com
             | 
             | As for mobile audio I use Spotify but I have a library of
             | mp3s on my SD card that I play with the default Samsung
             | Music app which works just fine. No ads in that so far. If
             | you haven't tried a modern BT 5.0 device, try giving
             | bluetooth another chance.
        
             | motoxpro wrote:
             | All of the stuff your talking about could be solved by not
             | upgrading to the latest X. If you want headphone jacks,
             | etc, etc just search for a phone that has it and that lets
             | you add music to it. If you want a 90s experience you don't
             | HAVE to buy the latest iPhone or download the latest app.
        
           | ffhhj wrote:
           | When I moved from Windows 11 to Linux, the first thing I
           | looked for was an audio player as simple, fast, full
           | featured, and with small UI that won't occupy a large portion
           | of the screen. I ended running WACUP with Wine and haven't
           | looked back. The compact and stackable UI of Winamp is still
           | the best after all these years, and it just works.
        
             | wolpoli wrote:
             | That's one thing I missed about programs from years ago -
             | they don't try to take over the entire computer but stay
             | unintrusive as helper/companion.
        
           | RC_ITR wrote:
           | I think GP is confusing 'I went to the store and bought this
           | CD, and burned it to MP3, which plays for free on Winamp'
           | with 'Winamp was free and now I have to pay for that same
           | experience via streaming.''
        
             | omgitsabird wrote:
             | With the right attitude, you can rip from streams and play
             | it for free from Winamp. You can also buy a lot of music as
             | an MP3.
        
         | tehwebguy wrote:
         | You can pick up this bluetooth board for $0.79 + $1.67 shipping
         | to the US and solder it inside of your favorite dumb speakers:
         | https://www.aliexpress.com/item/4000437975620.html
         | 
         | [The red one for sale at the moment doesn't make any sounds
         | when you connect to it, the $0.79 black unit speaks ("now in
         | bluetooth mode") when I connect to it, not great]
        
           | jethro_tell wrote:
           | Bluetooth doesn't really cut it for me in a multi-person
           | household, though If I was on my own I would be fine like
           | that.
           | 
           | We have multiple people constantly playing, and multiple
           | locations to play to. Bluetooth is good for a single speaker
           | and single primary playing device but doesn't really solve
           | multi-room multi-user music very well.
        
         | nexuist wrote:
         | > They insert ads into music playlists, they often skip more
         | than one track, they don't truly shuffle music, and they also
         | add a ton of frustration with buffering and connectivity issues
         | into the simple process of listening to music
         | 
         | Why are you comparing music players to streaming services?
         | That's like comparing a Honda Civic to a cement mixer. You
         | don't use both to accomplish the same job even if they both
         | have four wheels and a gas pedal.
        
           | winternett wrote:
           | Streaming services leverage playlists, and they insert ads
           | into those playlists.
           | 
           | Streaming services like Spotify, are music players by nature
           | obviously...
        
             | jethro_tell wrote:
             | if you pay for spotify, there are no ads, just like if you
             | paid for your music and a music player there would be no
             | ads.
             | 
             | And before you tell me you got your music and player on the
             | high seas, you can still do that so I don't see how
             | anything has changed.
        
             | filoleg wrote:
             | You are just being pedantic, while the parent comment
             | offered a fairly useful distinction between those two types
             | of services, even though it might not be the dictionary
             | definition.
             | 
             | >Streaming services like Spotify, are music players by
             | nature obviously...
             | 
             | Both a cement mixer and a honda civic are vehicles that one
             | can drive on the road by nature. The point still stands
             | that they shouldn't be compared directly, as they serve
             | completely different purposes (despite them both being
             | drivable vehicles).
        
         | folkrav wrote:
         | Music players were decoding local files and spitting out the
         | output, now they're streaming platforms. Despite fitting the
         | same niche of "I want to listen to music" for many people,
         | they're not selling you the same product at all.
         | 
         | AFAIK the local players still exist, many still in active
         | development, for those who want to own their data.
        
         | bluescrn wrote:
         | Sonos built a great system then destroyed it with greed/planned
         | obsolesence.
         | 
         | They shafted so many customers with the S1/S2 incompatibility,
         | leaving so many expensive and perfectly capable 'legacy'
         | systems unable to add new (S2) devices.
         | 
         | It was purely to try and force people to upgrade perfectly
         | decent devices, and prematurely turn a whole lot of S1 devices
         | into e-waste.
         | 
         | While their products are still good, I wouldn't buy one again
         | for fear of them introducing an S3 and rendering another set of
         | devices obsolete.
        
           | jethro_tell wrote:
           | There's not as much lock-in with the analog formats, you want
           | different speakers or a different head unit with the same
           | speakers you just change shit out at the end of the wires.
           | 
           | All these strange products we are getting around media
           | probably mostly has to do with licensing requirements for
           | DRM.
           | 
           | I assume it's as much the industry these people are working
           | with/coming from as it is the actual straight greed of sonos.
        
           | djrogers wrote:
           | I was upset at the time, but in hindsight, and given how
           | they've managed to continue to support both S1 and S2 product
           | lines, I can't really say they did it wrong. Bifurcating your
           | app to continue to provide support for 10+ year old hardware
           | is a lot better than simply EOL'ing said hardware.
        
             | bluescrn wrote:
             | The problem is that '10 years old' in computing is fairly
             | ancient, whereas in hi-fi, quality hardware will keep going
             | for many decades with minimal maintenance.
             | 
             | Not sure why they felt the need to split the app into two
             | rather than support the control of all devices through a
             | single app, even if the S1 devices have a bit less
             | functionality, or if S1 and S2 devices can't be grouped
             | into a single zone.
             | 
             | And then they've prevented some new devices from running
             | with the S1 app. My parents tried to buy an extra speaker,
             | but it didn't work with their S1 system (whereas only a few
             | months ago, they added a soundbar that worked fine)
             | 
             | It's a mess. It could have been handled a lot better. What
             | new features do you even get with S2 that require more
             | powerful hardware?
        
           | ska wrote:
           | I solved this by just sticking with my S1 devices. Other than
           | the horrible software, still going ok. When I eventually
           | replace, it won't be sonos, but I've yet to see a really good
           | option for replacing it.
        
         | [deleted]
        
       | ganlaw wrote:
       | Very interesting read. As a purely front end engineer, I am
       | always fascinated by other peoples ability to reverse engineer
       | everyday systems that I use and complain about. If I wanted to
       | learn more about reverse engineering, do you have any recommended
       | readings or talks?
        
         | davewritescode wrote:
         | This one is pretty simple. All the communication with the sonos
         | device happens in the clear and the protocols are actually
         | pretty well documented.
         | 
         | Getting good at using wireshark is a good place to start.
         | 
         | This project is pretty dead but I remember using it a few years
         | ago https://github.com/stephen/airsonos
        
         | fao_ wrote:
         | Personally I liked using mitmproxy and Android 86x, it took a
         | little bit of setup but was easy to use after a while
        
         | IceDane wrote:
         | There is really not any way to give anyone a guide to doing
         | what this guy does because it's not applying any special
         | techniques to do anything. This isn't a binary reversing guide
         | using a specific way to decode an encrypted executable, or
         | whatever. This is quite literally just a guy who uses what he
         | knows to figure out what is going on, and then learn more as is
         | needed.
         | 
         | It will help not to put yourself into a box beforehand, like
         | calling yourself a "purely frontend engineer." This is the kind
         | of useless label for yourself that only serves to make you
         | yourself think that you should stay in some arbitrary, badly
         | specified corner of CS knowledge.
         | 
         | Literally just read about things, then use that knowledge to
         | deconstruct other things. That's all that's going on.
        
         | _0ffh wrote:
         | I have something much, much worse: I've got a rabbit hole!
         | Here's two mirrors of a quite old website that is heavy on
         | reverse engineering lore. While technological details may be
         | outdated, many of the teachings certainly still apply.
         | 
         | http://www.darkridge.com/~jpr5/mirror/fravia.org/index.html
         | http://woodmann.com/fravia/
         | 
         | Edit: Sorry that the page is somewhat labyrinthine.
        
           | alasdair_ wrote:
           | RIP +Fravia
           | 
           | Finding his site in 1995 or so taught me an enormous number
           | of things that I don't think I would have learned any other
           | way.
        
             | _0ffh wrote:
             | Yes, I genuinely felt a bit sentimental and melancholic
             | just clicking through a few of these pages once again.
             | 
             | F
        
         | shmatt wrote:
         | There is tons to reverse engineer on the frontend. When you
         | think about it, we have so much source code we can read
         | through, some of it can hide bad engineering that lets you
         | access something you shouldn't be able to. Like setting the
         | price of an item via hidden form parameter, or finding an
         | endpoint that lists every single promo code
         | 
         | Next time you find a website with a GraphQL API, try running
         | the introspection query[1]. If that doesn't work, try
         | fuzzing[2]. I've found multi-billion dollar companies who've
         | 
         | * Left open their GraphQL playground completely
         | 
         | * Enable introspection
         | 
         | Once you start you can dig into the API, and figure if you
         | found anything interesting
         | 
         | [1] https://blog.yeswehack.com/yeswerhackers/how-exploit-
         | graphql...
         | 
         | [2] https://github.com/nikitastupin/clairvoyance
        
           | trever123 wrote:
           | Some companies/APIs do this on purpose as one of the benefits
           | of graphql is the self documenting nature. If you have a well
           | secured schema this shouldn't be a problem. If you are doing
           | security through absurdity by having stuff in the schema you
           | don't want people to discover, you are going to have a bad
           | time.
        
         | korijn wrote:
         | Start by reverse engineering things in your comfort zone. You
         | must already use a couple of libraries in your front end work.
         | Hone your reverse engineering skills by trying to implement the
         | same thing yourself. It's mostly about the ability to figure
         | out how something works by observing and testing its behavior.
        
       | kclay wrote:
       | I assume this is what the SonosTube[1] app does. It's pretty nice
       | 
       | [1]
       | https://play.google.com/store/apps/details?id=frontier.sonos...
        
       | amaccuish wrote:
       | One day I'll wireshark the weird streaming protocol they use
       | instead of just upgrading to SMB2/3. I'm pretty sure it's HTTP.
        
       | charcircuit wrote:
       | Where is the part where YouTube gets hacked?
        
         | X-Cubed wrote:
         | Hacking doesn't just refer to security vulnerabilities and
         | unauthorized access.
         | 
         | "A hacker is a person skilled in information technology who
         | uses their technical knowledge to achieve a goal or overcome an
         | obstacle, within a computerized system by non-standard means."
         | 
         | https://en.wikipedia.org/wiki/Hacker
        
         | hirako2000 wrote:
         | I also can't find how that's hacking YT.
         | 
         | There was a time, not so long ago, security bugs hunters would
         | claim they found some oddities within a sub module of some
         | software, then disclose how it leads to escalation of
         | privileges, 7 other severe flaws leading to remote code
         | execution, ending with a mention that it makes half of the
         | internet vulnerable since it's Apache or some other broadly
         | used utility.
        
       | FridayoLeary wrote:
       | I'm a bit alien to these kind of things and i cannot believe that
       | a speaker could be limited in such a way. It's sole function is
       | to play sound from a device and it utterly fails at that. Why do
       | people put up with such rubbish? I get upset when i see a speaker
       | without a jack port.
       | 
       | Also, the article is excellent but the title lets it down. Can i
       | suggest it be changed to something like "reverse engineering
       | SONOS to play YouTube". If deadf00d is still on maybe you should
       | also rethink the title?
        
       | 71a54xd wrote:
       | The co-working space I used to go right out of college used to
       | have Sonos speakers. Occasionally, there'd be times when I wanted
       | to work where the couches were but didn't want to listen to
       | blaring pop music or something that was too rhythmic later in the
       | day, so I started looking for ways to interrupt the audio stream
       | going to the sonos devices. It turns out after a bit of snooping
       | with nmap and looking at some Sonos forums that two specific
       | ports are used to maintain sync between Sonos speakers and stream
       | data to them. Then I just wrote a python script that would blast
       | these ports with TCP traffic on the wifi (which the sonos
       | speakers were also connected to) and would use the script when I
       | wanted peace and quiet without headphones. Turns out that
       | networking class I took in college wasn't a waste afterall.
        
         | sgarman wrote:
         | 1.) Could you not have just asked them to change the music? 2.
         | Did that cause any other degradation to the network?
        
           | iypx wrote:
           | 1. - Not OP, but I believe the moment you put some
           | music/radio on speakers for other people to listen, legally,
           | you become a broadcaster. You can't just play anything you
           | want, you need a license :) I recall my last workplace
           | mentioning they're paying a few thousands a year to stream
           | just one radio station, same 20-30 songs 24/7...
        
       | chinathrow wrote:
       | For those on Linux, Noson works great to control SONOS.
        
         | monkaiju wrote:
         | Just found this today, works very well and lets me play any
         | audio from my linux system through sonos
        
       ___________________________________________________________________
       (page generated 2022-02-03 23:00 UTC)