<?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 Sqreen on Medium]]></title>
        <description><![CDATA[Stories by Sqreen on Medium]]></description>
        <link>https://medium.com/@Sqreen?source=rss-71d0a8997c6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tVEPKHMgxFdr3U1OrGFJTg.png</url>
            <title>Stories by Sqreen on Medium</title>
            <link>https://medium.com/@Sqreen?source=rss-71d0a8997c6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 07:30:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Sqreen/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[8 security best practices and guidelines for SaaS startup CTOs]]></title>
            <link>https://medium.com/hackernoon/8-security-best-practices-and-guidelines-for-saas-startup-ctos-6653b8d3eea9?source=rss-71d0a8997c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6653b8d3eea9</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[saas]]></category>
            <dc:creator><![CDATA[Sqreen]]></dc:creator>
            <pubDate>Wed, 13 Mar 2019 18:31:26 GMT</pubDate>
            <atom:updated>2019-05-08T00:47:19.446Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*-6lRUzhKRR3y2M70tWXBUQ@2x.jpeg" /></figure><p>As the technology decision makers for SaaS startups, we CTOs are a burdened lot. We need to constantly balance agility, security, and regulatory compliances. Figuring out the right balance of our time and attention can feel impossible to get right. So what are the security best practices and approaches given our constraints?</p><p>The ideal security for any software system is a perfect blend of application security, infrastructure security (i.e. network security), and operational security. Alternatively, we can look at them as the measures that cover people, processes, and technology. A three-by-three matrix can be drawn from these two approaches addressing all aspects of security.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*u70nZgwUQ0vvDTY_" /></figure><p>However, as we all know, it is impossible to achieve perfect security across all of these vectors.</p><p>A more practical approach would be the creation of a threat model that lists all potential vulnerabilities and all probable attacks for the product. A security plan can then be created around this threat model. However, in a fast-growing SaaS startup, it’s often too time-consuming a task to create, let alone keep updated. So the question becomes, is there a simpler solution that would provide a list of the best practices instead of forcing us to reinvent the wheel each time?</p><p>We at Sqreen set out to create that checklist and analyzed hundreds of SaaS products and their security needs. The result of that exercise is a list that captures the best practices for security across the matrix.</p><p>Let’s start with operational security, as a large percentage of hacks are attributed to human error rather than inherent flaws in the technology itself.</p><h3>Operational — People and Processes</h3><p>People and process measures form the core of operational security practices. They make sure that everyone (customers, employees, and contractors) dealing with the system knows the importance of security measures and practices them as part of their day-to-day activities.</p><h4>1. Protect your employees</h4><p>Social engineering continues to be one of the most <a href="https://www.fifthdomain.com/industry/2018/09/26/social-engineering-attacks-skyrocket-more-than-500-percent/">prevalent hacking methods</a>. Insufficient awareness and preparedness are at the root cause of many victims of social engineering. Below are the best practices to counter these:</p><ul><li>Security training for employees: train your engineers on operational security and on building secure products. Conduct security training especially for the non-engineers, using a service like <a href="https://sudo.pagerduty.com/">https://sudo.pagerduty.com/</a>.</li><li>Create unique accounts for everyone and educate them about the dangers of sharing accounts. Make policies that prevent employees from sharing user accounts.</li><li>Enforce 2FA on all logins: educate your employees about common phishing and vishing (phishing on phone calls) attacks and make sure they are equipped to deal with them when they happen.</li><li>Enforce password managers: password managers help with managing multiple credentials and secure sharing.</li></ul><h4>2. Build a security culture</h4><p>A strong security culture is essential for making your operational security measures stick. The particulars will depend on your broader company culture, but some of the security best practices for infusing security into your culture are:</p><ul><li>Create security champions. Security champions are the folks who encourage and enforce security across the organization. They will be the go-to people for the rest of the organization when dealing with security issues.</li><li>Allow employees some time to focus on security topics. Communicate that it’s a priority.</li><li>Show your customers that security is important to you. Your customers care about the security of the SaaS tools they use. An excellent way to communicate that you recognize this and take security seriously is by having a webpage touting your security practices. If you need a template, we created <a href="https://www.sqreen.com/resources/security-page">an open source security page</a>.</li><li>Adopt a blameless attitude. If someone makes a mistake, you want to know about it as soon as possible, rather than having people hiding it out of fear of blame or punishment.</li></ul><p>And last but not least,</p><h4>3. Hire a dedicated or partially dedicated security resource</h4><p>One of the biggest mistakes that SaaS companies make is waiting too long to hire a security engineer. This causes the security debt to pile up, and as we all know, the later you wait to fix something, the more costly it becomes.</p><p>It is also essential to clearly define the tasks of your first security engineers. At Sqreen, we created a checklist for the first 100 days in the life of a new security engineer. Check it out at <a href="https://www.sqreen.com/checklists/security-engineer-checklist">https://www.sqreen.com/checklists/security-engineer-checklist</a>.</p><h4>4. Protect your customers</h4><p>Ideally, your customers and their employees also should undergo similar training as detailed above. However, a few more things are critical for protecting your customers as well. One of them is account takeover (ATO), wherein a criminal can impersonate your customer and take control of their account. There are many ways an account takeover can happen. The most prevalent one is by getting hold of email IDs and passwords linked to that account. To fight against ATO:</p><ul><li>Educate customers about security and account takeover fraud. In particular, <a href="https://www.nist.gov/blogs/taking-measure/easy-ways-build-better-p5w0rd">ensure they are using a strong enough password</a>.</li><li>Insist on using 2FA and password managers for your platform.</li><li>User logins and passwords are a commodity in the cybercrime world and can be easily obtained. Ask your customers to check sites like <a href="https://haveibeenpwned.com/">https://haveibeenpwned.com/</a> to see if their identities have been compromised and if so, to take corrective measures.</li></ul><p>Account takeovers are not only harmful to customers, but also pose a threat to your SaaS product. They act as privileged entry points for criminals to look for product vulnerabilities. This could potentially give them access to other customer’s accounts or even control of the entire product itself. SaaS products are especially vulnerable to this due to the fact that several important resources are shared between all user accounts.</p><p>Safeguards against ATOs need to be built as part of the product. This can be done by using rate-limiting and brute-force prevention techniques in the code. A simpler approach is to use ATO prevention solutions like Sqreen. At Sqreen, we analyze user behavior and flag compromised accounts in real time. We wrote more about how we do that here: <a href="https://blog.sqreen.com/detecting-human-hackers-app-sqreen/">https://blog.sqreen.com/detecting-human-hackers-app-sqreen/</a></p><p>Now let’s look at the technology side of security. Technology security best practices span application security and infrastructure security aspects. They are explained below.</p><h3>Technology — application security</h3><p>Application security deals with safeguarding the application against well-known attacks and potential zero-day hacks.</p><p>Your SaaS application is the key guardian of your customer data. There are thousands of known vulnerabilities and attacks across different systems, languages, and platforms. It is impossible to protect against them all. Fortunately, there are a handful of attacks that are attempted much more frequently than others, and it is wise to safeguard against them rather than trying to fix every last possible potential vulnerability in your code. Steps five to seven explain the best practices in this regard.</p><h4>5. Protect what matters most</h4><p>One of the main reasons why people attack SaaS products is access to sensitive data. It is therefore important to protect the main application and the database against the well-known attacks in this space.</p><ul><li>Protect against the most common attacks, such as the <a href="https://www.owasp.org/index.php/Top_10-2017_Top_10">OWASP top 10</a>.</li><li>Monitor suspicious security events to act quickly in case of an attack.</li><li>Protect your APIs against injection attacks.</li></ul><h4>6. Don’t use packages with known vulnerabilities</h4><p>Given that most applications nowadays are an integration of various packages and libraries, it is important to make sure that 3rd party software packages do not have known vulnerabilities (CVEs).</p><p>Update all your dependencies with the latest security patches. It is an easy fix and Github can <a href="https://blog.github.com/2017-11-16-introducing-security-alerts-on-github/">help you stay on top of this</a>. At Sqreen, we analyze packages for known vulnerabilities and help you avoid the most exploitable ones.</p><h4>7. Review your code for security bugs</h4><p>Secure coding is a software engineering discipline that can prevent many security bugs from creeping in in the first place. Implementing the secure coding best practices described below can save you huge headaches later on.</p><ul><li>Enforce secure coding guidelines as part of the SDLC, specifically during code reviews. Reviewers need to pay extra attention to the security flaws every time a sensitive part of the code is touched (such as authentication, payment, or rendering).</li><li>Use a good SAST (static application security testing) tool like Brakeman for Ruby or FindBugs for Java. But be aware of the many false positive that these tools generate.</li></ul><h3>Technology — infrastructure security</h3><p>Finally, let’s take a look at the infrastructure/network security which is often considered the backbone of security practices. It addresses hardening of the OS, securing the perimeters, transport security, and IAM (Identity and Access Management).</p><h4>8. Safeguard your infrastructure</h4><p>Most well-known cloud providers have built-in security functionalities, but they need to be used properly to truly enable robust security.</p><p>If you want a better sense of what that looks like, we put together a <a href="https://www.sqreen.com/resources/aws-security">list of AWS security best practices</a>. While this piece is AWS-specific, measures for other cloud providers generally fall into a similar vein.</p><p>In a nutshell, the key considerations are:</p><ul><li>Enforce proper Identity and Access Management roles for all personnel accessing the cloud. Enforce 2FA and a strong password policy.</li><li>Enable firewalls and security groups.</li><li>Configure and backup frequently and systematically. This can be useful for business continuity in case of denial of services attacks and ransomware attacks.</li><li>Enable all logs, and monitor them for suspicious activities.</li><li>Create network boundaries by isolating your infrastructure assets.</li></ul><p>These steps provide an overview for managing the security matrix at your company. However, understanding security best practices and prioritizing them are two different issues. That’s why we <a href="https://www.sqreen.com/checklists/saas-cto-security-checklist">created a checklist</a> that maps these security best practices and more to the stages of the startup lifecycle.</p><p>If you’re interested in learning more about how to implement real-time security monitoring and protection in minutes, set up a <a href="https://www.sqreen.com/demo">demo of Sqreen</a>. We’d be happy to show you what we’ve built.</p><p><em>Originally published at </em><a href="https://blog.sqreen.com/security-best-practices-saas-startups/"><em>https://blog.sqreen.com</em></a><em> on March 13, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6653b8d3eea9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/8-security-best-practices-and-guidelines-for-saas-startup-ctos-6653b8d3eea9">8 security best practices and guidelines for SaaS startup CTOs</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why and How I Switched from Ruby to Python]]></title>
            <link>https://medium.com/hackernoon/how-i-switched-from-ruby-to-python-ac7038015888?source=rss-71d0a8997c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac7038015888</guid>
            <category><![CDATA[ruby-to-python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Sqreen]]></dc:creator>
            <pubDate>Wed, 30 Jan 2019 17:14:08 GMT</pubDate>
            <atom:updated>2019-04-29T19:06:46.935Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*6isbfHTwPFnUSMI8jyRPaA@2x.jpeg" /></figure><blockquote><em>This article is a personal experience shared by </em><a href="https://twitter.com/zetaben"><em>Benoit</em></a><em>, Sqreen’s first engineer who worked on the Ruby agent and on the Python backend.</em></blockquote><p>Back in 2008 when I was still in engineering school, two of my friends decided to start a company called <a href="http://www.feedbooks.com/">Feedbooks</a>. Their goal was to make high-quality ebooks more easily available for people to find, download and share; a digital library that would group together public domain masterpieces, self-published writing, and commercially distributed works.</p><p>The website that allowed them to achieve this goal needed to be fast, efficient and easy to maintain. At the time, having just watched the now famous “<a href="https://www.youtube.com/watch?v=Gzj723LkRJY&amp;feature=youtu.be">how to make a blog in 15 minutes</a>” Ruby on Rails demo video, the founders decided to give it a go and started coding away. A few weeks in, to develop their product as fast as possible, they needed additional help and asked me.</p><p>Like many engineers of my generation, I had previously dabbled quite a bit in PHP &amp; Mysql websites, I had even contributed to a small opensource CMS system. I was familiar with everything web-related but had never even heard of Ruby. So, I watched the video &amp; also fell under the spell of Ruby on Rails. I was hooked on Ruby for the next 10 years and counting. Our group of like-minded friends lent a hand to the library website and also developed quite a few other web apps using the technology.</p><h3>But why Ruby, what’s so great about it?</h3><p>Ruby is a very expressive language. Matz, the main designer of the language, had a very simple goal when creating Ruby: optimize for programmer happiness. To me, this has clearly been achieved. Ruby is an object-oriented scripting language. Every single thing in Ruby is an `Object`. The Ruby virtual machine takes care of translating the very natural looking syntax to actual instruction. This VM is constantly improving and the generated code gets faster with each new version. Objects in Ruby collaborate by sending themselves messages containing a method name and a list of arguments. Ruby also being very easy to introspect, it’s easy to change these messages or create ad-hoc interfaces.</p><p>These make it a very good language to write Domain Specific Languages (DSL) into. That’s precisely what David Heinemeier Hansson (aka DHH) did when he created Rails. Ruby on Rails is, at its core, a collection of DSLs plus a framework to easily generate model-driven web applications. To this day, it’s particularly adapted and good at creating apps where the business logic &amp; modelization will play an important part.</p><p>And so, 6 years later when I joined Sqreen as the first engineer, the logical choice would have been to use Ruby. And yet, when we started Sqreen backend we didn’t go with Ruby but used Python instead.</p><h3>You mean you love Ruby but chose Python for your backend?</h3><p>Why is that?</p><p>First of all the Sqreen backend is actually multiple services exposed (or not) to the world. The first part a new customer sees is our corporate website which is actually a static website (though we do generate it using Jekyll, a Ruby-powered website generator). Then comes our dashboard, conversely it’s an extremely dynamic application, built as a single page app, that is written, after a first foray into Meteor (that’s a blog post for another day!) as a React application. The dashboard communicates with a dedicated API, that we call “backend for frontend”. This isn’t our only API, we have a few others, but by far the most important is our dedicated “backend for agents”.</p><p>We decided early on, that we didn’t want to write APIs in multiple languages so that we could easily reuse business logic code &amp; models across our different APIs. We also envisioned very early that at least the backend for agents should be able to scale quite easily to a high number of concurrent clients as our agents would often ping the backend back.</p><p>Rails being unfortunately quite slow was never really our first choice. Obviously, Rails is not the only way to use Ruby for applications &amp; APIs, there are numerous micro frameworks available in Ruby, the most well known being Sinatra. Sinatra is great, it has a very small and easy to use API and we could have gone for it.</p><p>We chose Python for two reasons. First, the two co-founders JB &amp; Pierre were more familiar with Python, having used it for some internal tooling in their previous lives at Apple. Second and foremost, we have always believed that data analysis would be essential to Sqreen. Ruby is unfortunately not a great help on that account while the Python scientific ecosystem is simply top-notch. The choice was easy, let’s use Python &amp; its very well known micro-framework solution; Flask.</p><h3>Starting out in Python</h3><p>At that point in time, I had only ever dabbled in Python to write small scripts, either to convert &amp; reshape some data or perform calculations. I had to get up to speed using it to create APIs. Fortunately, the web and its base components do not change if you change programming language. HTTP/HTML/JSON are still text-based protocols/languages; REST is still the same. Whatever I learned during my career was still valid, only the way to output it was a bit different. Making applications communicate with the web at a lower level is done in Ruby using a common specification called <a href="https://www.rubydoc.info/github/rack/rack/file/SPEC">Rack</a>. It’s a very simple spec mostly codifying that HTTP Requests &amp; Responses should be expressed using `Array`. It turns out, that Ruby’s Rack is actually very much inspired from an earlier initiative in Python called <a href="https://www.python.org/dev/peps/pep-3333/">WSGI</a>. Good, one big potential hurdle was out of the way.</p><p>But what about the language? Ruby as previously described is an object-oriented scripting language, well python is also an object-oriented scripting language. However, Python is a bit less pure in its approach to the concept. It wasn’t created as an object-oriented language and also supports other paradigms (mainly functional). But, they are still different languages, and so the syntax is quite different. Let’s name a few. Ruby describes blocks using keywords (begin/def end) Python uses whitespaces. This did take a bit of getting used to (and I still personally prefer Ruby’s way). You catch exceptions in Ruby using begin/rescue/end in Python you use try/except. But to me, the biggest change was not being able to do any inline block the way Ruby enables you to pass to many methods (like with `find`, `map`, `inject`…). In modern Python, people can use an inline comprehension to often do the equivalent operation but the syntax gets very messy very fast. This actually forces developers to think more about the number of loops being used and ultimately leads to more efficient code. I also discovered a few new and very thoughtful concepts. Example: context managers in Python enable you to apply clean up behaviors to resources and the actual syntax, again, pushes people to write more efficient code.</p><p>So how did I personally get up to speed in Python syntax? First by practicing using the very nice <a href="https://github.com/gregmalcolm/python_koans">Python Koans</a>. This open source project enables people to learn Python by fixing a set of progressively harder unit tests. They tour the different features of the language and provide an in-action and quite deep tutorial. I then read the Python documentation. Where the Ruby documentation can be terse and sometimes a bit lacking, the Python doc is extremely complete. The language is divided into modules that each have a long explanation generally going into the details of the rationale of why the module exists, which problem it aims to solve, how it solves it and quite often when not to use it! And yes obviously, it also includes examples. It’s a must-read for anybody looking to get into Python. Wait does all of this mean that Sqreen doesn’t use Ruby and that I don’t do any of it anymore? I’m glad you asked, actually no! I love Ruby and we actually do quite a fair bit of it at Sqreen.</p><p>First and foremost we have a <a href="https://rubygems.org/gems/sqreen">Ruby agent</a> that helps protect Ruby apps. Developing and subsequently maintaining the agent, which I did on &amp; off during the last 3 years, is actually much more complex (read, fun!) Ruby than I ever did before. Each of our agents does dynamic instrumentation. In other words, we are writing code that will change the control flow of a running piece of software based on a description — cryptographically signed — sent over the wire. We first experimented this in Ruby but we are now doing it in five (soon six!) technologies. This is not trivial and it is a privilege to work with a team of talented &amp; passionate people on this kind of topic.</p><p>Secondly, when we created the agent, and before sending it to our first testers (now customers) we wanted to test it thoroughly in real life conditions. We needed a real-looking application on which we could also measure the behavior of the agent. True to our engineering culture, we decide to dogfood ourselves and created a small but quite useful Rails admin interface. It’s used every day internally to monitor the behavior of our agents and help our customers.</p><h3>A little advice from someone who’s been there</h3><p>Are you a Ruby dev thinking about starting in Python? You should do it! It’s sufficiently similar to Ruby that you’ll feel productive very soon. However, it’s also sufficiently different that you will learn some new tricks that could open new doors for you. Being a one-trick pony is never a good idea anyway! A good interactive tutorial and the documentation are a good place to start. But you should also try working on a real app. Many idiosyncrasies of the ecosystem do not appear when only doing tutorials (e.g package management, testing, profiling…). Want to try it, with people who’ve already made the switch? <a href="https://www.sqreen.io/company#jobs"><strong>Join us at Sqreen</strong></a>, obviously, we are recruiting 😉</p><p><em>Originally published at </em><a href="https://blog.sqreen.com/from-ruby-to-python/"><em>blog.sqreen.com</em></a><em> on January 30, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac7038015888" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/how-i-switched-from-ruby-to-python-ac7038015888">Why and How I Switched from Ruby to Python</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The ultimate PHP Security Checklist]]></title>
            <link>https://medium.com/hackernoon/the-ultimate-php-security-checklist-eec9895f2fa3?source=rss-71d0a8997c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/eec9895f2fa3</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[php-security]]></category>
            <category><![CDATA[application-security]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Sqreen]]></dc:creator>
            <pubDate>Fri, 07 Dec 2018 00:31:24 GMT</pubDate>
            <atom:updated>2018-12-07T04:41:07.612Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6W67P0xHCkJvkS9-C0wH4w.jpeg" /></figure><p>Damn, but security is hard. It’s not always obvious what needs doing, and the payoffs of good security are at best obscure. Who is surprised when it falls off our priority lists?</p><p>This security checklist aims to give developers a list of PHP security best practices they can follow to help improve the security of their code.</p><p>Here is a selection of some of the PHP security checklist items (<em>Read the full checklist </em><a href="https://www.sqreen.io/checklists/php-security-checklist"><strong><em>here</em></strong></a><em>)</em></p><h3>Filter and Validate All Data</h3><p>Regardless of where the data comes from, whether that’s a configuration file, server environment, GET and POST, or anywhere else, do not trust it. Filter and validate it! Do this by using one of the available libraries, such as zend-inputfilter.</p><p><strong>Read more:</strong></p><ul><li><a href="https://framework.zend.com/blog/2017-06-13-zend-validator.html">Validation in Zend Framework</a></li><li><a href="https://symfony.com/doc/current/validation.html">Validation in Symfony</a></li><li><a href="https://laravel.com/docs/5.6/validation">Validation in Laravel</a></li></ul><h3>Use Parameterized Queries</h3><p>To avoid SQL injection attacks, never concatenate or interpolate SQL strings with external data. Use parameterized queries instead and prepared statements. These can be used with vendor-specific libraries or by using PDO.</p><p><strong>Learn more:</strong></p><ul><li><a href="https://secure.php.net/manual/en/pdo.prepared-statements.php">Prepared statements and stored procedures in PDO</a></li><li><a href="https://secure.php.net/manual/de/mysqli.quickstart.prepared-statements.php">Mysqli Prepared Statements</a></li><li><a href="https://secure.php.net/manual/en/function.pg-query-params.php">The PostgreSQL pg_query_params function</a></li></ul><h3>Set open_basedir</h3><p>The open_basedir directive limits the files that PHP can access to the filesystem from the open_basedir directory and downward. No files or directories outside of that directory can be accessed. That way, if malicious users attempt to access sensitive files, such as /etc/passwd, access will be denied.</p><p><strong>Read more:</strong></p><ul><li><a href="https://secure.php.net/manual/en/ini.core.php#ini.open-basedir">open_basedir configuration directive</a></li><li><a href="https://secure.php.net/manual/en/security.filesystem.php">PHP Filesystem Security</a></li><li><a href="https://www.digitalocean.com/community/tutorials/7-security-measures-to-protect-your-servers#isolated-execution-environments">Isolated Execution Environments by DigitalOcean</a></li></ul><h3>Check Your SSL / TLS Configurations</h3><p>Ensure that your server’s SSL/TLS configuration is up to date and correctly configured, and isn’t using weak ciphers, outdated versions of TLS, valid security certificates without weak keys, etc, by scanning it regularly.</p><p><strong>Read more:</strong></p><ul><li><a href="https://www.ssllabs.com/">SSL Labs</a></li><li><a href="https://observatory.mozilla.org/">Observatory by Mozilla</a></li></ul><h3>Connect to Remote Services With TLS or Public Keys</h3><p>When accessing any database, server, or remote services, such as Redis, Beanstalkd, or Memcached, always do so using TLS or public keys. Doing so ensures that only authenticated access is allowed and that requests and responses are encrypted, and data is not transmitted in the clear.</p><p><strong>Read more:</strong></p><ul><li><a href="https://www.digitalocean.com/community/tutorials/7-security-measures-to-protect-your-servers#public-key-infrastructure-and-ssltls-encryption">Public Key Infrastructure and SSL/TLS Encryption</a></li><li><a href="https://www.websecurity.symantec.com/security-topics/what-is-ssl-tls-https">What is SSL, TLS and HTTPS?</a></li><li><a href="https://www.globalsign.com/en/blog/ssl-vs-tls-difference/">SSL vs. TLS — What’s the Difference?</a></li></ul><h3>Do not send sensitive information in headers</h3><p>By default PHP will set his version number in the HTTP headers. Some frameworks may do the same as well.</p><p><strong>Read more:</strong></p><ul><li><a href="https://tecadmin.net/basic-security-tips-hide-apachephp-information/">Hide PHP and Apache informations from HTTP headers</a></li></ul><h3>Log all the things</h3><p>Regardless of whether you’re logging failed login attempts, password resets, or debugging information, make sure that you’re logging, and with an easy to use, and mature package, such as Monolog.</p><p><strong>Read more:</strong></p><ul><li><a href="https://github.com/Seldaek/monolog">Monolog</a></li><li><a href="https://www.loggly.com/ultimate-guide/php-logging-basics/">PHP Logging Basics</a></li></ul><h3>Have a Content Security Policy</h3><p>Whether you have a one page, static website, a large static website, or a sophisticated web-based application, implement a Content Security Policy (CSP). It helps to mitigate a range of common attack vectors, such as XSS.</p><p><strong>Read more:</strong></p><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP">Content Security Policy (CSP) via MDN web docs</a></li><li><a href="https://developer.chrome.com/extensions/contentSecurityPolicy">Content Security Policy (CSP) via the Google Chrome extensions documentation</a></li><li><a href="https://csp-evaluator.withgoogle.com/">CSP Evaluator</a></li><li><a href="https://cspvalidator.org/#url=https://cspvalidator.org/">Content Security Policy (CSP) Validator</a></li><li><a href="https://www.sqreen.io/">Easily add a Content Security Policy with Sqreen</a></li></ul><blockquote><strong>Want more? Check out the full checklist </strong><a href="https://www.sqreen.io/checklists/php-security-checklist">here</a></blockquote><p><em>Originally published at </em><a href="https://www.sqreen.io/checklists/php-security-checklist"><em>www.sqreen.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eec9895f2fa3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/the-ultimate-php-security-checklist-eec9895f2fa3">The ultimate PHP Security Checklist</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[In ICO, the S stands for Security]]></title>
            <link>https://medium.com/hackernoon/in-ico-the-s-stands-for-security-64c4a5a863b8?source=rss-71d0a8997c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/64c4a5a863b8</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[ico]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[btc]]></category>
            <dc:creator><![CDATA[Sqreen]]></dc:creator>
            <pubDate>Thu, 11 Jan 2018 23:59:46 GMT</pubDate>
            <atom:updated>2018-01-13T01:58:45.128Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xc4QGDtWgRUCxpAS4BJrpw.jpeg" /></figure><blockquote>By <a href="https://twitter.com/jbaviat">Jean-Baptiste Aviat</a>, Co-founder and CTO of Sqreen. Originally published on <a href="https://blog.sqreen.io/ico-security/">Sqreen</a>.</blockquote><p>ICOs are all the rage these days. You have ICOs raising millions in seconds, and others <a href="https://www.coindesk.com/coindash-ico-hacker-nets-additional-ether-theft-tops-10-million/">losing millions in seconds</a>. Coming from a security background, I wondered if these ICOs deserved the love/hate they were receiving.</p><p>We ran an analysis to grade ICO security <a href="https://www.coinschedule.com/icos.html">that raised more than $5M</a>.</p><p>tl<em>;dr ICOs suck at security. Our research brings to light the poor practices that reign in ICO security.</em></p><h3>Why is security important for ICOs?</h3><p>It is known and expected that most young companies do not invest in security: they have a product to build and need to acquire users and clients first. In the case of ICO companies, this is extremely different.</p><p>ICO companies handle millions of dollars in crypto money. That’s often their own customer’s money — and/or investor’s money.</p><p>Many ICOs have failed or were endangered because of technical security issues:</p><ul><li><a href="http://hackingdistributed.com/2016/06/18/analysis-of-the-dao-exploit">DAO</a>: a vulnerability in the smart contract allowed attackers to steal ⅓ of amount raised</li><li><a href="https://www.theverge.com/2017/11/21/16684296/tether-cryptocurrency-stolen-30-million-hack">Tether</a> lost over $30 million</li><li><a href="https://www.coindesk.com/ico-funds-among-millions-frozen-parity-wallets/">Parity</a> has seen wallets frozen because of a security bug</li><li><a href="https://www.theregister.co.uk/2017/07/18/coindash_hack/">CoinDash</a> where hackers managed to change a payment address.</li><li><a href="https://www.coindesk.com/veritaseum-founder-claims-8-million-ico-token-stolen/">Veritaseum</a> lost $8 million in ICO tokens</li><li>etc.</li></ul><p>More importantly, many of these companies have platforms to allow their users to exchange their coins or convert their tokens. An attack on this application is part of what can make an ICO fail.</p><h3>ICOs fail to show decent security for their users…</h3><p>So what is the current state of ICO security?</p><p>More than 60% of the companies in our analysis show obvious worrying and technical misses at the application and network security level. The most worrying things we have detected are not listed in this article but were reported to the companies. Here is a selection:</p><h4>Exposed private cloud administration portals (VMware ESXi).</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*59ioVJt_UQDv078H." /><figcaption>Exposed VMware</figcaption></figure><p>This can allow an attacker to take over the whole infrastructure of the company.</p><h4>Out of date and vulnerable SSH servers.</h4><p>Many companies have SSH servers that are 2 years old, proving operating systems were never updated.</p><h4>Exposed build tools.</h4><p>It is common practice to publish build tests, but build tools are complex beasts and regularly show security failures. You shouldn’t expose them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*88eun03poiRZaHeP." /><figcaption>Exposed Jenkins</figcaption></figure><h4>Exposed DNS servers.</h4><p>DNS servers have shown lots of vulnerabilities in the last years. They may also be used to perform denial of service against online services.</p><h4>Exposed databases.</h4><p>This allows attackers to brute-force the database credentials, or a former employee or contractor to still be able to connect to it. It also makes it way easier for an attacker with some knowledge of the company to access these systems. Databases are also a vector to perform other attacks on various systems of the company.</p><h4>Exposed graphical administration tools (Microsoft Remote Desktop, VNC, Webmin).</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/0*6lw43eBF1Svnz4W5." /><figcaption>Exposed Webmin</figcaption></figure><p>That’s an easy way for an attacker to find its way into the company.</p><h4>Analytics and monitoring engines (Grafana, Munit).</h4><p>They are often a plain interface into the database or a great way of displaying infrastructure details.</p><p>All the above-listed items should be private. We found them because they are publicly accessible, from the internet. It is a basic security measure to hide them behind a VPN or source address monitoring.</p><p>These companies also host a lot of services themselves, such as chat services and forums. Hosting such services is a difficult thing to keep secure: they need to be updated, configured accordingly, and for most companies, this is often not an important focus. Thus, they are quite complicated to keep secure.</p><p>Self-hosted services are extremely hard to secure: network filtering has to be implemented, authentication needs to use great password policy, 2-factor authentication, to ensure the hosted services are secured. In this case, many services were found publicly accessible.</p><p>ICO companies make basically no usage of security measures intended to protect their users such as a Content Security Policy (they actually are 3 times less likely to use a CSP than the average of the internet).</p><p>The simplest security measures, such as HTTP headers, are not even put on their websites. Such security headers bring basic but important protections to force browsers to use HTTPS, block Cross-site Scripting (XSS) or MIME attacks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hNNtsYX3FYIJgu1w." /></figure><p>And finally, none of the ICO apps use any serious sort of real-time application security solution to protect their data.</p><h3>… but care about speed</h3><p>We have however found out that ICO companies are concerned about their availability and speed. They use CDNs that make their websites run faster and can protect against Distributed Denial-of-Service (DDoS). Almost 70% of the ICOs analyzed use a CDN like CloudFlare. This CDN adoption seems to be much more prevalent than for other companies.</p><p>Anti-DDoS CDNs protect websites against attacks that can make them temporarily inaccessible. The business impact of having a website down is terrible: it prevents users from signing in, visitors (potential investors) to check the company website or… whitepapers.</p><p>But CDNs do not protect applications users or investors: Cross-site Scripting (XSS), NoSQL injections, account takeovers and more.</p><p>The full result of the analysis is available <a href="https://www.sqreen.io/opendoor/ico"><strong>here</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lDeNG5V4xv7hF5RK." /><figcaption>Security Ranking of ICOs <a href="https://www.sqreen.io/opendoor/ico">https://www.sqreen.io/opendoor/ico</a></figcaption></figure><h3>Outlook on ICO security</h3><p>Here are a couple of small pointers for ICO actors:</p><h4>What you need to do if you’re planning or running an ICO?</h4><p>For your business, security is not an option. We’ve built a basic security checklist that developers should follow to improve their ICO security.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/212/0*NPzlhtp-NwBbbjx8." /><figcaption>ICO Security Checklist <a href="https://www.sqreen.io/resources/ico-security">https://www.sqreen.io/resources/ico-security</a></figcaption></figure><p>You can get it <a href="https://www.sqreen.io/resources/ico-security"><strong>here</strong></a>.</p><p>The important thing is to build a clear roadmap and to prioritize it. Tackle simple steps first.</p><p>In the case of ICOs, security issues are not about bad press, legal issues, or losing customers. It’s about the end of your company and the potential loss of millions of dollars.</p><h4>What you need to do if you’re a crypto investor?</h4><p>The focus needs to be spent on 2 things: First, as a Coin or Token owner, you need to secure yourself. You can check these tutorials:</p><p>Second, in addition to all your additional “smart investment criteria”, ensure the ICO you want to invest in takes security seriously! Their grade on <a href="https://www.sqreen.io/opendoor/ico/">https://www.sqreen.io/opendoor/ico/</a> is an indicator. Other indicators are:</p><ul><li>Their history of security issues and their reaction: have they fixed quickly? Did they communicate about the issue and the fix?</li><li>Whether they run a security team or a security bug bounty program.</li></ul><p>Thanks for reading this until the end! Have comments or feedback? Let me know!</p><h4>About the author</h4><p><a href="https://twitter.com/jbaviat">Jean-Baptiste Aviat</a> spent half a decade hunting vulnerabilities at Apple; helping developers solve them, and developing security software. He is now Co-founder and CTO at Sqreen.</p><p><em>Originally published at </em><a href="https://blog.sqreen.io/ico-security/"><em>blog.sqreen.io</em></a><em> on January 11, 2018.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64c4a5a863b8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/in-ico-the-s-stands-for-security-64c4a5a863b8">In ICO, the S stands for Security</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tor — the good, the bad, and the ugly]]></title>
            <link>https://medium.com/sqreen-io/tor-the-good-the-bad-and-the-ugly-f0d19f510b01?source=rss-71d0a8997c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0d19f510b01</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[tor]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Sqreen]]></dc:creator>
            <pubDate>Tue, 25 Apr 2017 21:22:20 GMT</pubDate>
            <atom:updated>2017-04-25T21:22:20.805Z</atom:updated>
            <content:encoded><![CDATA[<p>Tor offers anonymous browsing capabilities to people across the world. Users located in countries with strict censorship laws can use it to access restricted sites like Facebook, Google, foreign news websites or forums privately.</p><p>Tor directs Internet traffic through a free, worldwide, volunteer network consisting of more than seven thousand relays to conceal a user’s location and traffic from anyone <a href="https://en.wikipedia.org/wiki/Computer_surveillance#Network_surveillance">surveilling the network</a> with <a href="https://en.wikipedia.org/wiki/Traffic_analysis#In_computer_security">traffic analysis</a>.</p><p>Tor encrypts data, including the destination<a href="https://en.wikipedia.org/wiki/IP_address"> IP address</a>, multiple times and sends it through a<a href="https://en.wikipedia.org/wiki/Virtual_circuit"> virtual circuit</a> of randomly selected relays. Each relay decrypts a single layer of encryption to reveal only the next relay of the circuit in order to pass the remaining encrypted data onwards. The final relay decrypts the innermost layer of encryption and sends the original unencrypted data to its destination without any knowledge of the source IP address.</p><p>Tor also provides hidden services that allow users to publish websites and services without revealing their location or the identity of their owners. These sites are often called the <a href="https://en.wikipedia.org/wiki/Dark_web">dark web</a> or deep web.</p><p>To keep it simple, using Tor makes it more difficult (but not impossible) for Internet activity to be traced back to the user.</p><h3>The dark side of the web</h3><p>Individuals can use Tor to prevent websites from tracking them or to access websites blocked by their local Internet providers. Journalists, dissidents, and non-governmental organizations all use Tor for sensitive communications or for bypassing laws in countries where the internet is tightly regulated by the government. These are what Tor was built for, and are only a fraction of the legitimate use cases for Tor.</p><p>Despite these noble goals Tor also has a dark side. Obviously, the convenient (and relative) anonymity attract people with some less honorable intentions.</p><p>Recent <a href="http://www.tandfonline.com/doi/full/10.1080/00396338.2016.1142085?scroll=top&amp;needAccess=true">studies</a> have revealed that a large amount of the content hosted on Tor’s hidden services is linked to suspicious or illegal activities such as black market drugs, illegal firearms and extreme pornography. Tor is also used increasingly often to perform cyber-attacks.</p><h3>Hidden threats</h3><p>Tor is somewhat <a href="https://www.torproject.org/docs/faq.html.en#WhySlow">slow by design</a>. Bouncing your traffic between three nodes before sending it out to the wider internet (6 nodes when you include the response ) adds a <a href="http://www.mdpi.com/1999-5903/4/2/488/htm">significant amount of latency</a> to the round trip time. This implies that high rate Dos / DDoS attacks over Tor are not efficient if even possible.</p><p>However, for low bandwidth and slow distributed attacks (for example <a href="https://en.wikipedia.org/wiki/Slowloris">Slowloris</a>, <a href="http://www.cathaycenturies.com/blog/?p=844">SlowLoris and PyLoris</a>) the Tor network is indeed a very useful medium. It conveniently provides two important things to the attackers: a large number of exit relays and anonymity.</p><p>Even worse, IBM <a href="https://securityintelligence.com/media/ibm-x-force-threat-intelligence-quarterly-3q-2015/">reported</a> an increasing number of cyber attacks coming from the dark web, mostly through the Tor network. This report exposes new techniques where cyber-thieves use Tor hidden services for their ransomware campaigns.</p><p>Hackers have automated the whole process of taking over legitimate websites to victimize unwitting visitors with ransomware using botnets like <a href="http://www.webopedia.com/TERM/S/soaksoak-malware.html">SoakSoak</a> and exploit kits like <a href="http://blog.trendmicro.com/trendlabs-security-intelligence/a-new-exploit-kit-in-neutrino/">Neutrino</a>. Such botnets are constantly scanning websites over Tor for vulnerabilities they can exploit with host redirection scripts.</p><p>In many cases, it only takes a few days before a new website is scanned by hackers for vulnerabilities.</p><h3>Theory meets reality</h3><p><a href="https://www.sqreen.io/?utm_medium=social&amp;utm_source=medium&amp;utm_campaign=Tor%20%E2%80%93%20the%20good,%20the%20bad,%20and%20the%20ugly"><strong>Sqreen</strong></a> intends to monitor and protect your web application and users from potential threats wherever they come from. We did not see the urge of pushing active features related to Tor users, at first.</p><p>We started to look at the data a bit further when a customer came to us with this specific request.</p><p>As of today, the number of connection attempts to our customers apps coming from the Tor network make up about 6 percent of the total number of connection attempts. Surprisingly, 99.7 percent of the time the credentials supplied from Tor Users are incorrect (For comparison our overall authentication failure rate is less than 23 percent).</p><p>This first insight was enough to pique curiosity and to encouraged us to dig further in order to figure out what was going on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5nVz5OQlR9Nr9B-8.jpeg" /><figcaption>Failed connection attempts — Almost all attempts from Tor fail.</figcaption></figure><p>This subset of data on app usage comes from over a hundred of apps — mostly Rails or Python — that are protected and monitored by Sqreen on a daily basis. The stats are pretty consistent across all apps.</p><p>The number of successful connections through Tor network was only significant for one notable customer. Our study has shown that in this case, the company behind the web application was using the Tor distributed network for running parallel benchmarks and automated release tests to assert its scalability. This is almost the only legitimate Tor use case we could find.</p><p>When we looked at specific attacks on our customers’ apps, we identified that authentication attacks (brute force attack on a specific user account, or accounts enumeration) are performed 6.5 times more frequently by IPs registered as Tor exit nodes on average. These scans also last 29.5 percent longer on average.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/0*Qs3E9dpwsu0LdhnH.png" /><figcaption>A user coming from Tor is between 6 and 8 times more likely to perform an attack.</figcaption></figure><p>Path scanning and SQL/NoSQL injections are also popular methods for discovering web application vulnerabilities. These kinds of attacks are up to 8 times more frequent over the Tor network. This trend indicates that Tor usage is closely linked to suspicious activity on our customers’ applications.</p><p>In the end, connections through Tor — even if underrepresented — are responsible for nearly 30 percents of all attacks encountered by our customers including password brute force attacks, account enumerations, and fraudsters.</p><h3>Tackling the issue</h3><p>The Tor Network’s goal is to provide anonymity and circumvention for the users in need of them. Deploying any kind of attack is abusing this service.</p><p>Fortunately, the <a href="https://www.torproject.org/">Tor project</a> provides a regularly updated list of exit nodes that can access your IP <a href="https://check.torproject.org/cgi-bin/TorBulkExitList.py">here</a>, so you can monitor what is going on and eventually set up countermeasures quite easily.</p><p>You might be tempted to block users from accessing your website over Tor. Then you should first take a look at the Tor project’s <a href="https://www.torproject.org/docs/faq-abuse.html.en#Bans">official position</a>. It may seem quite radical but if Tor is a real issue for you banning IPs is the simplest way to get rid of the threat. To achieve this, you will need to use online services like <a href="https://www.torproject.org/projects/tordnsel.html.en">TorDNSEL</a> or the list of exit nodes provided above.</p><p>If you use the exit nodes list be sure to frequently download a fresh copy of the list and don’t forget to clean your blacklists since the list of IPs changes continuously. Moreover, be aware that as there may be hundreds or even thousands of nodes so adding them to iptables can hurt your server’s network performance. Tools like <a href="http://ipset.netfilter.org/">ipset</a> may be helpful in this case</p><h3>Conclusion</h3><p>As we have seen, banning Tor users from your application could be a crucial point in securing your business, but setting up a homemade solution can be somewhat complicated and painful.</p><p>I would love to hear your thoughts and experiences with the Tor network. How is Tor traffic impacting the security of your application? Is your app getting a lot of legitimate or illegitimate traffic from Tor?</p><p>At <a href="https://www.sqreen.io/?utm_medium=social&amp;utm_source=blog&amp;utm_campaign=Tor%20%E2%80%93%20the%20good,%20the%20bad,%20and%20the%20ugly"><strong>Sqreen</strong></a> we listen to the needs of our customers, as we aim to constantly improve our product. Sqreen recently added a feature to display connections coming from the Tor network. It will tell you which of your users are using Tor and whether or not they are performing malicious activities. Only 30 seconds are needed to get started with Sqreen, so <a href="https://www.sqreen.io/?utm_medium=social&amp;utm_source=medium&amp;utm_campaign=Tor%20%E2%80%93%20the%20good,%20the%20bad,%20and%20the%20ugly"><strong>try it out today</strong></a>!</p><h3>About the author</h3><p><a href="https://twitter.com/0xC70FF3">Christophe</a> is the lead data scientist at Sqreen. He has a PhD in Computer Science and is passionate about cryptography and deep learning­. He has worked for several successful startups as a back-end engineer and data scientist. When he is not thinking distributively, he dreams of electric sheep.</p><h3>Further reading</h3><ul><li><a href="http://www.digitaltrends.com/computing/a-beginners-guide-to-tor-how-to-navigate-through-the-underground-internet/">http://www.digitaltrends.com/computing/a-beginners-guide-to-tor-how-to-navigate-through-the-underground-internet/</a></li><li><a href="http://www.telegraph.co.uk/technology/2016/02/02/dark-web-browser-tor-is-overwhelmingly-used-for-crime-says-study/">http://www.telegraph.co.uk/technology/2016/02/02/dark-web-browser-tor-is-overwhelmingly-used-for-crime-says-study/</a></li><li><a href="http://www.tandfonline.com/doi/full/10.1080/00396338.2016.1142085">http://www.tandfonline.com/doi/full/10.1080/00396338.2016.1142085</a></li><li><a href="http://security.stackexchange.com/questions/19698/mitigating-anonymous-dos-tor-combined-with-pyloris">http://security.stackexchange.com/questions/19698/mitigating-anonymous-dos-tor-combined-with-pyloris</a></li><li><a href="https://www.webarxsecurity.com/2016/07/20/automatically-exploited-websites-infect-visitors-ransomware/">https://www.webarxsecurity.com/2016/07/20/automatically-exploited-websites-infect-visitors-ransomware/</a></li><li><a href="http://www.bbc.com/news/technology-36459022">http://www.bbc.com/news/technology-36459022</a></li><li><a href="http://www.infodsi.com/articles/157784/cyber-attaques-provenant-dark-web-empruntent-plus-plus-reseau-tor.html">http://www.infodsi.com/articles/157784/cyber-attaques-provenant-dark-web-empruntent-plus-plus-reseau-tor.html</a></li><li><a href="http://www.itespresso.fr/ibm-demande-entreprises-faire-barrage-tor-106036.html">http://www.itespresso.fr/ibm-demande-entreprises-faire-barrage-tor-106036.html</a></li><li><a href="http://thehackernews.com/2016/07/tor-deep-web-spying.html">http://thehackernews.com/2016/07/tor-deep-web-spying.html</a></li><li><a href="http://www.forbes.com/sites/jameslyne/2013/09/06/30000-web-sites-hacked-a-day-how-do-you-host-yours">http://www.forbes.com/sites/jameslyne/2013/09/06/30000-web-sites-hacked-a-day-how-do-you-host-yours</a></li><li><a href="https://www.torproject.org/docs/faq-abuse.html.en#Bans">https://www.torproject.org/docs/faq-abuse.html.en#Bans</a></li><li><a href="https://securityintelligence.com/media/ibm-x-force-threat-intelligence-quarterly-3q-2015">https://securityintelligence.com/media/ibm-x-force-threat-intelligence-quarterly-3q-2015</a></li><li><a href="https://resources.distilnetworks.com/h/i/246101200-cloudflare-vs-tor-is-ip-blocking-causing-more-harm-than-good/181642">https://resources.distilnetworks.com/h/i/246101200-cloudflare-vs-tor-is-ip-blocking-causing-more-harm-than-good/181642</a></li></ul><p><em>Originally published at </em><a href="https://blog.sqreen.io/tor-the-good-the-bad-and-the-ugly/"><em>blog.sqreen.io</em></a><em> on November 3, 2016.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0d19f510b01" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sqreen-io/tor-the-good-the-bad-and-the-ugly-f0d19f510b01">Tor — the good, the bad, and the ugly</a> was originally published in <a href="https://medium.com/sqreen-io">Sqreen</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Embedding JavaScript into Python]]></title>
            <link>https://medium.com/sqreen-io/embedding-javascript-into-python-f2e684eb8297?source=rss-71d0a8997c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2e684eb8297</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sqreen]]></dc:creator>
            <pubDate>Tue, 02 Aug 2016 14:27:47 GMT</pubDate>
            <atom:updated>2017-05-11T13:52:46.087Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HjmLH9pvGPJugs10." /></figure><h3>TL; DR: v8.py</h3><p>PyMiniRacer brings a compiled V8 interpreter and a simple interface to the Python community:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8fedc7796942beb553f0f9978b796073/href">https://medium.com/media/8fedc7796942beb553f0f9978b796073/href</a></iframe><h3>Our needs</h3><p><a href="https://www.sqreen.io/?utm_medium=social&amp;utm_source=medium&amp;utm_campaign=Embedding%20JavaScript%20into%20Python">Sqreen</a> needs a stable, performant and embeddable JavaScript solution for Python. We use it to run security logic in the Sqreen agent that our customers install in their applications. This has several advantages. In a first hand, execution is confined in the JavaScript VM, which enforces reliability. On a second hand, the security logic we build can be shared across platforms. This allows Sqreen to transparently monitor and enforce security in our customer’s applications, whatever the platform is.</p><p>The Ruby ecosystem already provides similar solutions. As a matter of fact, the generic JS backend wrapper <a href="https://github.com/rails/execjs">ExecJS</a> is even part of <a href="http://rubyonrails.org/">Ruby on Rails core</a>.</p><p>Since we have found no project with such stability nor popularity in Python, we decided to write our own.</p><h3>Embedding V8</h3><p>Basically, we need three things:</p><ol><li>A JS engine;</li><li>A binding between the JS engine and Python;</li><li>The Python interface.</li></ol><p>First, you need a JS engine. Choosing <a href="https://developers.google.com/v8/">V8, the Google JavaScript engine</a>, initially built for Chrome, is a no brainer. It is used in both Chrome and NodeJS. These projects have emphasized the speed, quality, and stability of the project.</p><p>Then you need to interface V8 with Python. In Python, there are two ways to do it. We could either use the <a href="https://docs.python.org/3.5//extending/index.html#extending-index">Python C API,</a> or <a href="https://docs.python.org/3/library/ctypes.html">ctypes</a>. We have chosen ctypes since it allows a generic and more portable implementation. Indeed, no Python header is needed for compilation. Furthermore, it reduces the number of targets that need maintenance for the binary distribution.</p><p>As a reference implementation, we chose the <a href="https://github.com/SamSaffron/mini_racer">mini_racer</a> gem, written by <a href="https://twitter.com/samsaffron">Sam Saffron</a>. It is a simple one, with everything we needed, that allows to:</p><ul><li>Create isolated contexts;</li><li>Eval code on it that may define functions.</li></ul><p>Finally, the Python library. That’s the part that will be shown to the package users. We designed the simplest API possible, that allows to create a context, and either eval or call functions on it.</p><h3>Introducing: PyMiniRacer</h3><p>Check out the <a href="https://github.com/sqreen/PyMiniRacer">Github page</a> of PyMiniRacer.</p><p>PyMiniRacer is open source and released under the ISC License.</p><h3>Usage</h3><p>Installation is straightforward on OSX and most Linux distributions:</p><pre>$ pip install py_mini_racer</pre><p>The interface is very straightforward:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/730e9b5f0a4e98d15840c0cce4af0990/href">https://medium.com/media/730e9b5f0a4e98d15840c0cce4af0990/href</a></iframe><h3>Binary distribution</h3><p>Building V8 is a long process. You need a system with a C++ compiler. Then, to download a few gigabytes of V8 source code from Google repository. Eventually, you compile hundreds of C++ files and link them together.</p><p>PyMiniRacer does all of that for you :). Thanks to recent efforts in Python <a href="https://www.python.org/dev/peps/pep-0427/">binary</a> <a href="https://www.python.org/dev/peps/pep-0513/">packaging</a>, we have been able to package PyMiniRacer as Python wheels for the most common platforms and Python versions. You only need to pip install it, and you are ready to go!<br> If your version is not supported yet, <a href="https://github.com/sqreen/PyMiniRacer/issues/new">please create a GitHub issue</a>.</p><p>We have packaged a 4 MB binary version of PyMiniRacer which installs instantly. These should help you embed V8 into your Python application in a very easy way.</p><h3>Performance and reliability</h3><p>PyMiniRacer bundles a plain V8. It uses its C++ interface to communicate with it. Executing a JavaScript string in a given context is done with the following steps:</p><ol><li>Take the JavaScript input as a Python string (in the <a href="https://github.com/sqreen/PyMiniRacer/blob/444b922408a46fcbe34503bfb6c13799e8b9f339/py_mini_racer/py_mini_racer.py#L76">MiniRacer.eval</a> Python method);</li><li>Pass it to V8 after a <a href="https://github.com/sqreen/PyMiniRacer/blob/444b922408a46fcbe34503bfb6c13799e8b9f339/py_mini_racer/extension/mini_racer_extension.cc#L426">String::NewFromUtf8</a> conversion;</li><li>Then V8: compiles it with <a href="https://v8docs.nodesource.com/io.js-3.0/d0/d35/classv8_1_1_script.html#af96cba236d5711f59f402d05b80205ab">Script::Compile</a>; &amp; executes it with <a href="https://v8docs.nodesource.com/io.js-3.0/d0/d35/classv8_1_1_script.html#ace3880dc7a4e39a7f2f090cd72921fe1">Script::Run</a>;</li><li>PyMiniRacer converts the result to an abstract binary interface;</li><li>Return it to Python that will convert it using ctypes.</li></ol><p>There is virtually no overhead since in step 1. we only copy a string, and in step 4. we perform a very light and low-level conversion from ctypes to Python base objects (strings, numbers, dates, arrays, and dicts).</p><p>Regarding reliability, there are very few places where a failure can occur, since most of the work is performed by V8.</p><h3>About the author</h3><p><a href="https://twitter.com/jbaviat">Jean-Baptiste Aviat</a> spent half a decade hunting vulnerabilities at Apple, helping developers solve them, and developing security software. He is now CTO at <a href="https://www.sqreen.io/?utm_medium=social&amp;utm_source=medium&amp;utm_campaign=Embedding%20JavaScript%20into%20Python">Sqreen</a>.</p><p><em>Originally published at </em><a href="http://blog.sqreen.io/?utm_medium=social&amp;utm_source=medium&amp;utm_campaign=Embedding%20JavaScript%20into%20Python"><em>blog.sqreen.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2e684eb8297" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sqreen-io/embedding-javascript-into-python-f2e684eb8297">Embedding JavaScript into Python</a> was originally published in <a href="https://medium.com/sqreen-io">Sqreen</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[7 HTTP headers to secure your app for the busy web developer]]></title>
            <link>https://medium.com/@Sqreen/7-http-headers-to-secure-your-app-for-the-busy-web-developer-d7d3bdb4f710?source=rss-71d0a8997c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7d3bdb4f710</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Sqreen]]></dc:creator>
            <pubDate>Thu, 28 Jul 2016 16:58:50 GMT</pubDate>
            <atom:updated>2017-05-02T13:58:04.389Z</atom:updated>
            <content:encoded><![CDATA[<p>Modern web browsers offer a lot of security features aimed at protecting your users from a wide variety of threats such as malware installed on their device, hackers listening to their network traffic and malicious phishing sites pretending to be something that they’re not. Unfortunately quite a few of these features are disabled by default in order to ensure backward compatibility with older websites that rely on insecure behavior to function properly. What a lot of developers don’t know is that many of these settings are actually incredibly simple to enable, and you can protect your app from a wide variety of attacks in less than an afternoon. Here is a list of the most important security HTTP headers and why you should care about them.</p><h3>1. Frame Options</h3><p>Setting an X-Frame-Options header on your website is a way to protect from someone creating a wrapper around your site doing whatever they want and displaying your page in an iframe. This allows attackers to force your users to click on some part of your website, while hidden in an iframe (these are known as clickjacking attacks). You can either choose to completely block rendering your site inside a frame by setting this header to DENY, allow it to be rendered by other pages on the same server with SAMEORIGIN or, you can specify a list of whitelisted domains with ALLOW-FROM.</p><h3>2. XSS Auditor</h3><p>Cross-site scripting (XSS) is one of the most common and dangerous type attacks on the web, as it is often used to inject malicious code into your app to extract data about a logged in user, or take advantage of their user privileges to perform actions not available by default. Setting the X-XSS-Protection header allows modern browsers to block attackers from Reflected XSS attacks.</p><h3>3. Content Type Options</h3><p>Some browsers try to be smart and guess the type of file being transferred by default. This allows the browser to render an HTML file if the content looks right even if the server says that the file is plaintext. This can be used as an attack vector for untrusted JavaScript code. Setting the X-Content-Type-Options header to nosniff force browsers to respect the server specified file type.</p><h3>4. HTTP Strict Transport Security</h3><p>Strict Transport Security tells browsers they should refuse to connect to this website as HTTP, which prevents connections from insecure locations to be downgraded from HTTPS to HTTP by an attacker. If the initial connection to a website is made over HTTP and redirected to HTTPS, the HSTS header will force further connections initiated by the user to only go through HTTPS.</p><h3>5. Public Key Pinning Extension for HTTP</h3><p>Public Key Pinning Extension for HTTP is another header that is only useful for sites running on HTTPS. While this header won’t do anything the first time, a user loads your site it will register the certificate your site is using, preventing your user’s browser from connecting to a malicious server with a different certificate that is pretending to be your website. This can be especially useful to protect your users against attackers who can create certificates for any domain (e.g. from abusing a trusted Certificate Authority or finding an HTTPS flaw).</p><h3>6. Content Security Policy</h3><p>Most of the other headers introduced here are quite simple, although I’ll have to admit that this one does take a little bit of effort to implement. A Content Security Policy (CSP) header lists all authorized domains and resources your app is allowed to use. Thus if a user loads a page where an attacker has injected a malicious resource, the browser will load your page, but prevent the attacker’s resource from loading. One side effect of using this header is that if you add new assets to your application, you will need to update your Content Security Policy accordingly. We recently released a new feature on Sqreen allowing you to enable easily and manage over time your CSP. You can read more about it <a href="https://blog.sqreen.io/integrating-content-security-policy-into-your-rails-applications-4f883eed8f45/">in this article</a>.</p><h3>7. Cookie Protection</h3><p>If you’re using cookies to store session or authentication information to keep users logged into your site, there are a couple of tricks to improve your security. There are two directives you should add which protect attackers from reading cookies in different places:</p><ol><li>HttpOnly will forbid JavaScript from accessing cookies which will prevent an XSS attack from being able to send your user’s cookies to the attacker.</li><li>The Secure attribute will only allow the cookies to be transferred over an HTTPS connection and not over HTTP, so an attacker with access to your network won’t be able to read unencrypted cookies.</li></ol><h3>Summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QA9qeJspbxwOAoPo2f7lWA.png" /><figcaption>Got to <a href="https://blog.sqreen.io/7-http-headers-to-secure-your-app-for-the-busy-web-developer/">blog.sqreen.io</a> to see the links</figcaption></figure><h3>Myheaders.sqreen.io</h3><p>We have built a simple tool to help you know if your website has all of these critical security headers enabled. Go to <a href="https://myheaders.sqreen.io/?utm_medium=social&amp;utm_source=medium&amp;utm_campaign=7%20HTTP%20headers%20to%20secure%20your%20app%20for%20the%20busy%20web%20developer"><strong>https://myheaders.sqreen.io</strong></a> to see if your website is protected.</p><p><em>Originally published at </em><a href="https://blog.sqreen.io/7-http-headers-to-secure-your-app-for-the-busy-web-developer/"><em>blog.sqreen.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7d3bdb4f710" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>