TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Reverse Engineering Snapchat: Obfuscation Techniques

497 点作者 3eed将近 5 年前

38 条评论

conradev将近 5 年前
I’m surprised that no one has mentioned how this is actually accomplished. The answer is: largely automatically, at the compiler level.<p>Snapchat acquired Obfuscator-LLVM and the people behind it in 2017, which was actually partially open source for a period of time. It is a compiler backend for LLVM that obfuscates your code for you. You can read a bit about some of the techniques used on their old wiki:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;obfuscator-llvm&#x2F;obfuscator&#x2F;wiki&#x2F;Features" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;obfuscator-llvm&#x2F;obfuscator&#x2F;wiki&#x2F;Features</a> (outdated)<p><a href="https:&#x2F;&#x2F;www.bloomberg.com&#x2F;news&#x2F;articles&#x2F;2017-07-21&#x2F;snap-hires-swiss-team-behind-software-protection-startup" rel="nofollow">https:&#x2F;&#x2F;www.bloomberg.com&#x2F;news&#x2F;articles&#x2F;2017-07-21&#x2F;snap-hire...</a>
评论 #23560741 未加载
just-ok将近 5 年前
This is an awesome write-up; I’m shocked at the level of effort that went into Snap’s obfuscation process. It implies that are entire teams of engineers out there whose sole job it is to play cat&amp;mouse with reverse engineers and nothing more. Another comment mentioned that this effort is outsourced, so not only are there teams, but entire companies dedicated to this!<p>What a blast that must be... though the immense amount of [invested|wasted] (take your pick depending on cynicism) effort spent on this game makes me a little sad. All of these brilliant minds just... cosplaying Sisyphus?
评论 #23559696 未加载
评论 #23560135 未加载
评论 #23558893 未加载
评论 #23559116 未加载
评论 #23560210 未加载
评论 #23569466 未加载
评论 #23559096 未加载
jor-el将近 5 年前
Some I see are surprised to see the level of obfuscation used in the application. Many pointed, many ingredients for the obfuscation used in the app are off-the-shelf and few of them can be said to be well known in the industry, but still there is a cost in integrating them into a product. Obfuscation is notorious in breaking things which should work normally (normal compilation process) and as a own goal making it hard to debug as well. Integrating, testing, debugging and difficulty in debugging production crash logs is a considerable cost.<p>That said, obfuscation is increasingly being used in mobile applications now. Check your banking application or some government applications, you will find obfuscation being used. With mobile applications getting richer and lot of code executing on the client side, makes it compelling case to secure applications by using obfuscation (as a defense-in-depth approach).<p>Open standards like OWASP MSTG [1] MSTG-RESILIENCE-9 recommend such approach.<p><pre><code> Obfuscation is applied to programmatic defenses, which in turn impede de-obfuscation via dynamic analysis. </code></pre> [1] <a href="https:&#x2F;&#x2F;github.com&#x2F;OWASP&#x2F;owasp-masvs&#x2F;blob&#x2F;master&#x2F;Document&#x2F;0x15-V8-Resiliency_Against_Reverse_Engineering_Requirements.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;OWASP&#x2F;owasp-masvs&#x2F;blob&#x2F;master&#x2F;Document&#x2F;0x...</a>
评论 #23560231 未加载
xuki将近 5 年前
Snapchat acquired Strong Codes in 2017. Before the acquisition they used Strong Codes compiler for obfuscation.<p><a href="https:&#x2F;&#x2F;www.bloomberg.com&#x2F;news&#x2F;articles&#x2F;2017-07-21&#x2F;snap-hires-swiss-team-behind-software-protection-startup" rel="nofollow">https:&#x2F;&#x2F;www.bloomberg.com&#x2F;news&#x2F;articles&#x2F;2017-07-21&#x2F;snap-hire...</a>
brendonjohn将近 5 年前
This is brilliant work, I&#x27;m hoping in part II we get to see it working against the API.<p>I reverse engineered this in a production environment. It took approximately 7 months to build a scalable solution.<p>The investigation on how to create the x-snapchat-client-auth token is brilliant. One day I hope to do a talk on what my old team did to circumvent it.<p>There&#x27;s a painful gotcha on the homestretch for this token: You may be creating the token, but it&#x27;s not obvious what you&#x27;re supposed to be using the method to sign.<p>What do they use it for? As far as I could tell, it&#x27;s so they can verify requests at the edge nodes of their network. When you provide a bad x-snapchat-client-auth, you get a near-instant 403.
评论 #23561228 未加载
评论 #23560694 未加载
sbuccini将近 5 年前
I remember back in 2013(?) I went to a collegiate hackathon in Santa Monica. Evan Spiegel showed up to walk the floor and someone showed him how they had sniffed the API and did something interesting with it (forget the particulars now, getting old). If I recall correctly, Evan offered the kid a job on the spot but the kid turned him down.<p>They&#x27;ve come a long way since then!
评论 #23559363 未加载
评论 #23558753 未加载
zelly将近 5 年前
Snapchat is notoriously difficult to automate&#x2F;spam.<p>The goal is to get the X-Snapchat token. The most elegant solution is to find the secret in the binary and reverse the algorithm to generate tokens. Wouldn&#x27;t it be easier to MITM the endpoint; set up a dummy server (which collects tokens) in front of a proxy that spoofs the DNS and TLS certs (may be easier on rooted Android than iOS).<p>In my last attempt I gave up and went for dumb UI automation, but it would be cool (and worth good money) to exploit the private API.
评论 #23558671 未加载
评论 #23558696 未加载
评论 #23563550 未加载
rvz将近 5 年前
Well at this point, you might as well run the binary in a Mach-O ARM emulator since Snap has seriously cranked up the reversing difficulty to level 10,000.<p>I suggest anyone looking at this would need to use Corellium such that Snap has made it hard for <i>almost</i> anyone to get their private API.
评论 #23558764 未加载
xwdv将近 5 年前
If you dig very deep, you can also find an offer to come work at Snapchat. Most will never find it.
评论 #23560937 未加载
评论 #23562624 未加载
hn_throwaway_99将近 5 年前
I&#x27;m curious, can anyone recommend any techniques (or companies providing solutions) for attempting something similar with javascript in a browser calling an API? Obviously it&#x27;s much more difficult to obfuscate an algorithm for generating a client token in JS than it would be in assembly, but I&#x27;m just curious if anyone has tried any form of &quot;lock down my API so it&#x27;s only callable from the web front end I provide&quot; obfuscation.
评论 #23561107 未加载
评论 #23560624 未加载
评论 #23562702 未加载
评论 #23559663 未加载
ed25519FUUU将近 5 年前
&gt; <i>To make your life even more miserable, Snap ocassionally deprives you of recognizing some basic standard lib functions ... You won’t be very happy after spending a day or two reversing a function to find it’s memmove in the end.</i><p>That sounds particularly devious.
jayd16将近 5 年前
Philosophically I never gave much thought to securing app client code.<p>Why not just track usage stats and ban clearly fake&#x2F;high throughput users?
评论 #23562990 未加载
评论 #23560466 未加载
评论 #23558929 未加载
评论 #23558833 未加载
评论 #23561171 未加载
mises将近 5 年前
This is some pretty heavy-duty obfuscation. What is the business case for this amount of work towards preventing reverse-engineering? Decent rate limiting should be much more effective than making such a herculean effort to obfuscate one&#x27;s API.<p>Edit: another comment mentions that snap chat uses an existing solution, which makes more sense than the expense of developing this sort of obfuscation in-house: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=23558784" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=23558784</a>
评论 #23561437 未加载
bob1029将近 5 年前
Seems like hooking the UI layer and intercepting data on the wire would be a much simpler approach. I wouldn&#x27;t even try to circumvent the UI flow or animations. The more &#x27;user-like&#x27; the activity, the more difficult it is to distinguish automation from human traffic. This doesn&#x27;t scale as well well as many would like, but it can work. You could probably bundle something like this up and resell it as a grey-market API.<p>There may be some money in standing up a datacenter that is filled almost exclusively with smartphones.
programmarchy将近 5 年前
How many of these tricks are off the shelf techniques? Seems like a tremendous effort.
评论 #23558726 未加载
评论 #23558526 未加载
评论 #23558780 未加载
llacb47将近 5 年前
Do tiktok next, their obfuscation techniques are quite interesting. :)
评论 #23564572 未加载
bluesign将近 5 年前
Best value of this kind of obfuscation is they usually rely on a random seed, and every time you obfuscate you have different results. So once you update the app (and change hash function), for new version, spammer need to the all reversing once again.
评论 #23562352 未加载
trishume将近 5 年前
One thing I&#x27;m curious about is what they do to try to stop you from just ripping out the obfuscated token generation library and setting up a harness to run the whole thing in <a href="https:&#x2F;&#x2F;www.unicorn-engine.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.unicorn-engine.org&#x2F;</a> or something. Like presumably they don&#x27;t compile their whole app with obfuscation and it&#x27;s just some library that&#x27;s linked in with some kind of stable-ish API contract with the rest of the app. I wouldn&#x27;t be surprised if they do interesting things to try and stop you from ripping it out and it&#x27;d be cool to learn what those are.
评论 #23564535 未加载
评论 #23564381 未加载
评论 #23564396 未加载
unnouinceput将近 5 年前
All these to make Snapchat not being recorded. Well, it&#x27;s a mouse and cat game and currently the cat is winning, as in using Memu on my PC allows me to record everything happening there, your crush nudes and dances included.
danbmil99将近 5 年前
This sort of thing has been prevalent in the game world for decades.<p>I once had the chance to work on a project disassembling casino machines, and they had similar protection appropriate for the technology of the time
surround将近 5 年前
There are already alternative front-ends for YouTube, Facebook, and Reddit. I’d love to see one for Snapchat and Instagram, although it looks like one for Snapchat would be incredibly difficult.
评论 #23560185 未加载
mvkel将近 5 年前
This is what the top 1% of MIT grads work on. Obfuscating IP for a user data company.<p>It’s clever, but man... I have to believe these talented folks were destined for something greater.
jwyatt1995将近 5 年前
How would one go about understanding the content of this write-up? Even after the first paragraph it begins to go completely over my head.
评论 #23563556 未加载
akaktsn将近 5 年前
I would love to be able to make a bot for the snapchat group my friends and I have. We already have a blast using it now. A bot that could randomly do things that we could all interact with would be hilarious. Sadly I don&#x27;t think this functionality will be introduced. So it will be cool to maybe slap something together before all of this gets fixed.
htgb将近 5 年前
Interesting read! I&#x27;d love to read the next post, but at least Miniflux can&#x27;t find any feed.<p>3eed, would you be open to adding an RSS feed?
评论 #23562419 未加载
评论 #23561472 未加载
yamrzou将近 5 年前
How does one go about learning reverse engineering? Is it mostly by practicing? Are there any good up-to-date resources?<p>I remember taking a reverse engineering course in the university where the professor didn&#x27;t even bother to explain the basics, it was like black magic and left me frustrated, but I still feel amazed when I read blog posts like these.
评论 #23567614 未加载
评论 #23562510 未加载
ffritz将近 5 年前
I was wondering if there are any steps a developer of a small app can take to add such a header and lock down the API so it only answers to said header. This level of obfuscation doesn’t seem doable for smaller shops. Is there something simpler, that is “good enough”?
评论 #23564623 未加载
评论 #23564556 未加载
mmhsieh将近 5 年前
I have been advised by researchers in the field that it takes about a day with an optimizing compiler to de-obfuscate most any piece of commercial software of this size, with a good team. With a less than great team, perhaps about a week. Is that true?
评论 #23562407 未加载
DLA将近 5 年前
CORRECT LINK: <a href="https:&#x2F;&#x2F;hot3eed.github.io&#x2F;2020&#x2F;06&#x2F;18&#x2F;snap_p1_obfuscations.html" rel="nofollow">https:&#x2F;&#x2F;hot3eed.github.io&#x2F;2020&#x2F;06&#x2F;18&#x2F;snap_p1_obfuscations.ht...</a>
akersten将近 5 年前
Wow, that seems really messy. If you&#x27;re just after the API key or whatever, wouldn&#x27;t reversing the Android app be simpler? As far as I know, you can&#x27;t do all these low-level tricks on the Java platform.
评论 #23559189 未加载
评论 #23560260 未加载
评论 #23558642 未加载
评论 #23558763 未加载
saagarjha将近 5 年前
&gt; In Mach-O binaries, functions whose pointers are in the __mod_init_funcs run before main.<p>Remember that obfuscation makes your code run slower. This specific one is part of the reason why the dyld team probably hates you.
评论 #23560284 未加载
obvboasio将近 5 年前
to answer everyone asking &#x27;why do they do it????&#x27; its because of spam, that simple. they dont want:<p>a) outbound bots that send messages to users created in bulk messaging millions of users. b) inbound chatbots that answer messages c) when they had snapcash, they didnt want bots generated collecting cash.<p>spam is a multi million dollar industry.<p>@3eed i guess it&#x27;s not considered obfuscation but you gotta pass the correct version # or you won&#x27;t be able to connect either, old versions are immediately obsolete.
评论 #23560652 未加载
shay_ker将近 5 年前
Are any of these obfuscation techniques possible on the web? My guess is no, but just curious.
iampims将近 5 年前
Things were definitely much simpler a couple years ago.
评论 #23558477 未加载
pjmlp将近 5 年前
Very nice article. Great piece of work.
Commodore_64将近 5 年前
Great write up! Thanks for posting!
grecy将近 5 年前
Will Apple approve an app with this level of Obfuscation in it&#x27;s source? I thought they had to have the source itself?
评论 #23560144 未加载
评论 #23560140 未加载
评论 #23560148 未加载
MintelIE将近 5 年前
Doesn&#x27;t Snapchat mainly rely upon the iOS or Android platform having some software that prevents screen shots if a &#x27;no screen shots&#x27; flag is set? I always thought this was their core defense.
评论 #23558520 未加载
评论 #23561450 未加载