3

I know there are some functions in CGI and Java that can be abused to perform remote code execution attack.

For example we can see abuse of "eval" function in Movable Type CMS:

sub core_drop_meta_for_table {my $self = shift;
  my (%param) = @_;
  my $class = $param{class};
  my $sql = $param{sql};eval "require $class;";            <-----------------------------
  my $driver = $class->dbi_driver;
  my $dbh = $driver->rw_handle;
  my $err;
  eval {
    $dbh->do($sql) or $err = $dbh->errstr;
  };
  # ignore drop errors; the column has probably been
  # removed already
  #if ($err) {
  #    print STDERR "$err: $sql\n";
  #}return 0;
}

I want to know if there are other functions that allow the attacker to execute arbitrary command in CGI and Java?

Matthew
  • 61
  • 2

1 Answers1

1

The direct equivalent in Java would been using class loaders or implementing an interpreter particularly if it allows arbitrary method calls through reflection. An IDE or other code viewer that allows tracing back method calls will show you APIs that indirectly use this (or use grep).

Oracle's Secure Coding Guidelines for Java SE has a list of examples in Guideline 3-8 / INJECT-8: Take care interpreting untrusted code.