permitted_uri_chars in application/config.php not working [serious vulnerability] |
[eluser]Keat Liang[/eluser]
Bitbucket Issue Tracker Link some illegal character in URL is not block by the filter = * , are blocked by the framework but "^", "`", single quote, and double quote are not blocked by the uri/URL filter tested with latest CodeIgniter Reactor build 6b1e35f45ca5 some how it broken and not working anymore....
[eluser]Twisted1919[/eluser]
How is this a security issue, could you share a line of code[exploit] to demonstrate the vulnerability ?
[eluser]Keat Liang[/eluser]
if i using pagination lib and my application is accept and using active record, controller Code: class Exploit extends SOME_dry_STUFF{ model Code: class News_letter_model extends CI_Model{ request made BTW the single quote is purposely put there to make SQL error Code: index.php/news_letter/visitor/ban/7' error message will appear. i know i should turn off db debug, but sometime shit happen ![]() IM using HMVC BTW Code: A Database Error Occurred some SQL injection tool try to do some evil thing,,,, potential SQL injection ![]() Code: Analyzing http://localhost/index.php/news_letter/visitor/ban/1 because of the url allow single quote which default does not. but it allow it anyway......... test under mac osx 10.6.7
[eluser]Keat Liang[/eluser]
btw another bug also filed https://bitbucket.org/ellislab/codeignit...n-have-sql
[eluser]Keat Liang[/eluser]
bug demo, uri that does not block http://www.websitedeveloper.com.my/ci/Co...ome/index/'"`^ uri that block http://www.websitedeveloper.com.my/ci/Co...ome/index/!@$
[eluser]osci[/eluser]
I don't know if it should be escaped or not by limit. But in your example you are protecting your search variable and not limit or offset or domain that you accept from the url. Shouldn't you escape everything you get from the url?
[eluser]Keat Liang[/eluser]
$this->db->limit($limit, $offset); is belong to active record. and it should be automatically escape value. i protecting the search variable because it is using custom where clause Code: $this->db->where("(user_id LIKE '%$like_str%' OR these where clause below will automatic escape since in the user guide says: http://ellislab.com/codeigniter/user-gui...ecord.html Beyond simplicity, a major benefit to using the Active Record features is that it allows you to create database independent applications, since the query syntax is generated by each database adapter. It also allows for safer queries, since the values are escaped automatically by the system Code: //auto escape yay ! by combine both uri exploit allow some illegal character and the limit function does not escape value then other ppl assume is safe.... CI still awesome ! sorry for my poor english ![]()
[eluser]Keat Liang[/eluser]
[quote author="osci" date="1308261566"]I don't know if it should be escaped or not by limit. But in your example you are protecting your search variable and not limit or offset or domain that you accept from the url. Shouldn't you escape everything you get from the url?[/quote] i suggest the limit function(active record) should using is_numeric() to validate the data. since it SQL LIMIT only accept INT
[eluser]osci[/eluser]
[quote author="Keat Liang" date="1308262408"] i suggest the limit function(active record) should using is_numeric() to validate the data. since it SQL LIMIT only accept INT[/quote] True. Checked at mysql docs and LIMIT can be non negative integer with the exception of prepared statements and stored programs, which don't imply for active record.
[eluser]Twisted1919[/eluser]
You might be right, the limit() method does not seem to escape the values. Even though the params given to this method should be integers, as you noticed, strings can be passed. I do type casting for this method anyway[ie: (int)$limit, (int)$offset], but there might be developers who didn't do it, so it will be a security risk after all. Hope somebody from the development team will look into this. |
Welcome Guest, Not a member yet? Register Sign In |