vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Input Cleaning (https://vborg.vbsupport.ru/showthread.php?t=125013)

Kirk Y 08-26-2006 11:20 PM

Input Cleaning
 
Okay, somebody save me from myself. I can't get my request to clean.

Code:

$pw = $vbulletin->userinfo[password];
$string = md5($pw);
$h =& $vbulletin->input->clean_gpc('r', 'h', TYPE_UINT);

if ($_REQUEST['do'] == 'unsub')
{
  if (md5($h) === $string)
  {
      echo 'correct';
  }
  else
  {
      echo 'incorrect';
  }
}

Now, if I go ahead and just use $_GET instead of cleaning, it works fine -- but it fails if I try to use the cleaned var. What am I missing here?

Code Monkey 08-26-2006 11:47 PM

PHP Code:

$pw $vbulletin->userinfo[password];
$string md5($pw);
$vbulletin->input->clean_array_gpc('r', array(
    
'h' => TYPE_UINT
));

if (
$_REQUEST['do'] == 'unsub')
{
    echo (
md5($vbulletin->GPC['h']) === $string) ? 'correct' 'incorrect';



Kirk Y 08-27-2006 12:34 AM

Still fails incorrect. That's alright though, I'm just going to use $_GET -- it never touches SQL, so I don't see how it could be exploited.

harmor19 08-27-2006 12:51 AM

Why are are seeing if the hash is an integer? Shouldn't it be TYPE_STR?

PHP Code:

$pw $vbulletin->userinfo[password];
$string md5($pw);
$vbulletin->input->clean_array_gpc('r', array(
    
'h' => TYPE_STR
));

if (
$_REQUEST['do'] == 'unsub')
{
    echo (
md5($vbulletin->GPC['h']) === $string) ? 'correct' 'incorrect';



Kirk Y 08-27-2006 12:58 AM

Ha ha... wow. Thanks Harmor, I'm feeling a wee bit stupid.

harmor19 08-27-2006 01:08 AM

Quote:

Originally Posted by acidburn0520
Ha ha... wow. Thanks Harmor, I'm feeling a wee bit stupid.

Everybody has one of those days.
I gave you the idea and I fixed your code.
I want some credit


j/k :)
Good luck on your hack

Kirk Y 08-27-2006 01:19 AM

Ha ha, well I reminded you of your missing table prefixes! :p

Don't worry, I'll mention ya.

(small print though)

Code Monkey 08-27-2006 02:30 AM

There was more wrong than just that.

Kirk Y 08-27-2006 03:05 AM

What else is wrong? Because it's working fine now after changing the type.

harmor19 08-27-2006 03:36 AM

We love seeing you make an ass out of yourself.


All times are GMT. The time now is 06:16 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01096 seconds
  • Memory Usage 1,735KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete