Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#51 Re: Core development » New parser » 2011-04-04 03:31:58

Smartys

Happy to help smile

#52 Re: Core development » New parser » 2011-04-04 02:30:12

Smartys

And there's an actual XSS vulnerability in how the email tag is handled.

[email]test" style="position: absolute; z-index: 9999; top: 0; left: 0; font-size: 100pt; line-height: 100pt;" onmouseover="alert(1)[/email]

Using the NO_ATTR form of the email tag allows a malicious user to include a string that contains unescaped quotation marks. That allows for malicious input, like so.

#53 Re: Core development » New parser » 2011-04-04 02:08:38

Smartys

FYI, there's a security bug in how parser errors are handled in post.php and edit.php. The content of error messages is not escaped in any way, and some error messages are allowed to hold user input. For instance, pasting the following message will trigger a JavaScript alert:

[url=<script>alert(1)</script>]test[/url]

#54 Re: FluxBB discussion » how does Fluxbb solve these security problems? » 2011-03-29 04:59:27

Smartys

1. You have to fix it yourself.
2. No. Again, you can not escape data on input and expect it to magically be safe in all output contexts.
3. Not really, no.

#55 Re: Core development » PDO binding arrays » 2011-03-28 15:23:22

Smartys

Sorry: you're right, my previous statement was slightly incorrect. The named parameters used to construct the initial query have to use colons: the colons are optional when passing in values to be used with the query.

#56 Re: Core development » PDO binding arrays » 2011-03-28 14:26:45

Smartys
Garciat wrote:
$query->where = 'u.id IN :uids';
$params = array(':uids' => $user_ids);

In line 2, must array keys for the parameters start with ':' (colon)? What if they don't?

Then it won't work. That's how named parameters are implemented. See http://php.net/manual/en/pdo.prepare.php

Prepares an SQL statement to be executed by the PDOStatement::execute() method. The SQL statement can contain zero or more named (:name) or question mark (?) parameter markers for which real values will be substituted when the statement is executed.

#57 Re: FluxBB discussion » how does Fluxbb solve these security problems? » 2011-03-28 01:44:30

Smartys
taylorchu wrote:

I dont understand how those code examples work? could you explain?

The first one uses htmlspecialchars to sanitize input when the output context is a single-quoted JavaScript string (I could have used a single-quoted attribute in an HTML tag just as easily). An attacker can break out of that since single quotes aren't escaped by default in htmlspecialchars.

The second example uses UTF-7 character encoding. That's a little too much to get into here, but check out http://openmya.hacker.jp/hasegawa/security/utf7cs.html

#58 Re: FluxBB discussion » how does Fluxbb solve these security problems? » 2011-03-27 23:45:23

Smartys

Though I can't think many sites are going to have user-facing scripts which perform those types of queries on user input data.

It is a corner case, but PunBB-Hosting creates tables and indexes based on user input wink

#59 Re: FluxBB discussion » how does Fluxbb solve these security problems? » 2011-03-27 22:42:44

Smartys

is it still dangerous if I use post method

Yes

all $_GET variable at that stage is checked by isValidEntry(). so it is safe.

Really? What about

2011-03-262345314d8e7a9bf191c.dat.php%00"><script>alert(1)</script>

That's symptomatic of a larger problem (you're not running your inputs through a function like basename even when they're treated as filenames) but it should still work (at least if you're not running the latest version of PHP 5.3).

because all variables will be htmlspecialchars-ed only once. Instead I could do the same way on output, but that will run htmlspecialchars many times when output, which is wasteful.(read several times, but only write once)

OK, you seem to have missed my point: that htmlspecialchars is not some magic function that makes your input safe. Lets take two theoretical examples:

1.

<script type="text/javascript">
var text = '<?php echo htmlspecialchars($_GET['text']) ?>';
</script>

2.

<?php
header('Content-Type: text/html; charset=utf-7');
echo htmlspecialchars($_GET['text']);

"Escape once, output everywhere" is not a valid solution (and as I've said, it just means you're shifting the need to escape from output to input: you'll cause a lot of subtle bugs because you forgot to use htmlspecialchars before a comparison). If you're really so concerned about the amount of time your system takes to run htmlspecialchars, I'd recommend using Varnish or another caching server.

#60 Re: FluxBB discussion » how does Fluxbb solve these security problems? » 2011-03-27 21:41:36

Smartys

Well, you don't appear to have any CSRF protection.

Edit: And I see some XSS. Check out line 124.

Also, you seem to be using htmlspecialchars on input instead of output: that's the wrong way to do things. You're applying a generic input escaping mechanism on input instead of context-specific mechanisms on output (and you're doing it haphazardly: usernames aren't run through htmlspecialchars in all instances, for example).

#61 Re: FluxBB discussion » how does Fluxbb solve these security problems? » 2011-03-27 21:13:31

Smartys
Reines wrote:

To be fair, SQL injections are easy to solve - it's just a lot of software doesn't do it correctly.

As with many areas of computer security, it's not quite so easy as it appears. wink

For typical query workloads (INSERT/SELECT/UPDATE/DELETE) where all you're doing is adding parameters to your WHERE clause, it can be as easy as always using parameterized queries.

Now, think about the IN clause. As you showed earlier today, it's slightly more complicated than a simple parameterized query. You'd be surprised how many sites will handle IN clauses via raw string concatenation simply because the values can't be used directly in parameterized queries.

Now, try playing around with column names or table names (like in ORDER BY, FROM, or other clauses). Life gets a little bit more tedious: you have to using string concatenation, for which you have to design a whitelist of some kind in order to be secure.

Now, try playing around with some more esoteric statements: ALTER TABLE, CREATE TABLE, DROP TABLE, etc. You can't use parameterized queries here at all. If you use string concatenation here, you're very likely to mess things up.

Then of course you have your own customized database layer, which anyone may happen to circumvent because when they call mysql_query, it picks up the database from the environment and lets them bypass your protection entirely.

So yes, for a lot of use cases it's simple to recommend parameterized queries. Unfortunately, those implementations are subject to many of the same kind of vulnerabilities as the rest of the code. SQL injection is not a solved problem.

Edit: And a real world example:

http://groups.google.com/group/rubyonra … 2cf6bf4eed | Potential SQL Injection in Rails 3.0.x (via LIMIT clause)

#62 Re: FluxBB discussion » how does Fluxbb solve these security problems? » 2011-03-27 21:03:15

Smartys
taylorchu wrote:

I know that XSS and SQL problems are easy to solve.

That is patently false. Want an example from earlier today? MySQL.com was vulnerable to a SQL injection.

#63 Re: FluxBB discussion » how does Fluxbb solve these security problems? » 2011-03-27 20:49:51

Smartys

As an aside, if there were a fool-proof way to solve these "security problems," I would be out of a job wink

Edit: To be clear, there are ways to systematically reduce the possibility of some of these attacks.

XSS: Always display content using a system that has been designed to provide context-aware escaping. For an example of such a system, see https://github.com/facebook/xhp/.
SQL Injection: Always use parameterized queries: never ever use string concatenation when constructing queries except on a whitelist of values.
Spoofed Form Input: One method: define all of the forms in code, along with validators. When a form is POSTed back, look up the relevant form and parse the input according to the validators. See Zend_Form (which also handles markup).
CSRF: Random per-user (or per-user per-page) nonces, as Reines said
File Uploads: This encompasses a wide range of possible vulnerabilities, so I won't get in to specifics here.

Of course, all of these mechanisms also assume that the relecant security measures are coded without any flaws as well. The odds of that tend to be low wink

#64 Re: Core development » PDO binding arrays » 2011-03-27 14:41:26

Smartys

No, parameters with incrementing numbers is the proper way to handle it.

#65 Re: General support (1.4) » What about glob desactived. » 2011-03-25 00:36:34

Smartys

http://bugs.php.net/41655

A bug that has been fixed for several years, which is only applicable when using deprecated PHP options that don't actually enforce security. wink

#66 Re: FluxBB discussion » [Discussion] Potential security flaws » 2011-03-21 22:33:57

Smartys
Reines wrote:

PS. Saying you want to discuss "major security flaws" on FluxBB implies you know there are some. I'm not sure if maybe English isn't your first language, but you should say "potential security flaws" unless you specifically know some exist.

Quoted for truth. wink

#68 Re: General support (1.4) » Unable to fetch topic info » 2011-03-16 03:03:00

Smartys
mexandre wrote:

Ok, I had that when I installed 1.4.4. So, I have used the punbb debug and found out that it was a "die" script on a query. So I unmarked before "or die" and it fixes the bug.

Or, said another way, the query silently fails but you let the script continue to function wink

#69 Re: General support (1.4) » Call to a member function escape() on a non-object in ....functions.ph » 2011-03-13 17:55:29

Smartys

adaur: Use htmlspecialchars on that on the security gnomes will destroy you wink

#70 Re: Core development » Working on FluxBB 2.0 » 2011-03-12 05:21:05

Smartys

http://progit.org/book/ch6-6.html

The last main caveat that many people run into involves switching from subdirectories to submodules

#71 Re: Programming » Select IP address of last post (multiple users) » 2011-03-11 13:59:04

Smartys

IN (SELECT ...) in MySQL is very poorly optimized, as you've seen. I don't have any citations, but it might even run the inner subquery multiple times rather than caching the result.

Edit: Citation: http://news.ycombinator.com/item?id=2206359

#72 Re: Programming » Select IP address of last post (multiple users) » 2011-03-11 13:02:42

Smartys

Well, I'm asking two things:

1. Why is what you posted a problem
2. Why doesn't

SELECT MAX(p2.id), p2.poster_ip FROM (SELECT p.id, p.poster_id, p.poster_ip FROM pun_posts AS p GROUP BY p.poster_id ORDER BY p.id DESC) AS p2 WHERE [stuff]

work for you?

#75 Re: Programming » Select IP address of last post (multiple users) » 2011-03-11 00:35:34

Smartys

Why can't you just use

SELECT p.poster_id, p.poster_ip FROM pun_posts AS p GROUP BY p.poster_id ORDER BY p.id DESC

as a derived table? It's not clear what your constraint is.

Board footer

Powered by FluxBB 1.4.8