Vega Web Application Project
This project demonstrates the tool Vega and SQLMap. The reason for the project is to be able to test web application security as a security professional. Vega will be used to scan high, medium, and low web vulnerabilities, including SQL injection. In this project, I worked on demonstrating how to configure and use the tool and how to verify its results with sqlmap. The use of sqlmap is used to replicate these vulnerabilities and exploit them to prove that the scan proved correct. It is important to understand basic networking concepts such as basic networking concepts like HTTP/HTTPS protocol and a basic understanding of SQL queries.
This is a paragraph where you can add any information you want to share with website visitors. Click here to edit the text, change the font and make it your own.
![](https://static.wixstatic.com/media/743c93_10d46b7ab46541708e386bdcfac5390b~mv2.png/v1/fill/w_395,h_293,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_10d46b7ab46541708e386bdcfac5390b~mv2.png)
![](https://static.wixstatic.com/media/743c93_f4ef3d4be1f949589f9d8deb2e4126b7~mv2.png/v1/fill/w_476,h_312,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_f4ef3d4be1f949589f9d8deb2e4126b7~mv2.png)
1.
First we neeed to open the Vega application for this project I am using a windows machine.
2.
The next step we will go to our vulnerable website http://testphp.vulnweb.com/ and take a look at the different web pages we will see a login in screen that may be vulnerable. If we want to scan the website we will need to enter the website in vega. And choose the modules we want to use.
![](https://static.wixstatic.com/media/743c93_bb9fbec9840348bc962b41702ca660c4~mv2.png/v1/fill/w_353,h_355,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_bb9fbec9840348bc962b41702ca660c4~mv2.png)
![](https://static.wixstatic.com/media/743c93_dea92de194c14d92b5af23438cff8bed~mv2.png/v1/fill/w_403,h_230,al_c,q_85,enc_auto/743c93_dea92de194c14d92b5af23438cff8bed~mv2.png)
![](https://static.wixstatic.com/media/743c93_36bae826b8a3437ea277cc1059cb0c2b~mv2.png/v1/fill/w_414,h_416,al_c,q_85,enc_auto/743c93_36bae826b8a3437ea277cc1059cb0c2b~mv2.png)
![](https://static.wixstatic.com/media/743c93_d87a1f05cd884ccaa4df3e1fe26ad5b9~mv2.png/v1/fill/w_381,h_370,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_d87a1f05cd884ccaa4df3e1fe26ad5b9~mv2.png)
![](https://static.wixstatic.com/media/743c93_f82b4c46aef94b45aa56b7293c4bcb6f~mv2.png/v1/fill/w_366,h_224,al_c,q_85,enc_auto/743c93_f82b4c46aef94b45aa56b7293c4bcb6f~mv2.png)
![](https://static.wixstatic.com/media/743c93_7d94cf397ee34ceaabba0f995ff6db49~mv2.png/v1/fill/w_356,h_232,al_c,q_85,enc_auto/743c93_7d94cf397ee34ceaabba0f995ff6db49~mv2.png)
3.
In the modules we can detail down to exactly what we want to test for sucha s XSS injection , Blind SQL Text Injection Differential checks, HTTP Header checks and more.
![](https://static.wixstatic.com/media/743c93_d8f2ee3574894d549eddb7297e20ecc6~mv2.png/v1/fill/w_395,h_235,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_d8f2ee3574894d549eddb7297e20ecc6~mv2.png)
![](https://static.wixstatic.com/media/743c93_2ecfe96481954925b3e68546bca454e5~mv2.png/v1/fill/w_217,h_171,al_c,q_85,enc_auto/743c93_2ecfe96481954925b3e68546bca454e5~mv2.png)
![](https://static.wixstatic.com/media/743c93_abb6a8da3d1f42d181cd7e39a49085c9~mv2.png/v1/fill/w_382,h_276,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_abb6a8da3d1f42d181cd7e39a49085c9~mv2.png)
4.
Next we will hit scan and continue. We will then wait for the scan.
5.
When it is finished we will see that we have results for cross site scripting and sql injection in the high alert category. Also cleartext password over HTTP in high category.
![](https://static.wixstatic.com/media/743c93_052acf547011451b8980afc10e6e3fb4~mv2.png/v1/fill/w_387,h_220,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_052acf547011451b8980afc10e6e3fb4~mv2.png)
![](https://static.wixstatic.com/media/743c93_052aab0093d94dc4b1e58d79d5aac9b9~mv2.png/v1/fill/w_412,h_51,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_052aab0093d94dc4b1e58d79d5aac9b9~mv2.png)
![](https://static.wixstatic.com/media/743c93_93890774579149f9b7a007ce9f988c6e~mv2.png/v1/fill/w_359,h_200,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_93890774579149f9b7a007ce9f988c6e~mv2.png)
![](https://static.wixstatic.com/media/743c93_46e946c1432c410d8d11cda997dbf8d9~mv2.png/v1/fill/w_364,h_227,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_46e946c1432c410d8d11cda997dbf8d9~mv2.png)
![](https://static.wixstatic.com/media/743c93_ba6c7e5dc44047339d621bd745fc1cc8~mv2.png/v1/fill/w_265,h_186,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_ba6c7e5dc44047339d621bd745fc1cc8~mv2.png)
![](https://static.wixstatic.com/media/743c93_998af363a15b4bd993d6cd387ef2e55e~mv2.png/v1/fill/w_311,h_78,al_c,q_85,enc_auto/743c93_998af363a15b4bd993d6cd387ef2e55e~mv2.png)
![](https://static.wixstatic.com/media/743c93_0ca12dcfae15444aaa56efecc8af073e~mv2.png/v1/fill/w_375,h_120,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_0ca12dcfae15444aaa56efecc8af073e~mv2.png)
6.
If we look at the login php for the clear text password we can see the Request for the website, Discussion which explains what was found , and the impact. There is also a remediation tab.
7.
Next we will look into the search.php resource in High. The classifction is stated as an input validation Error . We can see that Cross site scripting is being defined in the discusion field. Cross site scripting is a class of vulnerabilities affecting web applications that can result in security controls implemented in browsers being circumvented.
8.
We will then look in to the web application website coding and look at the form actions
9.
IN the search box we run <script> xss</script> and in the website will get a box that shows that this is succeptable. A more sophisticated java script could pull data from the website.
![](https://static.wixstatic.com/media/743c93_406b95125ff4447299a6a4136006ba8e~mv2.png/v1/fill/w_324,h_215,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_406b95125ff4447299a6a4136006ba8e~mv2.png)
![](https://static.wixstatic.com/media/743c93_0acbdd19767643aa81ca73dac30b2290~mv2.png/v1/fill/w_316,h_215,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_0acbdd19767643aa81ca73dac30b2290~mv2.png)
![](https://static.wixstatic.com/media/743c93_8efa57d93e8847fba985bab8282d3f59~mv2.png/v1/fill/w_295,h_186,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_8efa57d93e8847fba985bab8282d3f59~mv2.png)
![](https://static.wixstatic.com/media/743c93_df1fd24e81e4406193d7ff6fc9c48b36~mv2.png/v1/fill/w_412,h_217,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_df1fd24e81e4406193d7ff6fc9c48b36~mv2.png)
10.
Next we will also scan our second website for vulnerabilities. The website is demo.testfire.net
11.
We will then look at the resuults of the scan once it was finished we will look at the results in the summary we see that clear text password over HTTP and cross site scripting are in that high category.
12.
If we look into the cross site scripting category in the second website the classification is input validation error and see the request and discussion. Almost similar to the first.
![](https://static.wixstatic.com/media/743c93_f3ee28f0134e435d8eb981817dc8810a~mv2.png/v1/fill/w_326,h_173,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_f3ee28f0134e435d8eb981817dc8810a~mv2.png)
![](https://static.wixstatic.com/media/743c93_5a1356d6ed124cda869f68a880dc66da~mv2.png/v1/fill/w_464,h_233,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_5a1356d6ed124cda869f68a880dc66da~mv2.png)
![](https://static.wixstatic.com/media/743c93_629c72fb96eb46f4a80021d226a94254~mv2.png/v1/fill/w_327,h_209,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_629c72fb96eb46f4a80021d226a94254~mv2.png)
![](https://static.wixstatic.com/media/743c93_f6ba393a07ef4abb9b268bb9847ae269~mv2.png/v1/fill/w_327,h_90,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_f6ba393a07ef4abb9b268bb9847ae269~mv2.png)
![](https://static.wixstatic.com/media/743c93_4800cbe37d894191aa782b61646e4009~mv2.png/v1/fill/w_392,h_225,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_4800cbe37d894191aa782b61646e4009~mv2.png)
![](https://static.wixstatic.com/media/743c93_2bee9641dc9e47729fd1aee833a7d8da~mv2.png/v1/fill/w_387,h_29,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_2bee9641dc9e47729fd1aee833a7d8da~mv2.png)
![](https://static.wixstatic.com/media/743c93_078128102e994b0fac2f4a8a7e11a85d~mv2.png/v1/fill/w_406,h_146,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_078128102e994b0fac2f4a8a7e11a85d~mv2.png)
![](https://static.wixstatic.com/media/743c93_55949f632caa4ff09d8da4d960e2df74~mv2.png/v1/fill/w_374,h_189,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_55949f632caa4ff09d8da4d960e2df74~mv2.png)
13.
Next we will look in the send feedback field where this vulnerability lies. We will then enter the <script> xss</script> into the question field.
14.
We will also look at the SQL Injection form and we will look at the Request and resource content.
15.
We will then look at the list of products and we see the cat in the URL and us ' after the 1 and enter. We will then see we can enter that SQL can be entered in the field.
![](https://static.wixstatic.com/media/743c93_ddc82405c89d4536bbcbccbf1c6c1c2a~mv2.png/v1/fill/w_374,h_187,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_ddc82405c89d4536bbcbccbf1c6c1c2a~mv2.png)
![](https://static.wixstatic.com/media/743c93_efa10d98a8be4d50926435b653ca86bb~mv2.png/v1/fill/w_392,h_14,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_efa10d98a8be4d50926435b653ca86bb~mv2.png)
![](https://static.wixstatic.com/media/743c93_fef5ab91c5084d3e9464be139ca2ad7c~mv2.png/v1/fill/w_352,h_19,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_fef5ab91c5084d3e9464be139ca2ad7c~mv2.png)
16.
Next we will exploit with SQLMAP. We must go to the sql map directory C:\Users\Administrator\Desktop\sqlmapproject-sqlmap-1.7.2-20-gd42174e>cdsqlmapproject-sqlmap-d42174e. And run sqlmap.py-h.
17.
Next we will scan the url using this command
C: \Users \Administrator\ Desktop\sqlmapproject-sqlmap-1.7.2-20-gd42174e\sqlmapproject-sqlmap-d42174e>sq1map.py -u http://testphp.vulnweb.com/l
istproducts.php?cat=1
![](https://static.wixstatic.com/media/743c93_d2cc3fb394da4ba5935ec7677593f211~mv2.png/v1/fill/w_375,h_228,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_d2cc3fb394da4ba5935ec7677593f211~mv2.png)
![](https://static.wixstatic.com/media/743c93_ed2bda8fb17f4a6599d3204b9b3c01d7~mv2.png/v1/fill/w_356,h_91,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_ed2bda8fb17f4a6599d3204b9b3c01d7~mv2.png)
![](https://static.wixstatic.com/media/743c93_c43aec1a8382469390b61d078f16374b~mv2.png/v1/fill/w_346,h_33,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_c43aec1a8382469390b61d078f16374b~mv2.png)
![](https://static.wixstatic.com/media/743c93_3bbdfec131d74b35a82213b8fcd57b44~mv2.png/v1/fill/w_379,h_45,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_3bbdfec131d74b35a82213b8fcd57b44~mv2.png)
![](https://static.wixstatic.com/media/743c93_4bf90ef996034d1090e5f25deeaa1fb4~mv2.png/v1/fill/w_360,h_33,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_4bf90ef996034d1090e5f25deeaa1fb4~mv2.png)
![](https://static.wixstatic.com/media/743c93_638bb3c8e1dc4414905e0ff32588cb2b~mv2.png/v1/fill/w_405,h_109,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_638bb3c8e1dc4414905e0ff32588cb2b~mv2.png)
18.
Next we run sqlmap.py-uhttp://testphp.vulnweb.com/1
istproducts.php?cat=1 --dbs --batch to get the name of the database .
19.
Next get name of current database
20.
Next we run sqlmap.py -u http://testphp.vulnweb.com/1
istproducts.php?cat=1 -D acuart --tables in order to get tables.
![](https://static.wixstatic.com/media/743c93_876754db55d44b779a54c1c7db3ddffc~mv2.png/v1/fill/w_397,h_14,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_876754db55d44b779a54c1c7db3ddffc~mv2.png)
![](https://static.wixstatic.com/media/743c93_3a4c7e3ed89a4716aead886ce9c4e2be~mv2.png/v1/fill/w_372,h_131,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_3a4c7e3ed89a4716aead886ce9c4e2be~mv2.png)
21.
Next I'll get the users and use option -T to get a specific tables columns. Run
sqlmap.py -u http://testphp.vulnweb.com/listoroducts.cho?cat=1 -D acuart -T users --columns
22.
Next run , sq1map.py -u http://testphp.vulnweb.com/1istproducts.php?cat=1 -D acuart -T users -C uname, pass- - dump to dump user name and password
Remediating Clear Text Passed Over HTTP Steps :
1. Implement HTTPS:
Use HTTPS (Hypertext Transfer Protocol Secure) to encrypt the communication between the client and the server. This ensures that data transmitted between them is encrypted and cannot be easily intercepted. To implement HTTPS:
Acquire an SSL/TLS certificate from a trusted certificate authority (CA).
Configure your web server (e.g., Apache, Nginx) to enable HTTPS and use the acquired certificate.
Update your web application code to use https:// URLs instead of http:// for all resources.
2. Update URLs:
Ensure that all resources (images, scripts, stylesheets, etc.) referenced in your web application are loaded via HTTPS. Mixed content (HTTP content on an HTTPS page) can lead to security warnings and potential vulnerabilities.
3. HSTS (HTTP Strict Transport Security):
Implement HSTS in your web application to instruct browsers to always use HTTPS for communication. This prevents users from accessing your site via HTTP, even if they type in an HTTP URL. To enable HSTS, add the following header to your server configuration:
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
4. Content Security Policy (CSP):
Implement CSP to mitigate the risk of cross-site scripting (XSS) attacks by controlling what sources of content are allowed to be loaded on your web pages. A well-configured CSP can prevent the execution of malicious scripts. Example header:
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; img-src 'self' data:
5. Secure Cookies:
If your application uses cookies, ensure that the Secure flag is set. This ensures that cookies are only sent over secure (HTTPS) connections.
6. Avoid Query Parameters for Sensitive Data:
Avoid passing sensitive information like passwords, API keys, or personal data in the query parameters of URLs. Instead, use POST requests and pass data in the request body.
7. Use POST Instead of GET:
For sensitive operations, use HTTP POST requests instead of GET requests. Data sent via POST is not exposed in the URL.
8. Input Validation and Output Encoding:
Implement proper input validation and output encoding to prevent injection attacks (e.g., SQL injection, XSS).
9. Regular Security Audits:
Conduct regular security audits and vulnerability assessments of your web application to identify and address potential security issues.
10. Stay Updated:
Stay informed about the latest security best practices and vulnerabilities in web development to keep your application secure over time.
Remediating cross-site scripting (XSS) vulnerabilities in web applications:
1. Identify Vulnerable Areas:
Use security testing tools, manual code review, and penetration testing to identify the specific areas of your application that are vulnerable to XSS attacks. Look for places where user inputs are not properly sanitized before being displayed or executed.
2. Contextual Output Encoding:
Implement proper output encoding based on the context in which the data will be displayed. Use appropriate encoding functions for HTML, JavaScript, and other contexts. For example, use htmlspecialchars() in PHP for HTML output, or equivalent functions in other programming languages.
3. Use Content Security Policy (CSP):
Implement a Content Security Policy (CSP) to restrict which sources of content (scripts, styles, images, etc.) are allowed to be executed on your web page. This can help mitigate the impact of XSS attacks by limiting the potential sources of malicious content.
4. Input Validation and Sanitization:
Validate and sanitize user inputs before using them in the application. Reject or sanitize inputs that contain potentially malicious content. Regular expressions, input validation libraries, and language-specific validation functions can be helpful.
5. Use Framework Security Features:
If you're using a web framework, utilize its built-in security features for input validation and output encoding. Many frameworks provide functions and tools to handle these tasks securely.
6. Avoid Inline JavaScript:
Minimize the use of inline JavaScript code within your HTML documents. Instead, separate your JavaScript into external files and link to them using the <script> tag.
7. Escaping Data:
Escape dynamic data before embedding it within HTML, JavaScript, CSS, and other contexts. Escaping means converting characters that have special meaning in these contexts to their corresponding safe representations.
8. Regular Updates:
Keep your web application and all its components (libraries, plugins, frameworks) up to date. Security patches may be released to address known vulnerabilities, including XSS vulnerabilities.
9. Education and Training:
Educate your development team about secure coding practices and the risks associated with XSS vulnerabilities. Regular training can help prevent introducing new vulnerabilities in the codebase.
10. Security Testing:
Conduct regular security assessments, including both automated vulnerability scans and manual penetration testing, to identify and address any new XSS vulnerabilities that might arise during the development lifecycle.
11. Secure Coding Guidelines:
Develop and follow secure coding guidelines that address XSS vulnerabilities and other common security issues. These guidelines can help maintain consistency in your development practices.
12. Secure Development Lifecycle:
Integrate security practices into your software development lifecycle. Include security reviews and testing at various stages of development to catch and fix vulnerabilities early.