Source Code Review for ASP .NET MVC

 Hi guys. Been a while since I last share something. So, for today I would like to share some knowledge regarding source code review. 

*I'm still beginner in doing source code review.

Recently I've been tasked with doing source code review for some organization and the language used for the application is ASP .NET MVC 5.0. As you all know that this language is now EOL. The last update is on 28 November 2018. This is my first time encountering this language.

Before that, below is the list of tools commonly used when doing source code review that is completely free:-

1) Visual Code Grepper (VCG) - https://github.com/nccgroup/VCG

2) Sublime Text - https://www.sublimetext.com/

3) Notepad++ - https://notepad-plus-plus.org/downloads/


Surprisingly, when running tools such as VCG, I did not found any sql query in the file. I did some research on how the language handle sql query. Also my colleague point out that the sql query is normally handle by .dll file for the language. It was a new knowledge that I gains when doing source code review for this language. 

*Big thanks to my collegue Dollah for pointing it out

After doing some research regarding .dll file, I stumbled upon tools which can read/decompile it. It is called JetBrains which is also an open source tools. Below attached the link for the tools.

https://www.jetbrains.com/decompiler/

After opening the .dll file with this tools, it would look like below image. 


As you can see, we can now see the sql query and start our review. Things to do when doing source code review:-

1) Look for dangerous function

2) Look on how the application handle sql query (whether it is properly sanitized or not)

3) Search for upload/download function if the application have one

4) Look on how the application handle user input

5) Search for hardcoded password/credentials

I also would like to share on some of the upload function found during the review.


As you can see on line 71, the application check for the extension of file. This can still be bypass since it did not use/implement MIME type checking. 

As for line 76, the application prevent any file to upload which has bigger size than 1024. There is smaller one liner code which can be used for webshell. For further reference, can check below link.

https://webshell.co/

That is all for this sharing. Hope you learned something from this post. 

Cheers.









Comments

Popular posts from this blog

Petraware pTransformer ADC before 2.1.7.22827 allows SQL Injection via the User ID parameter to the login form.

Setting up MobSF in Ubuntu 18.04

Setting up RMS in Ubuntu 18.04