add completed tasks #59
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Zadanie wykonano dla języka python
Zad1
dane wrażliwe są wyświetlane tylko w przypadku wykonania operacji tworzenia nowego użytkownika. Logi pokazują wtedy dane wrażliwe jak pesel, miejsce zamieszkania.
log:
Getting: Customer(ID: None, Name: imie, City: city, Age: 22, Pesel: 20001110, Street: street, AppNo: 40)Poprawki:
Problem został naprawiony przez zastosowania wzorca projektowego read-once dla pól PESEL, street, appno.
Aby było to możliwe, została stworzona nowa klasa dla oddzielenia bazy danych (klasa CustomerDBModel) or klasy używanej przez backend (klasa Customer). Klasa Customer posiada pola typu read-once, które dla metody str() zwracają "Sensitive Data: ***".
log:
Getting: Customer(Name: a, City: a, Age: 11, Pesel: Sensitive Data: ***, Street: Sensitive Data: ***, AppNo: Sensitive Data: ***)Zad2
Git leaks znalazło 3 sekrety
1
Zcommitowany klucz prywatny RSA w pliku deployment.key,
dla commita:
bc17b7ddc46f46fff175aed55d68e11bb48166cclink:
https://github.com/Mixeway-Academy/task2/blob/bc17b7ddc46f46fff175aed55d68e11bb48166cc/deployment.key#L12
Zcommitowany klucz prywatny RSA w pliku deployment2.key
dla commita:
de9d7b8cb63bd7ae741ec5c9e23891b71709bc28link:
https://github.com/Mixeway-Academy/task2/blob/de9d7b8cb63bd7ae741ec5c9e23891b71709bc28/deployment2.key#L13
Zcommitowany klucz prywatny RSA w pliku awscredentials.json dla commita:
bc17b7ddc46f46fff175aed55d68e11bb48166cclink:
https://github.com/Mixeway-Academy/task2/blob/de9d7b8cb63bd7ae741ec5c9e23891b71709bc28/deployment2.key#L1Zad 3
Przeanalizowałem exploit:
| jinja2 | 3.1.2 | <3.1.5 | 76378 |
+==============================================================================+
| An oversight in how the Jinja sandboxed environment detects calls to |
| str.format allows an attacker who controls the content of a template to |
| execute arbitrary Python code. To exploit the vulnerability, an attacker |
| needs to control the content of a template. Whether that is the case depends |
| on the type of application using Jinja. This vulnerability impacts users of |
| applications which execute untrusted templates. Jinja's sandbox does catch |
| calls to str.format and ensures they don't escape the sandbox. However, it's |
| possible to store a reference to a malicious string's format method, then |
| pass that to a filter that calls it. No such filters are built-in to Jinja, |
| but could be present through custom filters in an application. After the |
| fix, such indirect calls are also handled by the sandbox. |
+==============================================================================+
Oznacza on, że w tej wersji, jeżeli atakujący miał dostęp do niezabezpieczoego template (na przykład przy używaniu render_template_string) możliwe było wykonanie zdefiniowanego obiektu format dla obiektu string (przy użyciu metody set), następne, jeżeli deweloperzy aplikacji zdefiniowali własny filtr, (przy użyciu @blueprint.app_template_filter("name")), możliwe było wywołanie tego filtru z podaniem obiektu format jako argumentu. Jako że metoda filtr znajdywała się poza sandoxem Jinja, możliwe było dostanie się do atrybutów globalnych, i
zdalne wykonanie kodu.
W tej aplikacji, wykonanie tego exploitu nie jest możliwe, gdyż używa ona tylko metody render_template, która blokuje możliwość interpretowania otrzymanych danych jako template syntax.