B
B
betal2012-10-04 20:55:33
PHP
betal, 2012-10-04 20:55:33

An interesting task in PHP

I liked one of the tasks from one of the latest CTFs for its simplicity, I suggest breaking your head a little.
There is an executable script:

<?php
    $key = "KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK";
    $pass = "KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK";
    if ( strcasecmp( $_GET['pass'], $pass ) == 0 ) {
        echo($key);
    }
?>


Actually the question is in obtaining the key, how to do it?
Where is the vulnerability that many of us tend to leave behind?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
B
BoShurik, 2012-10-04
@BoShurik

?pass[]=something

E
egorinsk, 2012-10-04
@egorinsk

Oh may may, what a cant in PHP, I immediately remember another confusion in the return values ​​​​in strpos () when it can return 0 or false

B
betal, 2012-10-04
@betal

I'm afraid many do not check the type of input parameters in GET.

D
Doktor_Gradus, 2012-10-04
@Doktor_Gradus

Here's another question for you then. If you do this:
switch( $_GET['pass'] ) { // ... }
do you need to check $_GET['pass']?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question