<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by tomahock on Medium]]></title>
        <description><![CDATA[Stories by tomahock on Medium]]></description>
        <link>https://medium.com/@tomahock?source=rss-ac67aecb3381------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8YgXxyZ6sNUmbuibo1nBjw.png</url>
            <title>Stories by tomahock on Medium</title>
            <link>https://medium.com/@tomahock?source=rss-ac67aecb3381------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 17:58:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tomahock/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[O Fogos.pt não devia existir]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">Este texto foi gerado por intelig&#xEA;ncia artificial ap&#xF3;s mais de 50 intera&#xE7;&#xF5;es</p><p class="medium-feed-link"><a href="https://medium.com/@tomahock/o-fogos-pt-n%C3%A3o-devia-existir-fd321ab3bf40?source=rss-ac67aecb3381------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@tomahock/o-fogos-pt-n%C3%A3o-devia-existir-fd321ab3bf40?source=rss-ac67aecb3381------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd321ab3bf40</guid>
            <dc:creator><![CDATA[tomahock]]></dc:creator>
            <pubDate>Tue, 12 May 2026 08:07:39 GMT</pubDate>
            <atom:updated>2026-05-12T08:07:39.739Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Censos, CNPD, CDNs e outras tretas]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/moli%C3%A7o/censos-cnpd-cdns-e-outras-tretas-7537b284e9a7?source=rss-ac67aecb3381------2"><img src="https://cdn-images-1.medium.com/max/1300/1*1OokcCl20mtyKgfR1rpZPw.jpeg" width="1300"></a></p><p class="medium-feed-snippet">A Comiss&#xE3;o Nacional de Protec&#xE7;&#xE3;o de Dados emitiu recentemente uma delibera&#xE7;&#xE3;o para o INE desligar no prazo de 12h o CDN que lhe suporta&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/moli%C3%A7o/censos-cnpd-cdns-e-outras-tretas-7537b284e9a7?source=rss-ac67aecb3381------2">Continue reading on Moliço »</a></p></div>]]></description>
            <link>https://medium.com/moli%C3%A7o/censos-cnpd-cdns-e-outras-tretas-7537b284e9a7?source=rss-ac67aecb3381------2</link>
            <guid isPermaLink="false">https://medium.com/p/7537b284e9a7</guid>
            <category><![CDATA[cdn]]></category>
            <category><![CDATA[ine]]></category>
            <category><![CDATA[cnpd]]></category>
            <category><![CDATA[cloudflare]]></category>
            <category><![CDATA[censo]]></category>
            <dc:creator><![CDATA[tomahock]]></dc:creator>
            <pubDate>Wed, 28 Apr 2021 13:20:25 GMT</pubDate>
            <atom:updated>2021-04-28T15:59:50.501Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[CM Nelas remove imagem de artigo no site]]></title>
            <link>https://medium.com/moli%C3%A7o/cm-nelas-remove-imagem-de-artigo-no-site-42f58ac40c24?source=rss-ac67aecb3381------2</link>
            <guid isPermaLink="false">https://medium.com/p/42f58ac40c24</guid>
            <dc:creator><![CDATA[tomahock]]></dc:creator>
            <pubDate>Fri, 27 Mar 2020 12:18:07 GMT</pubDate>
            <atom:updated>2020-03-27T14:00:21.381Z</atom:updated>
            <content:encoded><![CDATA[<p>Há <em>posts</em> que preferia não ter de os fazer. Este é um deles. Por diversos motivos: seja pela situação que actualmente vivemos, seja por aquilo que relato nesta publicação. Numa situação normal, também não publicaria este <em>post</em>. Mas dada a natureza daquilo que descobri, não me dão outras alternativa senão expor aquilo que a CM Nelas anda a fazer.</p><p>Vivemos numa altura onde não pode haver desconfianças nem mentiras por parte das autoridades. É imprescindível que as autoridades sejam transparentes.</p><p>Esta publicação é uma análise técnica, com provas cabais registadas por entidades idóneas que não podem de maneira nenhuma ser colocadas em causa por adulteração do que quer que seja. Por isso, vou também tentar fazer com que o meu discurso seja o menos técnico possível, para que a compreensão seja transversal a todos os leitores.</p><p>Por esta altura já <a href="https://www.publico.pt/2020/03/26/local/noticia/cerca-25-pessoas-quarentena-nelas-1909606">todos</a> <a href="https://expresso.pt/coronavirus/2020-03-26-Covid-19.-Responsavel-da-Camara-de-Nelas-veio-de-Espanha-e-furou-quarentena">temos</a> <a href="https://www.jn.pt/local/noticias/viseu/nelas/estar-positivo-nao-faz-de-mim-um-assassino-diz-chefe-de-gabinete-da-camara-de-nelas-11990387.html">conhecimento</a> da situação provocada pelos agentes da CM Nelas no contexto da COVID19.</p><p>Contudo surgiu um ponto numa das comunicações da CM Nelas que me deixou com a pulga atrás da orelha.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*DZ3oebX-lmg7_D6OZRWJIA.png" /><figcaption>Fonte: <a href="https://www.facebook.com/municipio.nelas/posts/2970709239618678">Facebook CM Nelas</a></figcaption></figure><p>Tendo acompanhado todas as publicações da CM Nelas, tanto no Facebook como no site, tinha uma vaga ideia de ter visto uma foto da pessoa em questão num desses conteúdos. Fui então percorrer todos os conteúdos e não é o meu espanto por não encontrar nenhuma foto.</p><p>Decidi então fazer uma investigação mais técnica e aprofundada.</p><p>O <em>site</em> da CM Nelas é feito com recurso a uma tecnologia chamada WordPress. O WordPress é um gestor de conteúdos em código aberto. É dos sistemas mais usados em todo o Mundo. Sendo uma tecnologia bastante popular, os seus detalhes de implementação técnica estão amplamente <a href="https://developer.wordpress.org/rest-api/">documentados</a> pela Internet fora.</p><p>Por norma esta tecnologia expõe publicamente uma <a href="https://pt.wikipedia.org/wiki/Interface_de_programa%C3%A7%C3%A3o_de_aplica%C3%A7%C3%B5es">API</a> (Application programming interface ou como quem diz, uma interface que expõe uma série de funções que permite obter os conteúdos do site de uma maneira estruturada para serem facilmente utilizados noutros contextos).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OQbl_plHfsm9ShbhldsBbg.png" /></figure><p>Foi então que comecei a explorar a <em>função </em>do próprio <em>site</em> da CM Nelas que mostra todos as fotos publicadas no seu website e encontrei esta foto:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6iV3emlCyO_HGZYx2REsBQ.jpeg" /></figure><p>Esta foto tem o identificador único no site 18143 e estava disponível no endereço <a href="https://www.cm-nelas.pt/wp-content/uploads/reuniao-municipal-sobre-coronavirus-covid-19-5.jpg">https://www.cm-nelas.pt/wp-content/uploads/reuniao-municipal-sobre-coronavirus-covid-19-5.jpg</a> (Sim, “estava” mas já não está. Mas já lá vamos). Isto significa que toda a informação da foto estava disponível no <em>link</em> <a href="https://www.cm-nelas.pt/wp-json/wp/v2/media/18143">https://www.cm-nelas.pt/wp-json/wp/v2/media/18143</a></p><p>Antes do link ter sido removido, guardei todo esse conteúdo aqui: <a href="https://pastebin.com/UgfX8Cqx">https://pastebin.com/UgfX8Cqx</a></p><p>Comecemos a analisar estes dados:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*j6geAI9kRcHhqWXO_Js3pg.png" /></figure><p>Esta informação indica que a fotografia foi publicada no dia 12 de Março, pelas 20 horas, 32 minutos e 35 segundos.</p><p>Logo a seguir temos o <a href="https://pt.wikipedia.org/wiki/Exchangeable_image_file_format">EXIF</a> da imagem. O EXIF é um conjunto de metadados que a própria máquina fotográfica insere no ficheiro da fotografia quando ela é tirada.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*uxqMSFzokMfORXpJBTirTw.png" /></figure><p>Estão a ver ali o campo `created_timestamp` que tem o valor 1584037189? Um <a href="https://pt.wikipedia.org/wiki/Marca_temporal"><em>timestamp</em></a><em> </em>é o número de segundos que passaram desde 1 de Janeiro de 1970 até a foto ter sido tirada. Mas não precisamos de ir fazer grandes contas. Há muitos <a href="https://www.epochconverter.com/">sites</a> que fazem essa conta por nós:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W7GcfcKzgjiv4ThTSwpx6g.png" /></figure><p>Com esta informação podemos concluir com certeza que a foto foi tirada a 12 de Março pelas 18:19. Contudo a foto neste momento não aparece em nenhum conteúdo do <em>site</em>, embora como já tenha dito, tinha uma vaga ideia que a foto estava num <em>post</em>.</p><p>Voltemos atrás e relembremos a informação do <a href="https://pastebin.com/UgfX8Cqx">https://pastebin.com/UgfX8Cqx</a> que entretanto foi apagado. Vejamos também a <a href="https://developer.wordpress.org/rest-api/reference/media/">documentação do WordPress</a> para sabermos que funcionalidades temos ao nosso alcance para investigar ainda mais.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bjOT00iGt6qS4pyawm502Q.png" /></figure><p>Isto indica que, na informação que temos da imagem, conseguimos identificar a publicação original ao qual esta estava associada. Por outras palavras, a fotografia foi publicada num <em>post</em> com o identificador 18138.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*cinTNO6gXKy7NBlGqNeSlg.png" /></figure><p>Uma vez mais vamos, e utilizando ainda as funcionalidades do WordPress, vamos pedir ao site que nos dê o post com este identificador único 18138: <a href="https://cm-nelas.pt/?p=18138">https://cm-nelas.pt/?p=18138</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WsPHrWxnLC_-JN7YX5nGlg.png" /></figure><p>Este endereço é reencaminhado para <a href="https://www.cm-nelas.pt/comissao-municipal-de-emergencia-de-protecao-civil-de-nelas-realizou-hoje-reuniao-de-trabalho-sobre-o-coronavirus-covid-19/">https://www.cm-nelas.pt/comissao-municipal-de-emergencia-de-protecao-civil-de-nelas-realizou-hoje-reuniao-de-trabalho-sobre-o-coronavirus-covid-19/</a></p><p>Neste link vemos a publicação original onde estaria a fotografia, se não tivesse sido removida. Felizmente para nós, a remoção da fotografia deixa pistas para continuarmos a nossa investigação.</p><p>Por esta altura já temos mais do que provas que a imagem foi removida de um post, sabemos que post é esse, sabemos o contexto do post, sabemos em que dia e hora foi tirada a foto e por fim sabemos que não bate certo com o que a CM Nelas publicou no seu Facebook.</p><p>Para que não seja posta em causa a veracidade do EXIF exposto pelo WordPress, vamos ver o EXIF que está associado à própria imagem:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*6EfTSv22PrWrmyPr84gcqg.png" /></figure><p>Para que não restem mesmo dúvidas da veracidade desta informação do EXIF, vamos olhar para o EXIF de outras fotos que estão nesse post:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*IopiwEshxakprGRbfQkmEQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*GpEjQeULLlan4Ce-jDePrg.png" /></figure><p>Facilmente conseguimos perceber que estas fotos foram tiradas com a mesma máquina fotográfica com uma diferença de algumas horas da primeira foto.</p><p>Outro pormenor interessante: já viram como se chama a imagem?</p><blockquote>reuniao-municipal-sobre-coronavirus-covid-19–5.jp</blockquote><p>Título descritivo e com numeração sequencial de outras imagens do post em questão.</p><p><strong>Nota: </strong>é também preciso ver as imagens. Não são as mesmas pessoas na reunião. Assumo que são reuniões distintas, com pessoas distintas, realizada a horas distintas mas no dia 12 de Março. Não sei o teor das reuniões. Mas aquilo que a CM Nelas afirma é que:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*DZ3oebX-lmg7_D6OZRWJIA.png" /></figure><p>Por 3 vezes mandei mensagem à CM Nelas a pedir explicações sobre a foto. Por 3 vezes a mensagem foi marcada como lida mas não obtive resposta. Por 3 vezes dei oportunidade à CM Nelas de esclarecer este equívoco. Por 3 vezes não obtive qualquer resposta.</p><p>A CM Nelas leu as mensagens. E agiu naquilo que acreditava ser a melhor maneira de se proteger. Na primeira mensagem apenas enviei a foto e pedi mais contexto. Passado umas horas da mensagem ter sido lida enviei mais contexto. Expliquei que a foto estava no site da CM Nelas e indiquei em que post esteve publicada (neste momento a foto já tinha sido removida do post).</p><p>Depois desta segunda mensagem, a CM Nelas removeu completamente a foto dos arquivos e toda o seu rasto de que aqui falo foram removidas.</p><p>Como este seria o comportamento previsível de quem tem algo a esconder, guardei todas estas páginas, com as provas que aqui apresento e sustentam os meus argumentos, com recurso ao WebArchive. O WebArchive é uma organização sem fins lucrativos, que guarda os conteúdos de páginas web, com indicação de dia e hora. Neste caso, é uma entidade idónea, completamente isenta, que não manipula os conteúdos que recolhe. É por isso, uma ferramenta bastante útil e respeitada pela comunidade. E por isso deixo aqui o link mais relevante para que todos possam validar o que aqui digo:</p><p><a href="https://web.archive.org/web/20200326184841/https://www.cm-nelas.pt/wp-json/wp/v2/media/18143">https://web.archive.org/web/20200326184841/https://www.cm-nelas.pt/wp-json/wp/v2/media/18143</a></p><p>Mais poderia dizer. Mas vou concluir este <em>post</em> com <strong>factos</strong>:</p><ul><li>A CM Nelas publicou num post uma foto que mais tarde veio a remover.</li><li>A CM Nelas quando confrontada com isso foi tentar remover aquilo que não removeu na primeira vez.</li><li>A CM Nelas comunicou que a pessoa em questão não participou em nenhuma reunião de Câmara.</li><li>A pessoa em questão participou em outras reuniões na Câmara</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42f58ac40c24" width="1" height="1" alt=""><hr><p><a href="https://medium.com/moli%C3%A7o/cm-nelas-remove-imagem-de-artigo-no-site-42f58ac40c24">CM Nelas remove imagem de artigo no site</a> was originally published in <a href="https://medium.com/moli%C3%A7o">Moliço</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Global Media Group — From AXFR to hypothetical RCE]]></title>
            <link>https://medium.com/moli%C3%A7o/global-media-group-from-axfr-to-hypothetical-rce-647eab5d439f?source=rss-ac67aecb3381------2</link>
            <guid isPermaLink="false">https://medium.com/p/647eab5d439f</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[tomahock]]></dc:creator>
            <pubDate>Mon, 04 Feb 2019 16:32:00 GMT</pubDate>
            <atom:updated>2019-02-04T21:29:38.789Z</atom:updated>
            <content:encoded><![CDATA[<h3>Global Media Group — From AXFR to hypothetical RCE</h3><p>Portuguese news media publishers are making an online revolution. They all got together and created <a href="http://nonio.net/">Nonio</a>. All of their content will be behind a wall and you will be required to sign in on Nonio in order to access the content. By signing in, you are agreeing with user data tracking, user data selling, bubble-filter effect and other questionable stuff from a privacy point of view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/193/1*g_gv8jI6zKjYEU7BX4PZng.png" /><figcaption>Nonio facepalm</figcaption></figure><p>As you can guess I’m obviously against this Nonio non sense. And I’ve created my own <a href="http://nonio.pt/">Nonio website</a>. But this doesn’t mean that this service should be insecure, after all it will have data from millions of Portuguese citizens. So I started to check if there is something publicly available that shouldn’t be.</p><p>What is that thing that must be publicly available for the internet to work as we know it? That’s right: it’s DNS! Humans fail, and sometimes we humans fail hard! And you have probably used a subdomain to reach to your data dashboard, servers monitoring system or just a shortcut to access something. You are probably a smart guy and you <em>namespaced </em>that kind of subdomains with something like dashboard.bk.example.com or some more creative things to be harder to find it dash.hidden.lel.example.com. Sometimes you just need to <em>geo-namespace </em>router.lisbon.example.com or vpn.porto.example.com. It’s also common to segment some networks. frontend-network.fe-cnx-lis01.example.com or just to reach some servers fe01-js-static.example.com. We have seen it all! And even weirder things!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*ZPZ4p9-6iOckmolQyfNoFQ.png" /><figcaption><a href="http://ithare.com/advocating-obscurity-part-iii-code-obfuscation-basics/">http://ithare.com/advocating-obscurity-part-iii-code-obfuscation-basics/</a></figcaption></figure><p>What’s the point of last paragraph? We will get there. But just a friendly reminder, <strong>if you rely on obfuscation techniques as a security tactic you are doing it wrong</strong>!</p><p>Back to Nonio! One of the first things that I do when searching for <em>weird </em>things it’s a DNS enumeration. I usually use a tool named <a href="https://github.com/guelfoweb/knock">Knockpy</a>. Since this is a Portuguese service I have my own dictionary with words that I have been seeing in the last years.</p><p><a href="https://github.com/guelfoweb/knock">Knockpy</a> is a cool tool! It does a bunch of things including trying to dig AXFR the domain! And the moment I ran knockpy to nonio.net it downloaded the entire DNS zone from Nonio.net. It <a href="https://molico.tomahock.com/from-axfr-transfer-to-source-code-from-multiple-platforms-3cc8974e8c32">has been a while</a> since I’ve seen a AXFR working! If the <a href="https://molico.tomahock.com/from-axfr-transfer-to-source-code-from-multiple-platforms-3cc8974e8c32">last time</a> I found something cute, this time I think I found something awesome :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*BV6Qi1_9wqEVz7qNul5gUw.jpeg" /></figure><p>Nonio.net have 4 different nameservers. So I tried the dig command:</p><blockquote>dig axfr nonio.net @ns1.ci-media.pt</blockquote><p>And nothing.. So let’s go to the next one</p><blockquote>dig axfr nonio.net @ns2.ci-media.pt</blockquote><p>And… success!</p><p>Using <a href="https://securitytrails.com/list/ns/ns2.ci-media.pt">SecurityTrails</a> I was able to know other domains that I had permission to download the DNS Zone. And again with <a href="https://securitytrails.com/list/ip/80.251.161.203">SecurityTrails</a> I was able to find some other DNS servers working on the faulty servers. Back to <a href="https://securitytrails.com/domain/dns1.tsf.pt/dns">Security Trails </a>I had dozens of domains that I was able to download the DNS Zone!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/222/1*lqxZgOXor4aqOKWTOxT9FA.png" /><figcaption>Some domains that were vulnerable to DNS Zone transfer</figcaption></figure><p>If you are naive you would think that this is completely harmless, after all it’s just a bunch of domains, TTLs, IPs or other values but is not that simple!</p><p>In some other breaking news Google is your best friend (if you are searching or if you are hiding but using a proper robots.txt).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*7dfmty_L3E4XeFCaGKMHbA.jpeg" /></figure><p>Soooo how could some harmless strings could lead to possible RCE? Let’s back to that non sense paragraph above.</p><p>Imagine that you set on your server some gibberish as hostname. Like `asd723` and you create a DNS record to this server ip: asd723.bk.example.com X.X.X.X. This will appear on your DNS Zone. Since this is some gibberish you will have some problem finding it, no dictionary entry will match this when you go home you will sleep well because nobody will find your server except.. when you forgot to deny axfr requests!</p><p>Now that you have a gibberish hostname what are you suppose to do? GOOGLE IT!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*SK3TB8z5-fXTaFAdlQZi4w.png" /><figcaption>Google Search for gibberish hostname</figcaption></figure><p>At this point we only use public available information. Without any real ‘hacking’ technique. And it’s probably good advise to don’t go further. But what the hell, we just saw the google search results and we know what a Cacti is :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_-vjb8pN3kXSYiLv6i4qRA.png" /><figcaption>Open Cacti</figcaption></figure><p>Although this was not hosted on Global Media Group servers this was probably a third party contractor that exposed all GMG servers and informations and this was the moment I stopped!</p><p>From different fingerprints I was able to pinpoint Cacti’s version and <a href="http://bfy.tw/M7z0">very quickly find an exploit</a> to abuse a remote code execution vulnerability, that of course I didn’t even try :)</p><p><em>Vulnerability Disclosure Timeline:</em></p><ul><li>30 January 2019 — Vulnerability found and disclosed to Global Media Group</li><li>31January 2019 — Problems Fixed.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=647eab5d439f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/moli%C3%A7o/global-media-group-from-axfr-to-hypothetical-rce-647eab5d439f">Global Media Group — From AXFR to hypothetical RCE</a> was originally published in <a href="https://medium.com/moli%C3%A7o">Moliço</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to implement the ultimate voting system to mitigate fraud]]></title>
            <link>https://medium.com/moli%C3%A7o/how-to-implement-the-ultimate-voting-system-to-mitigate-fraud-e4e3b1f04297?source=rss-ac67aecb3381------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4e3b1f04297</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[tomahock]]></dc:creator>
            <pubDate>Tue, 04 Dec 2018 17:33:17 GMT</pubDate>
            <atom:updated>2018-12-04T17:33:17.128Z</atom:updated>
            <content:encoded><![CDATA[<p>Making a voting system is hard. Specially if the votes are anonymous without asking the users to create an account and confirm their emails. Personally, I refuse to vote on websites that require my email to do so. I prefer not to vote, and just leave. We live in a privacy concerned era, and the webmasters need to retain the users while also protecting their privacy. On this article, I will talk about some tactics to mitigate voting fraud</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*caX1-19Suujgo1rTyP8V9A.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/T9CXBZLUvic?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Element5 Digital</a> on <a href="https://unsplash.com/search/photos/voting?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Every year, <a href="http://www.portoeditora.pt/">Porto Editora</a> promotes a poll to choose the <a href="https://www.palavradoano.pt/">Word of the Year</a> in Portugal. In a few minutes, I was able to write a <a href="https://pastebin.com/gcz9sE9P">script</a> to manipulate the votes to elect my preferred word of the year. Meanwhile, “someone” made a bash script that even fits on a single tweet.</p><blockquote>SESSID=`curl -I -s ‘<a href="https://www.palavradoano.pt/&#39;">https://www.palavradoano.pt/&#39;</a> | grep ‘Set-Cookie’| awk -F ‘PHPSESSID=’ ‘{print $2}’ | awk -F ‘;’ ‘{print $1}’`; curl -v ‘<a href="https://www.palavradoano.pt/vote/99&#39;">https://www.palavradoano.pt/vote/99&#39;</a> -X POST -H ‘X-Requested-With: XMLHttpRequest’ -H “Cookie: PHPSESSID=$SESSID;” -H ‘Referer: <a href="https://www.palavradoano.pt/&#39;">https://www.palavradoano.pt/&#39;</a>;</blockquote><p>Let’s get down to business: how do we avoid this type of fraud? Remember that, due to privacy concerns, we don’t want to have any private user information.</p><p>There are two services that you can use that will mitigate most of the attacks:</p><h3>Captcha</h3><p><strong>C</strong>ompletely <strong>A</strong>utomated <strong>P</strong>ublic <strong>T</strong>uring test to tell <strong>C</strong>omputers and <strong>H</strong>umans <strong>A</strong>part. We all came across the annoying window to validate if we are a robot or not. Typing some letters, words, sentences or just choose pictures with cars, crosswalks or other things.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FfsF7enQY8uI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DfsF7enQY8uI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FfsF7enQY8uI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6828f42f84826aca5c5e349ce7c81477/href">https://medium.com/media/6828f42f84826aca5c5e349ce7c81477/href</a></iframe><p>While this is a good service to avoid bots and other automation strategies it does not completely prevent fraud. A malicious actor can <a href="https://andresriancho.com/recaptcha-bypass-via-http-parameter-pollution/">find a security vulnerability</a> to bypass the Captcha service or can just <a href="https://anti-captcha.com/">pay someone</a> to solve captchas in real time.</p><p>A good alternative to tradicional Captchas is the Proof of Work Captchas. Where you force your user’s browser to solve a cryptographic puzzle while you won some cash. <a href="https://hashcash.io/">HashCash</a> is an example of a service that offers this kind of solution. The idea behind this concept it’s to add an adicional layer of required resources (CPU/RAM) to solve this puzzle.</p><h3>Cloudflare</h3><p>Cloudflare offers an awesome service that you can use for a bunch of different use cases. In this case we are using “<a href="https://www.cloudflare.com/security/malicious-bot-abuse/">Block Malicious Bot Abuse</a>” feature.</p><p>With this we expect to mitigate brute force attacks, IP changes or even when the attackers try to go through TOR to reach our server and hide/change their IP.</p><p>Once again, there are a <a href="https://blog.christophetd.fr/bypassing-cloudflare-using-internet-wide-scan-data/">handful</a> <a href="http://www.crimeflare.org:82/cfs.html#box">of</a> <a href="https://github.com/HatBashBR/HatCloud">tactics</a> to try to bypass Cloudflare service. Sometimes you can also check for the MX records or SPF records to get some IPs. Once the attacker is able to get an IP, he could just add it to /etc/hosts and point the target domain to that IP.</p><p>So if you use Cloudflare configure your webserver to just accept <a href="https://www.cloudflare.com/ips/">connections from Cloudflare servers</a>.</p><p>While combining the two services you will have a good mitigation layer. But in my opinion this is not enough. So let’s go deeper!</p><h3>CSRF</h3><p><strong>C</strong>ross-<strong>S</strong>ite <strong>R</strong>equest <strong>F</strong>orgery. If you are a developer and you don’t know what is a CSRF Token or what is a <a href="https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)">CSRF attack</a> you are probably doing something very wrong.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*2_Buw52ECBlDa3CBF-hFag.png" /><figcaption>CSRF scenario by <a href="https://medium.com/u/9ccbf86ece14">Charithra Kariyawasam</a> <a href="https://medium.com/@charithra/introduction-to-csrf-a329badfca49">https://medium.com/@charithra/introduction-to-csrf-a329badfca49</a></figcaption></figure><p>Without a CSRF a malicious actor can place a few lines of code in a compromised website and every visitor of that website could vote even without him know what is doing.</p><p>Nowadays with technologies like <a href="https://developers.google.com/web/updates/2017/04/headless-chrome">Chrome-headless</a> we can automate some bot to render the pages and grab the CSFR token to make thousands of legit requests.</p><h3>Throttling</h3><p>Throttling is a standard countermeasure on the web. But while we don’t have a wider adoption of IPV6 we need to be careful how to throttle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*5ouCk8SgEQg84U1pmxyHZA.jpeg" /></figure><p>If you are familiar with <a href="https://en.wikipedia.org/wiki/Network_address_translation">NAT</a> by now you realize why I’m saying that we need to be careful. Imagine that you work in a crowded office. It’s normal that all the connections from all the people on your office came from the same IP(V4). So while throttling is a good strategy to block bulk requests use it wise or else you are going to block an entire office, a university or other network used by lots of legit people.</p><h3>Browser fingerprint</h3><p>Did you know that your browser exposes a lot of your system information?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ch2AQ5yXRU3f2YEXNyPMLQ.jpeg" /><figcaption>From <a href="https://medium.com/u/377aff806f8e">useradd_deploy</a> article <a href="https://medium.com/@useradd_deploy/whats-my-fingerprint-b8df1d8e3293">https://medium.com/@useradd_deploy/whats-my-fingerprint-b8df1d8e3293</a></figcaption></figure><p>The goal of the browser fingerprint it’s to grab enough information that your browser expose in order to identify you and only you. You know, like a fingerprint that only you have.</p><p>While this is a smart strategy I would say that right now it’s impossible to have a unique worldwide fingerprint per browser. If you work in a corporate office that everyone has the exact same computer model and specs the fingerprint will be pretty much the same.</p><p>You can check your browser fingerprint <a href="https://amiunique.org/">here</a>.</p><p>This, with the throttling techniques could be another strategy to mitigate the voting fraud.</p><p>Even if you apply all the strategies above I can not guarantee that you cover all types of attacks but you will give a hard time to the person that wants to manipulate your voting.</p><p>Special thanks to <a href="https://brpx.com/">Bright Pixel</a> slack room where we argue about these techniques. Also if you are concern about your website security, check <a href="https://probely.com/">Probe.ly</a> service. A startup incubated at Bright Pixel.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4e3b1f04297" width="1" height="1" alt=""><hr><p><a href="https://medium.com/moli%C3%A7o/how-to-implement-the-ultimate-voting-system-to-mitigate-fraud-e4e3b1f04297">How to implement the ultimate voting system to mitigate fraud</a> was originally published in <a href="https://medium.com/moli%C3%A7o">Moliço</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Falha permite envio de falsos emails em mais de uma centena de domínios .gov.pt]]></title>
            <link>https://medium.com/moli%C3%A7o/falha-permite-envio-de-falsos-emails-em-mais-de-uma-centena-de-dom%C3%ADnios-gov-pt-9f85f84001c4?source=rss-ac67aecb3381------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f85f84001c4</guid>
            <dc:creator><![CDATA[tomahock]]></dc:creator>
            <pubDate>Thu, 27 Apr 2017 20:16:41 GMT</pubDate>
            <atom:updated>2017-04-27T20:30:11.609Z</atom:updated>
            <content:encoded><![CDATA[<p>TL;DR: Falta de configurações de segurança permite enviar emails de domínios .gov.pt entre outros. Situação mantém-se 149 dias depois do primeiro contato a reportar o problema.</p><p><em>Este texto foi inicialmente escrito no início de Dezembro passado, mas passados tantos meses, foi completamente rescrito!</em></p><h3><strong>Enquadramento</strong></h3><p>A <a href="http://observador.pt/2016/11/17/notificacoes-das-financas-e-da-seguranca-social-vao-poder-ser-enviadas-por-email/">17 de Novembro foi aprovada em Conselho de Ministros</a> que a Segurança Social notifique os cidadão por via eletrónica.</p><p>Desde o primórdio das internets há sempre alguém a tentar <em>impersonar</em> outras pessoas. <a href="https://emkei.cz/">É muito fácil enviar um email em nome de outra pessoa</a>.</p><p>Com o tempo foram surgindo mecanismos para mitigar este tipo de problemas. Em 2000 surgiu o <a href="https://en.wikipedia.org/wiki/Sender_Policy_Framework"><strong>SPF</strong></a><strong>, </strong>em 2004 o <a href="https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail"><strong>DKIM</strong></a><strong> </strong>e em 2011 o <a href="https://en.wikipedia.org/wiki/DMARC"><strong>DMARC</strong></a>. Nenhum deles sozinho resolve totalmente este problema e usar todos os mecanismos em conjunto é o melhor método para o mitigar ao máximo. Sendo que a protecção básica que mais se encontra configurada é o SPF.</p><h3>Descoberta</h3><p>Fui ver a minha caixa de email e encontrei algumas notificações tanto da <strong>Segurança Social</strong> como da <strong>Autoridade Tributária</strong>.</p><p>Tentei então enviar emails como se fossem da SS, do mesmo remetente que habitualmente saem as notificações, o email <strong>ISS-NoReply@seg-social.pt</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*lHq4No3dT_5yU9d9iEnG1g.png" /><figcaption>Página para enviar email em nome de outra pessoa</figcaption></figure><p>Nestes casos, é suposto o <strong>email não ser enviado</strong> ou então ser <strong>marcado como SPAM</strong>. Mas isso não é o que acontece!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XjDBSK_4DwEHMbKzx7cDMQ.png" /><figcaption>Caixa de entrada no Gmail.</figcaption></figure><p>E assim se consegue enviar um email a fazer-se passar pela Segurança Social!</p><p>Felizmente este comportamento não é global a todos os clientes de email. Mas o <a href="http://blog.mailchimp.com/major-email-provider-trends-in-2015-gmail-takes-a-really-big-lead/"><em>provider</em> de email mais usado no mundo</a> não marca como SPAM o que faz com que haja um elevado número de potenciais alvos.</p><h3>Responsible disclosure</h3><p>Como qualquer outro problema de segurança que encontro, tentei reportar, mas sem saber muito bem a quem, descobri entidades como o <a href="https://www.gns.gov.pt/">GNS</a>, <a href="http://www.ceger.gov.pt/">CEGER</a>, <a href="https://www.cncs.gov.pt/">CNCS</a> até que fui parar ao <a href="https://www.cncs.gov.pt/certpt/">CERT.pt</a>. O CERT.pt é uma <a href="https://en.wikipedia.org/wiki/Computer_emergency_response_team">equipa de resposta de emergências informáticas</a>.</p><p>Todas estas entidades foram contactadas. Uma encaminhou para outra e, por fim, o CERT.pt, depois de 3 contactos, respondeu que estava a “acompanhar as diligências” para resolver o problema.</p><p>Passados 104 dias desde o primeiro contacto fiz um novo <em>ping</em>. Não tendo visto qualquer tipo de correcção, seguindo as <em>guidelines</em> do <a href="https://www.cert.org/">CERT.org</a> indiquei ao CERT.pt que iria reportar publicamente o problema em 45 dias.</p><h3>Investigação</h3><p>Sem ter percebido bem a dimensão do problema, fiquei curioso sobre a sua real extensão.</p><p>Para isso, “descobri” <strong>190 domínios .gov.pt válidos</strong>, com algum tipo de entrada de <a href="https://en.wikipedia.org/wiki/Domain_Name_System">DNS</a>. E percorri todos esses domínios para encontrar 42 domínios com registos SPF e <strong>148 domínios sem qualquer tipo de registo SPF</strong>.</p><p>Enviei também este estudo para o CERT.pt. Até hoje apenas uma única resposta sobre este assunto apesar de manter conversas paralelas sobre outros problemas encontrados.</p><h3>A data</h3><p>Há 149 dias desde que o problema foi reportado, e 45 dias desde que indicado que iria ser publicado. <strong>Não foi feita qualquer correcção e ainda é possível enviar emails de mais de uma centena de domínios .gov.pt entre outros.</strong></p><h3>Evitar</h3><p>Por diversos motivos e entidades é cada vez mais natural recebermos comunicações por emails. Ao mesmo tempo há cada vez mais ataques de <a href="https://en.wikipedia.org/wiki/Phishing"><em>phishing</em></a> e cada vez mais sofisticados.</p><p>Não existe nenhuma receita, ou nenhuma maneira de conseguir validar se um email é realmente uma comunicação oficial ou se um ataque de phishing, mas olhar para o <em>Email Original</em> e ver os <em>headers,</em> domínios que possam parecer estranhos são de certeza <em>maus!</em></p><h3><strong>Público? Porquê?</strong></h3><p>Tecnicamente este problema demora não mais de 5 minutos a ser resolvido. Já depois do primeiro contacto surge na “<a href="http://www.cmjornal.pt/economia/detalhe/20170329_2207_autoridade-tributaria-alerta-para-falsas-mensagens-de-email-a-cobrar-dividas?ref=HP_Grupo1">comunicação social</a>” avisos da Autoridade Tributária sobre emails de phishing, apesar de não ter conseguido ver um destes emails para confirmar, existe uma grande probabilidade de este problema já estar a ser explorado.</p><p>Recentemente o Project Zero da Google <a href="https://arstechnica.com/security/2017/02/high-severity-vulnerability-in-edgeie-is-third-unpatched-msft-bug-this-month/">tomou atitude semelhante</a> perante a Microsoft.</p><p>É um incentivo para quebrar a inércia inicial que pode surgir por diversos motivos!</p><h3>Tempo</h3><ul><li>29 Novembro 2016 — Problema encontrado e reportado ao GNS</li><li>30 Novembro 2016 — Problema reportado ao CERT.pt</li><li>9 Dezembro 2016 — Problema reportado ao CEGER</li><li>19 Dezembro 2016 — Novo email para o CEGER GNS e CERT.pt</li><li>19 Dezembro 2016 — Resposta do CEGER</li><li>21 Dezembro 2016 — Resposta do CERT.pt</li><li>13 Março 2017 — Indicação de 45 para a publicação do problema</li><li>29 Março 2017 — Notícia de emails de phishing novo email para o CERT.pt</li><li>17 Abril 2017 — Envio de lista de 149 domínios vulneráveis</li><li>27 Abril 2017 — Public disclosure.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f85f84001c4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/moli%C3%A7o/falha-permite-envio-de-falsos-emails-em-mais-de-uma-centena-de-dom%C3%ADnios-gov-pt-9f85f84001c4">Falha permite envio de falsos emails em mais de uma centena de domínios .gov.pt</a> was originally published in <a href="https://medium.com/moli%C3%A7o">Moliço</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lottapixel -My first 500$ bounty!]]></title>
            <link>https://medium.com/moli%C3%A7o/lottapixel-my-first-500-bounty-d3e678da1861?source=rss-ac67aecb3381------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3e678da1861</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[asana]]></category>
            <category><![CDATA[lottapixel]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[netsec]]></category>
            <dc:creator><![CDATA[tomahock]]></dc:creator>
            <pubDate>Tue, 31 Jan 2017 11:27:32 GMT</pubDate>
            <atom:updated>2017-01-31T11:27:32.175Z</atom:updated>
            <content:encoded><![CDATA[<p>TL;DR: Uploading a specially crafted image (<a href="https://hackerone.com/reports/390">Lottapixel.jpg</a>) throws an error that exposes AWS credentials from <a href="https://asana.com/">Asana</a>!</p><p>First of all I’m a skid! Most of the tools I use to find bugs aren’t made by me! But I keep a good archive of those tools!</p><p>Nowadays almost every site allows an user to upload an avatar and history shows that image upload is an awesome point to attack! The <a href="https://imagetragick.com/">Image Tragick</a> is the most known case of a large scale vulnerability using an image as a vector! So when I’m researching for security vulnerabilities I always try to upload a set of special crafted images that I’ve been collecting for a while!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*iBMRIkjwRmYszeSiQ-ktNw.png" /></figure><p>One of my favourites is the lottapixel.jpg! A little image that I found in a 3 year old report on <a href="https://hackerone.com/reports/390">HackerOne</a>! I’ve seen different behaviours on applications where I’ve uploaded this image! In some it goes without problems, in other cases it just throws a 500 error, in some it causes a small denial of service. I even saw a proxy closing the request after a few minutes! But in this case the application thows a 400 error with a verbose output!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xf_7-3PnIGTzOQui0zhq_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NPIu8xhcILmk1jxL2Bafjw.png" /></figure><p>I immediately recognized that that access key and secret key were from!</p><p>They were something like this:</p><blockquote>AKIAIOSFODNN7EXAMPLE</blockquote><blockquote>wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY</blockquote><p>And they are Access Keys from <a href="https://aws.amazon.com/developers/access-keys/">AWS</a>! I didn’t try to use them but they were probably the keys to access to S3 bucket were Asana keep this kind of assets!</p><p>Wisely, Asana keeps a <a href="https://asana.com/bounty">Bounty Program for responsible disclosure</a> and I reported this problem to them! After confirmation they award me a $500 bounty for this vulnerability!</p><p><em>Vulnerability Disclosure Timeline:</em></p><ul><li>5 December 2016 — Vulnerability found and disclosure to Asana.</li><li>6 December 2016 — Asana confirms the problem and escalate to the Security Team.</li><li>12 December 2016 — Asana confirms the problem is fixed.</li><li>25 January 2017 — Authorization to public disclosure from Asana</li><li>31 January 2017 — Public disclosure.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3e678da1861" width="1" height="1" alt=""><hr><p><a href="https://medium.com/moli%C3%A7o/lottapixel-my-first-500-bounty-d3e678da1861">Lottapixel -My first 500$ bounty!</a> was originally published in <a href="https://medium.com/moli%C3%A7o">Moliço</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open MongoDB instances on Portuguese Universities]]></title>
            <link>https://medium.com/moli%C3%A7o/open-mongodb-instances-on-portuguese-universities-3d2830491f6?source=rss-ac67aecb3381------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d2830491f6</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[university]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[portugal]]></category>
            <dc:creator><![CDATA[tomahock]]></dc:creator>
            <pubDate>Mon, 30 Jan 2017 21:10:34 GMT</pubDate>
            <atom:updated>2017-01-30T21:10:34.300Z</atom:updated>
            <content:encoded><![CDATA[<p>A couple days ago I was on twitter and lot’s of people were talking about open MongoDB instances that were hijacked and the hackers were demanding bitcoins!</p><h3>Victor Gevers on Twitter</h3><p>Open MongoDB = Money 4 bad ppl. SEND 0.2 BTC TO THIS ADDRESS AND CONTACT THIS EMAIL WITH YOUR IP OF YOUR SERVER TO RECOVER YOUR DATABASE !</p><p>I wanted to check for myself if I was able to find some of those MongoDB instances! There are lots of ways that you can find it, but this time I went with the easy one!</p><p><a href="https://www.shodan.io/">Shodan</a> is an awesome place to easily find open stuff across the web! And I used it to find what I wanted! Shodan is a search engine of devices connected to the internet and you can search by country, open ports, operating system and lots of other filters.</p><p>MongoDB by default runs on port 27017 and also by <a href="https://docs.mongodb.com/manual/reference/configuration-options/#net.bindIp">default it binds only on localhost </a>aka 127.0.0.1. This means that every single MongoDB instance that can be accessed by a public interface requires specific configuration changes. That isn’t necessarily wrong but also by <a href="https://docs.mongodb.com/manual/tutorial/enable-authentication/">default MongoDB doesn’t enable access control</a>! So let’s <em>hope </em>that the person that changed the configuration also enabled the access control right?!</p><p>Back to Shodan! Since this ‘open MongoDB instances’ <em>is a thing</em> if you search just by MongoDB on Shodan it shows confirmed MongoDB instances and also other juicy information like if the authentication is enabled or number of databases! Something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*HDr0G0tEDy605YYTqJJ3Jw.png" /><figcaption>MongoDB with authentication enabled</figcaption></figure><p>There were a lot more of MongoDB instances without authentication than ones with access control enabled. And in the open ones you can see this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*NrWo0RQid7SDZ6eumeYEAw.png" /><figcaption>Open MongoDB instance</figcaption></figure><p>As usually I searched for Portuguese open MongoDB instances and there were 40++ results!</p><p>But wait! I almost lost my focus! I found one instance that was hijacked!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fMGz18pv7Jaa3z1g2kcBhg.png" /><figcaption>Portuguese MongoDB instance hijacked from PTISP.pt</figcaption></figure><p>It’s time to write about this article title! Shodan shows from which organization is the IP registered and some results really caught me eye! I spoiled it in a image above, but there were some results that were from Universities! Universidade do Minho and Universidade Técnica de Lisboa. No need to say what you can do with an open database! I don’t really know that kind of services are using that MongoDB instances, but this isn’t right!</p><p>I tried to contact <a href="http://cert.pt/">CERT.pt</a> but a few hours later these databases were already hijacked.</p><p>At this point I wanted to make sure that I find all MongoDB instances that belonged to <a href="https://www.fccn.pt/">FCCN</a>. I’m not sure if shodan really scans for all IPs so after <a href="http://bgp.he.net/AS1930">getting a list of IPs that are owned by FCCN</a> I wrote some python lines to scan all these IPs! I was able to find some more MongoDB instances!</p><p>And I even notice something else! If I made lot’s of scan on different hours I was able to find even more MongoDB instances! Why? Well this is an assumption but these volatile instances are always in the same IP block, and this block the netname is registered as ‘UTL-IST-EDUROAM’, Eduroam is the wireless network so these are probably MongoDB instances running in the computers of the students from IST!</p><p>A few days after those MongoDB events, this malware went after ElasticSearch databases! Same concept! Once again using shodan I was able to find some open ElasticSearch instances and once again I found a government related one!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*GZhhRxGkern23NxMp-Flxw.png" /></figure><p>That was already hijacked! \_(ツ)_/¯</p><p>We always should remember that <strong>Security</strong> Through <strong>Obscurity </strong>is not security!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d2830491f6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/moli%C3%A7o/open-mongodb-instances-on-portuguese-universities-3d2830491f6">Open MongoDB instances on Portuguese Universities</a> was originally published in <a href="https://medium.com/moli%C3%A7o">Moliço</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Passing system environment variables to PHP-FPM when using NGINX]]></title>
            <link>https://medium.com/@tomahock/passing-system-environment-variables-to-php-fpm-when-using-nginx-a70045370fad?source=rss-ac67aecb3381------2</link>
            <guid isPermaLink="false">https://medium.com/p/a70045370fad</guid>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[php-fpm]]></category>
            <category><![CDATA[environment]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[tomahock]]></dc:creator>
            <pubDate>Tue, 17 Jan 2017 17:36:15 GMT</pubDate>
            <atom:updated>2017-01-17T17:36:15.566Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometimes it comes in handy to set system environment variables (env var from now on!) and get the PHP to use it for something. My tech stack is usually NGINX+PHP-FPM and if you already tried if you set a env var you probably found that it doesn’t appear on $_SERVER or in the getenv().</p><p>For this article I will be using a php file with this content:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1272ec19c1ca4eff65981eb285d5adf8/href">https://medium.com/media/1272ec19c1ca4eff65981eb285d5adf8/href</a></iframe><p>By now you probably know how to set a env var on, let’s say, a UNIX system (I really don’t know how Windows work, so in this whole article I will assume you use a good operating system!). So it’s something like this:</p><pre>$ export PHP_FOO=bar</pre><p>Using the command line let’s run the previous file and check the result!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*gbiPP-ODYZ5Wpnre2acwpA.png" /></figure><p>Our env var is there! Now let’s check when you make a HTTP request to that same file!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q-oMrncK5yIEsyoiLpXXOw.png" /></figure><p>I removed some information that I don’t want you to see, but trust me, the PHP_FOO isn’t there! Here is how you can pass the env vars to PHP-FPM.</p><p>First find your PHP-FPM pool config file. Try /etc/php/7.0/fpm/pool.d/www.conf but yours could be in other place or have a different name.</p><p>Find this line and uncomment it (remove the ‘;’):</p><pre>;clear_env = no</pre><p>And finally add something like this:</p><pre>env[“PHP_FOO”] = $PHP_FOO</pre><p>Reload your php-fpm and refresh your env.php:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Fmi0T7PM8xZSsuaDXoSuQ.png" /></figure><p>There it is! Our PHP_FOO env var ready to be used!</p><p>But as you can see this configuration change expose lot’s of other informations. Everything that is in the environment of the user that is running the PHP-FPM is exposed here. So use it wisely!</p><p>This article is essentially for me don’t crawl the internet every single time I need this! I’m using this technique to set the environment on Laravel. Setting a APP_ENV env var and during Laravel bootstrap read the .env.$APP_ENV file depending on which server (development, production, etc) the app is running!</p><p>Feel free to comment and suggest any better approach!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a70045370fad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Presidentes do Estado Novo]]></title>
            <link>https://medium.com/fake-news-pt/presidentes-do-estado-novo-572fead26e2f?source=rss-ac67aecb3381------2</link>
            <guid isPermaLink="false">https://medium.com/p/572fead26e2f</guid>
            <category><![CDATA[nj]]></category>
            <category><![CDATA[fakenewspt]]></category>
            <category><![CDATA[fake-news]]></category>
            <dc:creator><![CDATA[tomahock]]></dc:creator>
            <pubDate>Sat, 07 Jan 2017 20:25:04 GMT</pubDate>
            <atom:updated>2017-01-07T20:25:04.694Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="http://www.jn.pt/nacional/interior/governo-decreta-tres-dias-de-luto-nacional-5591887.html">Para o JN tanto António Spínola como o Marechal Costa Gomes foram presidentes da república durante Estado Novo!</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U8Nef7Jp3ivcriWm7zTQOQ.png" /></figure><p>Até a <a href="https://pt.wikipedia.org/wiki/Estado_Novo_(Portugal)">Wikipedia</a> sabe que isto não é verdade!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=572fead26e2f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fake-news-pt/presidentes-do-estado-novo-572fead26e2f">Presidentes do Estado Novo</a> was originally published in <a href="https://medium.com/fake-news-pt">Fake News PT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>