# Module 2 ## Lab 2-1 search email xuất hiện trên linkedin.com + chrome email extractor extension: ![image](https://hackmd.io/_uploads/HJzbZQ9fA.png) Tìm từ các group leak acc steal được: ![image](https://hackmd.io/_uploads/SySv-XcGR.png) ![image](https://hackmd.io/_uploads/BklPzmqf0.png) ## Lab 2-2 IP: ![image](https://hackmd.io/_uploads/rylrWE9f0.png) DNS Server: ![image](https://hackmd.io/_uploads/HkSPbEczC.png) `ns6.synerfy.vn` Hệ điều hành: ![image](https://hackmd.io/_uploads/H1AcbYcM0.png) Khả năng cao được host bằng linux lịch sử update: *search ko ra* :confused: các công nghệ sử dụng: ![image](https://hackmd.io/_uploads/ryhY6u9GR.png) *Sử dụng Wappalyzer chrome extension để lấy thông tin* Các port mở, dịch vụ: ![image](https://hackmd.io/_uploads/SyeYbYqfR.png) Thông tin khác: - subdomain: ![image](https://hackmd.io/_uploads/SJwmBK9MA.png) - robots.txt: ![image](https://hackmd.io/_uploads/SyMgIY9fR.png) ## Lab 2-3 Tìm các thiết bị IOT của tổ chức: ![image](https://hackmd.io/_uploads/rk42qYqMR.png) ![image](https://hackmd.io/_uploads/H1AZMcoM0.png) # Module 5 ## Lab 1 máy win7 chứa lỗ hổng: ![image](https://hackmd.io/_uploads/Hk9SQnszR.png) Scan bằng máy kali có cài nessus: ![image](https://hackmd.io/_uploads/ByeWIhsGR.png) *report sau khi quét xong* ## lab 2 máy win7: ![image](https://hackmd.io/_uploads/rJYCuniMC.png) máy kali: ![image](https://hackmd.io/_uploads/BkzgF3jGC.png) # Module 6 ## lab1 Đã search thử với router, not work! router đã đổi mật khẩu thay vì sử dụng mặc định. ## Lab2 Đã xem cách tấn công, tuy nhiên ko có card wifi support monitor mode. Không thực nghiệm được. ## lab3 tạo mật khẩu cho kiểu tấn công Rainbow Table từ công cụ Winrtgen. Chỉ đơn giản là config tool, chạy tool và đợi. Một vài config mặc định thì mình lên mạng tải file đã được tạo sẵn cho lẹ. muốn custom thì tự chạy. Giao diện chương trình: ![image](https://hackmd.io/_uploads/r1U3wAjGC.png) chọn add table: ![image](https://hackmd.io/_uploads/Sy7aPRsMR.png) - Hash: Loại mã hóa mà chúng tôi muốn tạo bảng Rainbow. Ví dụ: MD5, MD4, SHA1, v.v. - Min Len: Cho phép người dùng đặt độ dài tối thiểu của mật khẩu. - Max Len: Cho phép người dùng đặt độ dài tối đa của mật khẩu. - Index: Nó phân biệt bảng này với bảng khác. - Chain length: It shows the number of hashes that will be present in a single chain. As we have discussed earlier that table is formed using START and END. If the length of chains is higher the success rate will also be higher. - Chain Count: It represents the number of chains in a file for that particular Rainbow Table. If we generate a Rainbow table with a high chain count then it will take a large amount of storage and time to generate. - No. of Tables: Nó hiển thị số lượng tệp được tạo cho Bảng Rainbow hiện tại. - Charset: Đây là bộ ký tự sẽ được xem xét để tạo Bảng Cầu Vồng. Ví dụ: chữ và số, dấu cách chữ và số, v.v. Nhấn start và công việc tiếp theo là chờ đợi: ![image](https://hackmd.io/_uploads/SyQRuCiG0.png) ## lab 4 Crack password user with Pwdump7 ![image](https://hackmd.io/_uploads/SkSuq0oz0.png) Dump hash Tiếp đến là các bước load file table, load hash rồi chạy tool. Tuy nhiên, các file rainbow table nếu không gen rất lâu, thì cũng rất tốn dung lượng ổ cứng. Thứ mà mình ko có đủ. Nên give up và xem video demo của người khác thôi. [demo](https://www.youtube.com/watch?v=a2pyRYLE2Iw&ab_channel=RainbowCrackProject) ## lab 5 ![image](https://hackmd.io/_uploads/rJsKMJhzA.png) Giấu file bằng ADS, sau khi giấu nhận thấy dung lượng tệp tin ahihi.txt ko thay đổi. tiến hành xóa file cần giấu. ![image](https://hackmd.io/_uploads/ryATfy3G0.png) Đã xóa. Tiếp theo tạo symlink ![image](https://hackmd.io/_uploads/rkj47k2fA.png) Mở symlink: ![image](https://hackmd.io/_uploads/Byc_7J2GR.png) ## Lab6 ![image](https://hackmd.io/_uploads/BJUfrk2fC.png) Nhìn y hệt, nma không: ![image](https://hackmd.io/_uploads/Sy8ESJnfA.png) Lấy lại thông điệp: ![image](https://hackmd.io/_uploads/BypDr13GC.png) ## lab 7 Stego với ảnh, chỉ là chạy tool. ## lab8 clearing log ``` del /s /q %programdata%\microsoft\eventv~1\extern~1 ``` hoặc dùng event viewer xóa thủ công ![image](https://hackmd.io/_uploads/HyUKpkhzC.png) # Module11 ## 5.4 ### Reflected XSS Sau khi điền tên và xác nhận: ![image](https://hackmd.io/_uploads/r1JhNH8XA.png) Thử với payload `<script>alert('test')</script>` ![image](https://hackmd.io/_uploads/rJvzHHL70.png) Không thành công, do input bị filter `<script>`. Sử dụng thẻ `<img>`: `<img src=x onerror=alert("test")>` ![image](https://hackmd.io/_uploads/BJQuHrI7C.png) Lấy sessionid: ![image](https://hackmd.io/_uploads/ByD6HHLXR.png) ### DOM based XSS ![image](https://hackmd.io/_uploads/S1HxIBU70.png) `/vulnerabilities/xss_d/?default=Spanish` script của trang web: ```javascript! if (document.location.href.indexOf("default=") >= 0) { var lang = document.location.href.substring(document.location.href.indexOf("default=")+8); document.write("<option value='" + lang + "'>" + decodeURI(lang) + "</option>"); document.write("<option value='' disabled='disabled'>----</option>"); } document.write("<option value='English'>English</option>"); document.write("<option value='French'>French</option>"); document.write("<option value='Spanish'>Spanish</option>"); document.write("<option value='German'>German</option>"); ``` Thử thay url thành `/vulnerabilities/xss_d/?default=test`, không có gì được thay đổi. Các option cũ vẫn giữ nguyên. ![image](https://hackmd.io/_uploads/HytAN88m0.png). Có thể phía backend có kiểm tra giá trị của default. Source của trang: ```php! <?php // Is there any input? if ( array_key_exists( "default", $_GET ) && !is_null ($_GET[ 'default' ]) ) { # White list the allowable languages switch ($_GET['default']) { case "French": case "English": case "German": case "Spanish": # ok break; default: header ("location: ?default=English"); exit; } } ?> ``` Đầu tiên kiểm tra xem có bất kỳ đầu vào nào được người dùng cung cấp hay không. Tiếp theo chứa 4 ngôn ngữ được phép hoặc nằm trong whitelist bên trong câu lệnh switch. Và cuối cùng, nếu đầu vào là bất kỳ thứ gì khác thì nó sẽ chuyển hướng đến vị trí ?default=English. Đó là lý do tại sao bất cứ khi nào chúng ta cố gắng nhập một chuỗi khác các giá trị được cho phép, nó sẽ tự set thành English. **Bypass** - Sử dụng '&' để bypass switch case, sau đó chèn thêm payload phía sau. - Payload sau đó sẽ được chèn vào bên trong thẻ `<select></select>` nên sử dụng </select> để đóng thẻ này và chèn thẻ mình muốn vào. `English&</select><img src=x onerror=alert("test")>` ![image](https://hackmd.io/_uploads/rk72DU8mA.png) ![image](https://hackmd.io/_uploads/By4zOUL70.png) ### store xss Tạo comment với payload xss, nhưng phía backend lọc mất thẻ `<script>`. Thử với các thẻ khác như `<h1></h1>` ![image](https://hackmd.io/_uploads/S1omK88XA.png) Như vậy có thể backend chỉ filter thẻ script, thử payload với thẻ img: `<img src="x" onerror="alert('test')" />` ![image](https://hackmd.io/_uploads/ryJL9LLQC.png) Kiểm tra source phía backend, thì ở name input chỉ replace thẻ `script` ```php! <?php if( isset( $_POST[ 'btnSign' ] ) ) { // Get input $message = trim( $_POST[ 'mtxMessage' ] ); $name = trim( $_POST[ 'txtName' ] ); // Sanitize message input $message = strip_tags( addslashes( $message ) ); $message = ((isset($GLOBALS["___mysqli_ston"]) && is_object($GLOBALS["___mysqli_ston"])) ? mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $message ) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : "")); $message = htmlspecialchars( $message ); // Sanitize name input $name = preg_replace( '/<(.*)s(.*)c(.*)r(.*)i(.*)p(.*)t/i', '', $name ); $name = ((isset($GLOBALS["___mysqli_ston"]) && is_object($GLOBALS["___mysqli_ston"])) ? mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $name ) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : "")); // Update database $query = "INSERT INTO guestbook ( comment, name ) VALUES ( '$message', '$name' );"; $result = mysqli_query($GLOBALS["___mysqli_ston"], $query ) or die( '<pre>' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)) . '</pre>' ); //mysql_close(); } ?> ```