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

Шпора.Безопасность

ar7z1
March 27, 2016

 Шпора.Безопасность

ar7z1

March 27, 2016
Tweet

More Decks by ar7z1

Other Decks in Programming

Transcript

  1. [][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+! +[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+ []]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[]) [!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+ [])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([! []]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+ (!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+ ([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+ (!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+ [][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!!

    []+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]] +(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+ [+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+ []+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]] ((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+ []]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+(![]+[][(![]+[])[+[]]+ ([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+ []]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+ [+[]]]+[+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+ [+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+ []+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])()
  2. { "csp-report": { "document-uri": "http://example.org/ page.html", "referrer": "http://evil.example.com/ haxor.html", "blocked-uri":

    "http:// evil.example.com/image.png", "violated-directive": "default-src 'self'", "effective-directive": "img-src", "original-policy": "default-src 'self'; report-uri http://example.org/csp- report.cgi" } }
  3. Ссылки • Candy Web Security GitHub • HttpOnly • Request

    Validation in ASP.NET • Using Content Security Policy • Content Security Policy Level 2 • Cross-site scripting от Google • OWASP Top 10 for .NET developers part 2: Cross-Site Scripting (XSS) • Understanding XSS – input sanitisation semantics and output encoding contexts • How to break your site with a content security policy: an illustrated example • troyhunt.com
  4. var r = new XMLHttpRequest(); r.open('POST', ‘http:// site2.com’, true); r.setRequestHeader(‘Content-

    Type’,'application/json'); r.setRequestHeader('X-HEADER', 'lalala'); r.send(data);
  5. Cross-origin writes var c = new XMLHttpRequest(); c.withCredentials = true;

    c.open("POST", ...); c.setRequestHeader("Content- Type", “...”); c.send(...);
  6. public override void OnActionExecuting (HttpActionContext actionContext) { actionContext.Request.Headers.TryGetValues( "X-CSRF-Token", out

    tokenHeaders) ... actionContext.Request.Headers.GetCookies( “CSRF-Cookie") ... AntiForgery.Validate(cookieToken, formToken);
  7. Ссылки • Same Origin Policy • CORS • CSRF Prevention

    Cheat Sheet • Preventing CSRF Attacks in ASP.NET Web API • Anatomy of a Cross-site Request Forgery Attack • Preventing CSRF With Ajax • CSRF Attacks and Web Forms • haacked.com