Watch 1 Star 1 Fork 0

learn-help / loginotherMIT

Join us
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
Clone or download
index.html 16.03 KB
Copy Edit Web IDE Raw Blame History
learn-help authored 2020-05-07 17:58 . 重新开始
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<meta name="robots" content="all" />
<meta name="renderer" content="webkit" />
<meta name="generator" content="gitee" />
<meta name="x5-page-mode" content="app" />
<meta name="author" content="learn-help" />
<meta name="MobileOptimized" content="320" />
<meta name="copyright" content="learn-help" />
<meta name="HandheldFriendly" content="true" />
<meta name="x5-orientation" content="portrait" />
<meta name="browsermode" content="application" />
<meta name="screen-orientation" content="portrait" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="msapplication-tap-highlight" content="no" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta
name="description"
content="Without your consent most major web platforms leak whether you are logged in. This allows any website to detect on which platforms you're signed up. Since there are lots of platforms with specific demographics an attacker could reason about your personality, too."
/>
<meta property="author" content="learn-help" />
<meta
property="image"
content="https://learn-help.gitee.io/login/logo.png"
/>
<meta property="og:title" content="Your Social Media Fingerprint" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://learn-help.gitee.io/login/" />
<meta
property="og:image"
content="https://learn-help.gitee.io/login/logo.png"
/>
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="837" />
<meta property="og:image:height" content="438" />
<meta property="og:image:alt" content="您的社交媒体指纹" />
<meta property="og:author" content="https://facebook.com/RobinLinus" />
<meta property="og:locale" content="zh_CN" />
<meta property="og:site_name" content="Your Social Media Fingerprint" />
<meta
property="og:description"
content="Without your consent most major web platforms leak whether you are logged in. This allows any website to detect on which platforms you're signed up. Since there are lots of platforms with specific demographics an attacker could reason about your personality, too."
/>
<meta name="weibo:type" content="webpage" />
<meta name="weibo:webpage:create_at" content="2020-04-06 08:55:21" />
<meta name="weibo:webpage:update_at" content="2020-04-06 08:55:21" />
<meta property="fb:pages" content="451189218422617" />
<meta property="fb:profile_id" content="451189218422617" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Your Social Media Fingerprint" />
<meta
name="twitter:image"
content="https://learn-help.gitee.io/login/logo.png"
/>
<meta
name="twitter:description"
content="Without your consent most major web platforms leak whether you are logged in. This allows any website to detect on which platforms you're signed up. Since there are lots of platforms with specific demographics an attacker could reason about your personality, too."
/>
<base target="_blank" />
<title>Your Social Media Fingerprint</title>
<link rel="icon" type="image/x-icon" href="login.ico" />
<link rel="stylesheet" type="text/css" href="login.css" />
<script src="login.js" defer></script>
</head>
<body>
<div class="content">
<h1>Your Social Media Fingerprint</h1>
<section>
<p>
Without your consent most major web platforms leak whether you are
logged in. This allows any website to detect on which platforms you're
signed up. Since there are lots of platforms with specific
demographics an attacker could reason about your personality, too.
</p>
<p id="ff" style="display:none;">
Update: If you see broken images like this:
<img
src="https://facebook.com/favicon.ico"
onload="document.getElementById('ff').remove()"
onerror="document.getElementById('ff').style='display:block;'"
/>
instead of a logo, the login detection won't work for this platforms
because your browser is blocking requests to their domain. If you're
using Firefox <a href="#updates">read the updates.</a>
</p>
</section>
<section class="demo">
<h2>Demonstration</h2>
<div>
<h3>You are logged in to:</h3>
<div id="loggedIn">
<h2>No platform</h2>
<p>
(or maybe you've disabled third party cookies, or you are using
something like Privacy Badger?)
</p>
<br /><br /><br />
</div>
<h3>You are not logged in to:</h3>
<div id="notLoggedIn"></div>
</div>
</section>
<section>
<h2>Explanation</h2>
<p>
For most web platforms there's a way to abuse the login mechanism to
detect whether a user is logged in to that service.
<br />
Although this vulnerability is
<a href="https://t.cn/RvCcfnZ">
well known
</a>
<a href="https://t.cn/A6ZBbp82">
for several years
</a>
most companies
<a href="https://t.cn/A6ZBbp8A"> won't fix it </a>.
</p>
The exploit is pretty simple and actually easy to fix. Let's look at
facebook.com to get an idea of how it works:
<h4>How does the login redirect mechanism work?</h4>
<br />
At first we need to understand the login redirect mechanism. Say you're
logged in and visit
<pre><code>https://www.facebook.com/bookmarks/pages</code></pre>
<p>
Now if you open this URL in a private tab where you are not logged in,
you will get redirected to the login screen with this URL:
</p>
<pre><code>https://www.facebook.com/login.php?next=https%3A%2F%2Fwww.facebook.com%2Fbookmarks%2Fpages</code></pre>
Note the <code>next</code> parameter in the URL:
<code>https%3A%2F%2Fwww.facebook.com%2Fbookmarks%2Fpages</code>.
<p>
That's the URL we came from and it is used to redirect us back there
once we've logged in.
<br />But if we enter the login URL in a browser tab where we are
already logged in, we get redirected without getting prompted to
login. Therefore this URL returns:
</p>
<ul>
<li>
If logged in:&nbsp;&nbsp;&nbsp;the resource at the URL in the
<code>next</code> parameter
</li>
<li>If logged out: the login screen</li>
</ul>
<h4>Bypass the Same Origin Policy</h4>
<p>
How does this URL help us? The Same Origin Policy prevents to read the
results of this request from any other domain but
https://facebook.com... <br />Well, the SOP is strict for HTML pages,
but it allows to receive images from other origins! So if the resource
in the <code>next</code> parameter would be an image we could read it
from our website. It can't be any image though. Facebook checks if the
URL in the <code>next</code> parameter starts with
<code>https://facebook.com</code>. So we need to find an image on
facebook.com. Should be easy, right? Actually it isn't, because
facebook hosts almost all images on their CDN servers under the domain
<code>fbcdn.net</code>. Though there is one image that you can find on
almost every webserver: the good old <code>favicon.ico</code>!
<br />This is how our login URL looks like with the favicon as
<code>next</code> parameter:
</p>
<pre><code>https://www.facebook.com/login.php?next=https%3A%2F%2Fwww.facebook.com%2Ffavicon.ico</code></pre>
It has a very
<a
href="https://www.facebook.com/login.php?next=https%3A%2F%2Fwww.facebook.com%2Ffavicon.ico"
>
interesting property </a
>:
<ul>
<li>Logged in:&nbsp;&nbsp;&nbsp;returns the favicon image</li>
<li>Logged out: returns the HTML of the login page</li>
</ul>
<p>
We can use this URL in an <code>&lt;img&gt;</code> tag in our website:
</p>
<pre><code>&lt;img src="https://www.facebook.com/login.php?next=https%3A%2F%2Fwww.facebook.com%2Ffavicon.ico"&gt;</code></pre>
This <code>&lt;img&gt;</code> tag's property:
<ul>
<li>
Logged in:&nbsp;&nbsp;&nbsp;receives the favicon image, will load it
successfully, and the <code>onLoad</code> callback will be fired.
</li>
<li>
Logged out: receives the HTML of the login screen, will fail to load
it as an image, and the <code>onError</code> callback will be fired.
</li>
</ul>
This leads to the final exploit:
<pre><code>&lt;img onload="alert('logged in to fb')" onerror="alert('not logged in to fb')" src="https://www.facebook.com/login.php?next=https%3A%2F%2Fwww.facebook.com%2Ffavicon.ico"&gt;</code></pre>
<h4>Other Platforms</h4>
<p>
This mechanism works for almost all major web platforms, because they
all have a redirect parameter in their login endpoint and they need to
host their favicon on their domain (<a href="http://t.cn/A6ZBGCSh">
bc of browser compatibility, and of the technical debt of the former
lack of standards </a
>).
</p>
<h4 id="updates">Updates</h4>
<ul>
<li>
2016/10/07: Instagram removed the favicon from their root domain and
host their favicon on their CDN now.
</li>
<li>
2016/10/14:
<a href="http://t.cn/A6ZBGrIY">
Stackoverflow has fixed the issue.</a
>
</li>
<li>
2016/10/14: It looks like Firefox has fixed the issue at least for
the major networks with their
<a href="http://t.cn/A6ZBqKw8"
>default tracking protection blacklist</a
>
(The blacklist comes from
<a href="https://disconnect.me/">https://disconnect.me/</a>).
<br />
<br />Console screenshot of the errors when visting socialmedia-leak
with current Firefox:<a href="firefox-error.png">
<img src="firefox-error.png" style="width:100%" />
</a>
Though it probably still works for all platforms where you don't see
a broken image <img src="a" /> instead of a logo.
</li>
<li>
2016/10/14: Netflix now just redirects to the main browse page
regardless of the redirect in the URL.
</li>
<li>
2017/11/29: Flickr
<a href="http://t.cn/A6ZBcBJV">has fixed</a>
the issue, too.
</li>
</ul>
</section>
<section>
<h2>Further Attacks</h2>
<p>
This attack could be a step of a worse attack such as
<a href="http://t.cn/A6ZBcEuD">deanonymization techniques</a>,
<a href="https://en.wikipedia.org/wiki/Clickjacking">Clickjacking</a>,
<a href="http://sakurity.com/blog/2015/03/10/Profilejacking.html"
>Profilejacking</a
>, or
<a href="https://en.wikipedia.org/wiki/Phishing">Phishing</a>
where it is crucial to know if a victim is logged in to a service.
</p>
</section>
<section>
<h2>Protection</h2>
<p>
First of all:
<a href="http://t.cn/A6ZB5XIz">disable third party cookies.</a>
</p>
<p>
You can also install a browser plugin like
<a href="https://www.google.com/search?q=privacy+badger"
>Privacy Badger</a
>, or
<a href="https://www.google.com/search?q=umatrix">uMatrix</a>
to protect yourself from this attack.
</p>
<p>
For further information see the
<a
href="https://news.ycombinator.com/item?id=12692190"
rel="noreferrer"
>discussion on Hackernews</a
>
or this
<a
href="https://www.reddit.com/r/programming/comments/5741xk/your_social_media_fingerprint/"
rel="noreferrer"
>discussion on Reddit</a
>.
</p>
</section>
<section>
<h2>Help to solve the issue!</h2>
<p>
The companies won't fix the issue, because the risk for their own
service is relatively low. Though so many platforms are vulnerable to
this, it becomes a real privacy issue. Please help to raise awareness
to push the companies to fix the issue.
</p>
<ul>
<li>
<a
href="https://twitter.com/home?status=https%3A//robinlinus.github.io/socialmedia-leak"
>Share this demo on Twitter</a
>
</li>
<li>
<a
href="https://www.facebook.com/sharer/sharer.php?u=https%3A//robinlinus.github.io/socialmedia-leak"
>Share this demo on Facebook</a
>
</li>
<li>
<a
href="https://plus.google.com/share?url=https%3A//robinlinus.github.io/socialmedia-leak"
>Share this demo on Google+</a
>
</li>
<li>
<a
data-action="share/whatsapp/share"
href="whatsapp://send?text=https://robinlinus.github.io/socialmedia-leak"
>Share this demo via Whatsapp</a
>
</li>
<li>
<a href="https://github.com/RobinLinus/socialmedia-leak"
>Star this project on Github</a
>
</li>
</ul>
<p>
If you find more web platforms that are vulnerable to this attack,
<a href="https://github.com/RobinLinus/socialmedia-leak/issues"
>please file an issue to add it.</a
>
The more complete this list is, the bigger the issue and the higher
the pressure for platforms to fix it.
</p>
</section>
<section>
<h3>If you like this page maybe you like my other works, too:</h3>
<ul>
<li>
<a href="https://snapdrop.net"
><b>Snapdrop:</b> Instantly share files with devices nearby. No
Setup, No Signup.</a
>
</li>
<li>
<a href="http://webkay.robinlinus.com"
><b>Webkay:</b> A demonstration of all the personal information
your browser is leaking.</a
>
</li>
<li>
<a href="http://ubercookie.robinlinus.com"
><b>Ubercookie:</b> An irrevocable persistent browser cookie.</a
>
</li>
<li>
<a href="https://websecurity.firebaseapp.com"
><b>Web Security Quiz:</b> Test your knowledge with OWASP exam
questions</a
>
</li>
<li>
<a href="http://capira.de"
><b>Capira:</b> Interactive Learning Videos</a
>
</li>
<li>
<a href="https://www.facebook.com/RobinLinus"
><b>Facebook:</b> Like my page to get updates about the stuff I
create</a
>
</li>
<li>
<a href="https://twitter.com/robin_linus"
><b>Twitter:</b> Follow me on Twitter to get updates about the
stuff I create</a
>
</li>
</ul>
</section>
</div>
<a href="https://robinlinus.github.io" id="about">
<footer>Built with ♥ by Robin Linus</footer>
</a>
</body>
</html>

Comment ( 0 )

Sign in for post a comment

other
1
https://gitee.com/learn-help/login.git
git@gitee.com:learn-help/login.git
learn-help
login
login
master

Help Search