Injection or bad in anyway?
#8
yes, it becomes escaped \n as well, I am trying to find what my insertion code is missing that properly makes new lines accepted.

Ok I think I understood it? This is from the newthread.php:

	// Set up posthandler.
	require_once MYBB_ROOT."inc/datahandlers/post.php";
	$posthandler = new PostDataHandler("insert");
	$posthandler->action = "thread";

	// Set the thread data that came from the input to the $thread array.
	$new_thread = array(
		"fid" => $forum['fid'],
		"subject" => $mybb->get_input('subject'),
		"prefix" => $mybb->get_input('threadprefix', MyBB::INPUT_INT),
		"icon" => $mybb->get_input('icon', MyBB::INPUT_INT),
		"uid" => $uid,
		"username" => $username,
		"message" => $mybb->get_input('message'),
		"ipaddress" => $session->packedip,
		"posthash" => $mybb->get_input('posthash')
	);
$posthandler->set_data($new_thread);

escapes are not used at all in there, then further looking at the post handler the escaping is automatically done there.

			$this->post_insert_data = array(
				"subject" => $db->escape_string($thread['subject']),
				"icon" => (int)$thread['icon'],
				"username" => $db->escape_string($thread['username']),
				"dateline" => (int)$thread['dateline'],
				"message" => $db->escape_string($thread['message']),
				"ipaddress" => $db->escape_binary(my_inet_pton(get_ip())),
				"includesig" => $thread['options']['signature'],
				"smilieoff" => $thread['options']['disablesmilies'],
				"visible" => $visible
			);

So I am technically double escaping it hence why it doesn't work. So in the outside layer I don't have to worry about escaping it and when I send it to the post handler it will do all the work?

Did I get it right?
Reply


Messages In This Thread
Injection or bad in anyway? - by sleeping - 2015-10-23, 10:57 AM
RE: Injection or bad in anyway? - by Omar G. - 2015-10-23, 11:21 PM
RE: Injection or bad in anyway? - by sleeping - 2015-10-24, 07:52 AM
RE: Injection or bad in anyway? - by dragonexpert - 2015-10-24, 01:04 PM
RE: Injection or bad in anyway? - by sleeping - 2015-10-24, 05:03 PM
RE: Injection or bad in anyway? - by Omar G. - 2015-10-24, 05:28 PM
RE: Injection or bad in anyway? - by sleeping - 2015-10-24, 05:29 PM
RE: Injection or bad in anyway? - by Omar G. - 2015-10-25, 04:51 AM

Forum Jump:


Users browsing this thread: 3 Guest(s)