Web security reading list (summer edition) #14
Race conditions on the web
An interesting read about race conditions on the interweb.
Active Params
An example of automatic security gone too far, in my opinion. Allow all parameters in production that were ever used in development?
Typosquatting programming language package managers
Typosquatting gems: Don’t install coffe-script, urllib2, req7est. This guy uploaded 200+ packages with similar names as popular gems to illustrate the „typosquatting“ problem.
Why you shouldn’t share links on Facebook
Don’t message secret URLs on Facebook, e.g. Google Docs because links shared via Facebook Messenger reveals the URL in a publicly accessible API.
Making Content-Security-Policy great again
Autocomplete=off is ignored on non-login <input> elements in Chrome
Ruby on Rails security reading list (password hack edition) #13
Rails 5 changes protect_from_forgery execution order
Self-Destructing Cookies
Should you use Ruby’s SecureRandom?
Ruby authentication: Secure your Rack application with JWT
Hack: XSS via a Facebook page name
HelpSpot Vault
The bigger picture review and Rails security reading list #12
Pastejacking
Harden Firefox security settings
OS X Security and Privacy Guide
The Origins of the <Blink> Tag
Typical privilege escalation, CSP and Rails security reading #11
- 2 users have access to 2 different projects
- 1 resource in each project (web hooks in this case)
- User 1 and 2 can access /projects/1/hooks/1 and /projects/2/hooks/1 even though one of them shouldn’t
- That’s because the resource controller uses ProjectHook.find(params[:hook_id]), so it’s not scoped to the project.
Same-site Cookies
New: Same-Site cookies are sent only when using a web app directly, not through a request from a third-party website. With them, CSRF attacks won’t be possible anymore, because a request from a different site won’t be as a signed in user anymore. This is supported in the newest Chrome and Opera versions (and was before through general browser settings).
Rails and web security reading + how to filter redirects #10
Do you know the Rails.application.config.filter_redirect filter? It’s an undocumented configuration feature which lets you filter certain redirect URLs from your log files. This is handy when you’re redirecting to a URL with tokens in it so that they don’t show up in the log. A bit like config.filter_parameters.
Add the following to a new initializer and it will show “Redirected to [FILTERED]” in the log for redirects to a URL that contains that string. That means it will filter https://example.com, http://www.example.com and the like.
Rails.application.config.filter_redirect = ['example.com']
But now on to this week’s interesting (Rails) security articles:
CSV Injection in business.uber.com
Rails and web security reading (with Gmail security lessons learned) #9
- “Prevent vulnerabilities through product design”
- “Empower users to take action through a meaningful feedback UI”
- “Any defense can be defeated – use defense in depth with multiple layers of protection”
- “Detection systems are imperfect – implement catch-up mechanisms”
- “Make it hard for attackers to understand your defenses”
- “Implement an emergency system“ as a last resort
Let’s Encrypt & Nginx
Set up Let’s encrypt, nginx and security headers
How I got XSS’d by my ad network
XSS from ad networks on a security researcher’s blog
The misunderstood X-XSS-Protection
Rails sends the recommended setting by default, but an interesting read.
Secure websites shun HTTP Public Key Pinning
Uber bug bounty: Turning self-XSS into good-XSS
Rails security reading digest #8: Admin panel, checklists and link security
Do you have an admin panel? Then you might be interested in my recent article @codeship: How to protect a sensitive area of your application with mutual TLS authentication. That means the client also authenticates itself against the server with a client-side certificate. The full nginx web server configuration is available here.
Now, what was worth reading recently:
About rel=noopener
About rel=noopener in links to remove access to the window JS object when linking with target=_blank
Let’s encrypt with a Rails app on Heroku
Remote Code Execution in all git versions (client + server) < 2.7.4: CVE-2016-2324, CVE-2016‑2315
Remote Code Execution in git client and server
Vendor Security Assessment Questionnaires
The web app security questionnaire that Google uses to assess vendors
Securitychecklist.org
A basic security checklist from all levels with quick wins
Rails security digest and review reminders #7
The latest Rails security fixes were another reminder that we shouldn’t rely too much on a framework to solve everything security for us. The fix was for controller code like render params[:id] which makes it possible to render every file on the server. It also reminds that all user input is potentially tampered with.
Let’s take a second every time we use user input and think about what class it could potentially be: Fixnum, String, Array, Hash, nil, a blank string. Then we can look up the render method (link to Rails version 4.2.1) and see that it accepts a Hash. params[:id] can be a Hash, too.
Other interesting articles:
Kill your dependencies, less gems in Rails, less security worries.
Acceptance of FIDO 2.0 Specifications by the W3C accelerates the movement to end passwords
A few notes how Quora moved to HTTPS
Here’s an another extensive TLS configuration wiki page from Mozilla.
Rails 5 ActiveModel before_ callbacks will not halt when returning false, possible security implications
Beware: Server-side APIs for Client-Side Rendering and Cross Site Scripting (XSS)
This reminds us that Rails XSS protection only works in Erb, other cases still need manual escapes according to the context.
The DROWN attack
Do you really have SSL 2 disabled on your web server? Another SSL attack with a catchy name.
Rails security, strategy and config reading list #6
The end of January saw a lot of security fixes in Rails. A good reminder to keep up with Rails security, for example by reading these articles:
Two factor authentication in Rails 4 with Devise, Authy and puppies
Add 2FA via SMS to your Rails app.
Find mixed content and other SSL problems with the new Security Panel Chrome in DevTools
Creating a Content-Security-Policy from scratch
There’s also a CSP header generator.
Great idea, when you complete the Google account security checkup, you’ll get an extra 2 GB for Google Drive.
Not migrated to strong parameters yet, here’s a rake task to help with that
Martin Fowler’s web security basics:
- Output encode all application data on output with an appropriate codec
- Use your framework’s output encoding capability, if available
- Avoid nested rendering contexts as much as possible
- Store your data in raw form and encode at rendering time
- Avoid unsafe framework and JavaScript calls that avoid encoding