DVWA
  • Introduction
  • About The Author
  • Brute Force
    • Pengenalan
    • Low
    • Medium
    • High
  • Command Injection
    • Pengenalan
    • Low
    • Medium
    • High
  • CSRF
    • Pengenalan
    • Low
    • Medium
    • High
  • File Inclusion
    • Pengenalan
    • Low
    • Medium
    • High
  • File Upload
    • Pengenalan
    • Low
    • Medium
    • High
  • SQL Injection
    • Pengenalan
    • Low
    • Medium
    • High
  • SQL Injection (Blind)
    • Pengenalan
    • Low
    • Medium
    • High
  • XSS (DOM)
    • Pengenalan
    • Low
    • Medium
    • High
  • XSS (Reflected)
    • Pengenalan
    • Low
    • Medium
    • High
  • XSS (STORED)
    • Pengenalan
    • Low
    • Medium
    • High
  • CSP Bypass
    • Pengenalan
    • Low
    • Medium
    • High
Powered by GitBook
On this page
  • Mencari Informasi
  • Melakukan Serangan

Was this helpful?

  1. Command Injection

High

Command Injection level High on DVWA

Di bawah ini adalah source-code dari command injection level high di DVWA.

vulnerabilities/exec/source/high.php
<?php

if( isset( $_POST[ 'Submit' ]  ) ) {
    // Get input
    $target = trim($_REQUEST[ 'ip' ]);

    // Set blacklist
    $substitutions = array(
        '&'  => '',
        ';'  => '',
        '| ' => '',
        '-'  => '',
        '$'  => '',
        '('  => '',
        ')'  => '',
        '`'  => '',
        '||' => '',
    );

    // Remove any of the charactars in the array (blacklist).
    $target = str_replace( array_keys( $substitutions ), $substitutions, $target );

    // Determine OS and execute the ping command.
    if( stristr( php_uname( 's' ), 'Windows NT' ) ) {
        // Windows
        $cmd = shell_exec( 'ping  ' . $target );
    }
    else {
        // *nix
        $cmd = shell_exec( 'ping  -c 4 ' . $target );
    }

    // Feedback for the end user
    echo "<pre>{$cmd}</pre>";
}

?>

Mencari Informasi

Melakukan Serangan

Sekarang kita coba menginputan 8.8.8.8 |whoami seperti berikut:

PreviousMediumNextPengenalan

Last updated 5 years ago

Was this helpful?

Pada level ini, blacklist yang diberikan menjadi semakin banyak. Tetapi jika kita teliti, di baris ke-11 terdapat celah . '| ' => '' terdapat spasi setelah | . Ini bisa kita manfaatkan dengan cara menjalankan perintah langsung tanpa spasi setelah |.

Yups! Berhasil. Dari sini kita belajar bahwa kita harus teliti. Semangat!

😁
😝