Um pesquisador, Daniel Le Gall, descobriu uma vulnerabilidade séria em um dos servidores do Facebook. O pesquisador encontrou um serviço Sentry hospedado em 22.214.171.124 com o nome do host sentryagreements.thefacebook.com, durante a digitalização de uma faixa de IP que pertence ao Facebook -126.96.36.199/24.
Remote Code Execution on a Facebook Server: Detalhes técnicos
What is Sentry? It is a log collection web application which is written in Python with the Django framework.
The researcher also explained that, while he was looking at the Sentry app, some stracktraces regularly popped on the page for no particular reason.
The application seemed to be unstable regarding the user password reset feature, which occasionally crashed, ele adicionou, noting that Django debug mode was not turned off, which consequently prints the whole environment when a stacktrace occurs.
Contudo, Django snips critical information (senhas, secrets, key…) in those stacktraces, therefore avoiding a massive information leakage.
The researcher decided to look closer, and realized he could spot session cookie names, various options, as well as serializer known as Pickle. Simplificando, Pickle is a binary protocol for (un)serializing Python object structures, such as classes and methods in them.
If we were able to forge our own session that contains arbitrary pickle content, we could execute commands on the system,” Daniel notado.
Não obstante, the SECRET_KEY used by Django for signing session cookies is not available in the stacktrace. além disso, the SENTRY_OPTIONS list contains a key named system.secret-key, that is not snipped. According to the Sentry documentation, system.secret-key is “a secret key used for session signing. If this becomes compromised it’s important to regenerate it as otherwise its much easier to hijack user sessions.“
As the researcher pointed out, it looks like that the situation is “a sort of Django SECRET-KEY override”.
Using all of this information, Daniel was able to create a script which forges malicious cookies using arbitrary Pickle content. The latter contained a payload to override the Sentry cookie. This cookie was later overridden with an arbitrary object. To test this vulnerability, the researcher implemented a 30-second time delay avoiding the cause of any real damage. His attempt was successful.
An attacker could have exploited the security vulnerability to remotely hijack the system to steal data from the Facebook server or perform other malicious activities. It should be emphasized though, este no user data was located in the server, nether was it exposed due to this flaw.
Daniel reported his discovery to Facebook on July 30, 2018, with the company quickly acknowledging the bug by taking down the server. A patch was issued on August 9, and the researcher was awarded $5,000 for reporting the flaw.
Ano passado, um pesquisador de segurança, Andrew Leonov, was awarded $40,000 on behalf of Facebook for breaching the social network and fixing a remote code execution vulnerability which was already discovered and fixed in 2016. Pelo visto, the vulnerability needed to be addressed once again. The flaw was still impacting the website.