3. OWASP
The Open Web Application Security
Project (OWASP) is a worldwide not-for-
profit charitable organization focused on
improving the security of software.
21. All the same
http://mysite.com/Redirect.aspx?Url=http://notmy.com
http://mysite.com/Redirect.aspx?Url=http://wndw.ms/v1A1Vs
http://mysite.com/Redirect.aspx?Foo=xLv8WUcipP6WQLnNyA6
MQzyFfyFNqCcoe&Bar=deyZWmQ4dbRtFTEDWczt72D&Url=%
68%74%74%70%3a%2f%2f%6D%79%75%6E%74%72%75%73%
74%65%64%73%69%74%65%2E%63%6F%6D&Foo2=CMVDnz
wpWzp3PtMFJUvCwX6bxr8ecFyy&Bar2=UYuu2XRcQUKzt3xYfe
mWHM6HNKt
Історія про дівчат і інтернет 5 годи в універі
Прочитані книжки про хак. Ритися у смітнику і дивитися на речі не стандартоно
QA ближчі до хаку? Здається що так, але найближче продукт менеджер?
Секюріті суперечить юзабіліті
Mobile Top 10 – 2016
IoT
A lot of document.
В OWASP ви знайдете безкоштовні та відкриті:
• інструменти та стандарти безпеки додатків;
• детальні настанови про тестування, розробку та аналіз
безпеки програм;
• стандартні елементи управління безпекою та бібліотеки;
• місцеві осередки по всьому світу;
• дослідження на актуальні теми;
• конференції;
• поштові розсилки;
Don’t stop at 10.
OWASP Developer’s
OWASP Cheat Sheet Series.
OWASP Testing Guide
OWASP Code Review Guide.
Constant change.
Think positive.
Use tools wisely.
Push left. making security an integral part of your culture throughout your development organization.
Метою проекту Топ 10 є підвищення обізнаності щодо безпеки додатків шляхом визначення ряду найбільш критичних ризиків, що постають перед організаціями.
Перше – хто може загрожувати аплікації, найчастіше всі, починаючи від анонімного юзера.
Останнє – зазвичай залежить від вашої аплікації.
Я випущу ці параметри.
Зверніть увагу, що цей документ 2013 року, наступна версія – 16/17 (я не буду голодний)
Ну і це документ не є специфічний для .NET Web – тому вам пожуть здатися дивними позиції деяких ризиків.
Lightweight Directory Access Protocol
An OS command injection attack occurs when an attacker attempts to execute system level commands through a vulnerable application.
To avoid the risk of SQL injection, you should never combine user input with Entity SQL command text.
PostgreSQL
MongoDB
$where
mapReduce
group
Applying the principle of least privilege
Cookie HttpOnly 2,0>
Session to IP
Timeout > 0
SessionStateSection.RegenerateExpiredSessionId
Enable password recovery via resets – never email it
Don’t use - remember me.
Turn off autocomplete
UseCookies | UseUri | UseDeviceProfile | AutoDetect
If you simple app is compromised (leak credential) - it potentially compromise unlimited number web app.
Check your API and WCF services (if it is local - limit)
VIN
external links need to present the user with a disclaimer before they exit
Validate all input against a whitelist
Uri.IsWellFormedUriString
Guid.TryParse (v4.0)
Fisrt step to CSRF
User doesn’t see – user can find
DB check for permission!
Parameter manipulation (userId, userName so on)
Avoid using discoverable references
Generate proxy id
StackTrace
PBD files
Keep your frameworks up to date
Customise your error messages
<customErrors mode="On" />
<customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="~/Error.aspx" />
<customErrors mode="RemoteOnly" redirectMode="ResponseRewrite" defaultRedirect="~/Error.aspx" />
<customErrors xdt:Transform="SetAttributes(mode)" mode="Off" />
**** password in log!
Трансформ наше все!
<trace enabled="true" localOnly="true" />
<trace xdt:Transform="Remove" />
<deployment retail="true" />
retail is set to true, ASP.NET disables certain configuration settings such as trace output, custom errors, and debug capabilities.
Machine config only!
Apply the principle of least privilege to your database accounts
Шифрується вся база даних при записі, при читанні відповідно розшифровується. Інєкція
Шифрування проти хешування
Рейнбов тейбл - для ламання хешів.
A rainbow table is a precomputed table for reversing cryptographic hash functions
Використовувати салит з хешуванням
LinkedIn цього не робив.
In .NET 4.5 the strongest algorithm for password hashing is PBKDF2, implemented as System.Security.Cryptography.Rfc2898DeriveBytes.
In .NET 4.5 the strongest hashing algorithm for general hashing requirements is System.Security.Cryptography.SHA512.
When using a hashing function to hash non-unique inputs such as passwords, use a salt value added to the original value before hashing.
Сryptographic storage is really the last line of defence.
[RequireHttps]
public class AccountController : Controller
Sensitive data still doesn’t belong in the URL
Encrypt sensitive configuration data
As I’ve written before, SSL is not about encryption. In fact it provides a number of benefits:
It provides assurance of the identity of the website (site verification).
2. It provides assurance that the content has not been manipulated in transit (data integrity).
3. It provides assurance that eavesdropping has not occurred in transit (data confidentiality).
<httpCookies requireSSL="true" />HttpOnly
[RequireHttps]
Try not to redirect from HTTP to HTTPS
Response.RedirectPermanent 301
HTTP Strict Transport Security
Strict-Transport-Security: max-age=expireTime [; includeSubDomains] [; preload]
Don’t mix TSL and non-TSL content
Authorize attribute covered only entry point.
API/Post method were not covered by Authorize attribute or wasn't checked permission to access
Чи відображає інтерфейс користувача посилання на недозволені
функції?
2. Чи є перевірки аутентифікації або авторизації з боку сервера?
3. Чи перевірки з боку сервера здійснюються виключно на основі
інформації, що надається зловмисником?
Restrict all action not only entrance points
Secure post and get code
synchroniser token pattern is great
Anti-Forgery Tokens
Raname Anti-Forgery Tokens
http://www.asp.net/web-api/overview/security/preventing-cross-site-request-forgery-csrf-attacks
Capcha
What won’t prevent CSRFOnly allowing requests with a referrer header from the same site.Storing tokens in cookies.Ensuring requests originate from the same source IP address
Keep updated
https://github.com/OWASP/SafeNuGet- MsBuild task to warn about insecure NuGet libraries
Turn off 'danger' features
Use wrappers (to hide dinger features)
Consolidate
Респонс хеадер курця, у респонс хеадер здорової людини.
Лишні знання породжують страждання
HTTP response header IIS – x-powered-by
URLScan tool - Server Header
MvcHandler.DisableMvcResponseHeader = true; - all other
Where I see it?
X-Frame-Options
DENY
SAMEORIGIN
ALLOW-FROM uri
Номер дружини двозначний
Більшість ризиків небезпечні у кооперації з іншими ризиками.