News for hackers. Stuff that matters.
Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by pav3l on Monday November 26, 2012 @07:04PM (#4834737)
Can someone explain how he got a hold of the decrypted .mov files that he compared the encrypted ones with? It's not very clear to me from the post, and I'm not familiar with Leaping Brain.

Either way.. wow... XOR encryption with just such a short repeating string! I bet it wouldn't be too hard to decrypt it even without the original file, since the file signature alone would probably be longer than the string. DISCLAIMER: I'm just speculating, I don't know the .mov specs.

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by asherlangton on Monday November 26, 2012 @07:29PM (#4834834)
The wrapper script is GPL'd, so I copied it here:

http://dl.dropbox.com/u/15447644/brainplayer_py.txt

My modifications are on lines 553-556. The compiled app "fixes" the .mov file just long enough for it to be loaded into the player. If you have Leaping Brain's player installed (often branded with the content owner's name), the .mov files are in a hidden .media folder. On my Mac, they were in $HOME/Library/Application Support/LeapingBrain/catalog/$VIDEONAME/.media

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by pav3l on Monday November 26, 2012 @07:42PM (#4834883)
Thanks for sharing! Hope you won't get in trouble for your post.
Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by nacs on Tuesday November 27, 2012 @02:16AM (#4836045)
Not sure how he could get in any trouble from it due to the license at the very top of the file he linked:

"# BrainPlayer is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License

I'm sure Leapfrog hated to put that GPL license on there but were likely forced to due to the VLC components they're using that are GPL/LGPL.

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by alexkus on Tuesday November 27, 2012 @04:13AM (#4836334)
And, as per https://www.gnu.org/licenses/gpl-faq.html#DRMProhibited the DMCA cannot be applied to this software.
Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by tshtf on Monday November 26, 2012 @07:20PM (#4834795)
He just performed a bitwise XOR of the plaintext and ciphertext stream to obtain the key.

From the post:

By comparing the binary files, I discovered the "proprietary video encryption" algorithm: for the first 15kB, each 1kB block has its initial bytes xor'd with the string "RANDOM_STRING".

See:

https://en.wikipedia.org/wiki/XOR_cipher

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by NickPollard on Monday November 26, 2012 @07:11PM (#4834761)
From what he says, it sounds like the app is really a standard movie player, plus their 'encrypter', plus a python script that does the following:

> calls 'decrypt movie_file' to create 'decrypted_movie_file' > calls 'play decrypted_movie_file' > calls 'delete decrypted_movie_file'

He just made a copy of the python script that calls their own decryption module but removed the delete line.

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by pav3l on Monday November 26, 2012 @07:18PM (#4834789)
I don't even know what's worse - their "proprietary encryption algorithm" or the fact that they used Python for a critical piece of distributed software that you don't want to be reverse-engineered!
Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by tvdw on Monday November 26, 2012 @07:23PM (#4834810)
For the record, distributing Python scripts doesn't have to mean distributing the source: it's possible to just execute the compiled .pyc files, which are harder to crack than (for example) Java's .class files.

Also, since xor is just a CPU instruction, you won't immediately notice it in the decompiled script (if you get that far). With all the overhead that decompilers tend to produce, it's really easy to miss.

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by revelation on Monday November 26, 2012 @07:30PM (#4834837)
You should really take a look at one of these .pyc files. They are very very verbose to the point that they even contain local variable names and the python code can be trivially decompiled from the bytecode.

Literally the only thing that goes missing from .py to .pyc is comments.

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by jrockway on Monday November 26, 2012 @07:59PM (#4834939)
That's what an assembly dump looks like to an experienced reverse engineer. Writing something in a "compiled language" because it's more secure is like XOR-ing your video with RANDOM_STRING and calling it DRM.

(Not that any DRM scheme can ever work, ever, but hey. At least some try to try.)

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by tptacek on Monday November 26, 2012 @08:11PM (#4834987)
Can't work ever? Are you taking orders for hacked DirecTV cards? :)
Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by daeken on Monday November 26, 2012 @08:35PM (#4835103)
I think you guys have two different definitions of "work". jrockway seems to be arguing from a technical perspective, but you're likely arguing from a practical perspective. Sure, DRM can "never work" in that there's always the analog loop and all that. But it's absolutely possible to make it so insanely complex and difficult that no one will ever break it; DirectTV has shown that angle works, without a doubt.
Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by mseebach2 on Tuesday November 27, 2012 @12:15AM (#4835761)
I think the distinction is between software and hardware DRM. DirecTV controls the entire hardware chain. This means they can do various proper encryption schemes (public/pre-shared key etc) that are actually near impossible to crack and make it really, really hard to obtain the key by making the key write-only in the crypto-chip.

In a pure software solution, you control the hardware, and any hiding of the key is subject to reverse engineering the software.

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by georgemcbay on Tuesday November 27, 2012 @02:47AM (#4836113)
There's also a distinction between access to the data stream vs the ability to make a duplicate of it.

For all of the success they've had in protecting DirecTV, if you've got a legitimate access card feeding HDMI data out, you can make a perfect digital copy of the video stream that has no copy protection whatsoever. So ultimately the DRM offers no protection for the media content companies (at least those that don't benefit from live performances like say sports games), though it does for the pipe provider who will surely get his monthly satellite fees.

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by NateLawson on Monday November 26, 2012 @11:26PM (#4835623)
I agree with your comment, except that "difficult" doesn't necessarily imply "insanely complex".

Counter-example: we once timed a release of a very minor protection update to when the main attacker typically took a holiday. We got 6 weeks out of something trivial, buying more time to work on the major release to greet him when he returned.

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by stcredzero on Monday November 26, 2012 @10:27PM (#4835466)
It all comes down to economics. Buy a beater bike, and sure, you can secure it well enough. (Mean time between stolen is low enough you don't care too much.) Buy a really nice one that everyone wants, and good luck with that.

Popular, recently produced media has too much value to too many attackers to protect. A celebrity's self shots -- same thing. A game console by Microsoft or Sony -- same thing.

> But it's absolutely possible to make it so insanely complex and difficult that no one will ever break it

A more accurate way to put it: If you make the return on effort ratio low enough, the probability of someone breaking it goes down, and it might even go down enough for you to get away with it for a useful amount of time.

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by NateLawson on Monday November 26, 2012 @11:24PM (#4835616)
It's not that simple. Sure, unpopular systems are more obscure and less likely to attract attention, but you're wrong in extending that to "if it's popular, it will be broken" (denying the antecedent).

As a counter-example, I propose DirecTV or even their competitor, Dish Network (Nagravision). Hacks of these systems are worth 6 figures, pay TV is widely desired, and there hasn't been a DTV hack since 2004. None.

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by stcredzero on Tuesday November 27, 2012 @12:33AM (#4835810)
> you're wrong in extending that to "if it's popular, it will be broken" (denying the antecedent).

Putting words in my mouth there. If it's popular, the probability it will be broken goes up.

> there hasn't been a DTV hack since 2004. None.

You're preaching to the choir here. Still, that's one tidbit I didn't already know. The old mainframe Mantis language is another example.

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by makomk on Monday November 26, 2012 @08:03PM (#4834953)
.pyc files are actually really easy to decompile, it's just that most people have never encountered the tools required to do it. I believe they literally contain the entire abstract syntax tree for the Python source code.
Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by daeken on Monday November 26, 2012 @09:52PM (#4835371)
No, they contain marshaled bytecode. I documented the format at http://daeken.com/python-marshal-format a while back (should still be more or less correct).
Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by barrkel on Monday November 26, 2012 @11:30PM (#4835636)
Python's bytecode is for a stack machine, if I'm not mistaken, and such bytecode is a serialization format for ASTs - a post-order traversal for expressions. Interpret stack machine bytecode symbolically and it reconstructs an AST:

Compilation:

  1 + 2 => (+ 1 2) => push 1, push 2, add
Interpretation:

  push 1 => 1
  push 2 => 2, 1
  add    => (+ 1 2)
Control flow makes things slightly more complicated, but not for predictable code generation.

Obfuscated bytecode which e.g. doesn't maintain consistent interpreter stack depths for every code path (illegal for JVM or .net CLR) would make things a little harder to analyze, but I doubt that's often the case in practice with Python.

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by daeken on Monday November 26, 2012 @11:34PM (#4835646)
Yeah, the reconstruction isn't hard at all, but it's not a direct 1:1 mapping to the AST, since multiple control flow structures in the AST can become the same thing in bytecode. That said, it's quite simple to make it Good Enough (TM); the reason I wrote that and the RMarshal module was that I was writing a Python decompiler a part of a larger commercial project. I should release the decompiler at some point.
Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by mrmagooey on Monday November 26, 2012 @08:04PM (#4834956)
There's also https://github.com/gstarnberger/uncompyle which automates .pyc to .py "uncompyling"
Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by doorty on Monday November 26, 2012 @07:09PM (#4834753)
The player decrypts the file before it is played and then encrypts again when it is finished, so if you grab the file while it is being used by the player then it will be decrypted.
Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by mikeash on Monday November 26, 2012 @07:21PM (#4834805)
Looking briefly at the .mov file format[1], it appears that any such file is guaranteed to have exactly the same bytes 4-11 (atom identifier and major brand identifier), is almost guaranteed to lead with three zero bytes (first four bytes are the length of the first atom, which is likely to be small), and will probably have the same bytes 12-15 (minor version number). If you know it's a .mov file, then you can extract "RAN" and "OM_STRIN" trivially, and the rest is easily guessable from there. In fact, since the first three bytes are probably zero, "RAN" will be right there in the file, ready for pondering.

[1] https://developer.apple.com/library/mac/#documentation/Quick...

Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by 0x0 on Monday November 26, 2012 @08:34PM (#4835101)
Reusing one-time-pad keys means you can often very easily recover the plaintext simply by XOR'ing the two encrypted files, since it effectively takes the key out of the picture, see for example http://www.cryptosmith.com/archives/70 (where the key is literally taken out of the picture)
Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by srdev on Monday November 26, 2012 @07:09PM (#4834754)
The "proprietary player" was just a Python script that made a temporary decrypted the video and ran VLC against it. So he just changed the Python script to keep around a decrypted copy rather than re-encrypt it away.
Re:Leaping Brain's "Virtually Uncrackable" DRM is just an XO... by tedreed on Monday November 26, 2012 @07:08PM (#4834750)
"Well, since they load the file from a Python script, it's easy to make a copy of the "decrypted" file before it's reverted."

He edited their Python script to make a copy.