Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 06:33 am EST
Geeklog Forums
Apostrophe in email address.
Anonymous
Anonymous
Hey...I have a problem when somebody tries to register on my site, and they have an apostrophe in their email address:eg: registering with an email address of: test.this'email@mydomain.com, results in the following error message in the browser (and in the log)1064: You have an error in your SQL syntax near 'email@mydomain.com'' at line 1 SQL in question: SELECT COUNT(*) FROM gl_users WHERE email = 'test.this'email@mydomain.com'Anybody else have this problem (and a fix)?...deon
24
21
Quote
Status: offline
ScurvyDawg
Forum User
Full Member
Registered: 11/06/02
Posts: 523
An apostrophe is not a valid email character as far as I know. Hence, GL does not allow something it knows is invalid.
13
12
Quote
Anonymous
Anonymous
This looks like a serious security threat. If what you report is
true, then geeklog is passing unchecked text from the user
directly to MySQL. You must always always always check
user text and escape special characters, like the apostrophe
which to SQL signals the end of a text string. What if instead
of your example you had sent this as the email address:
"test'; drop database mysql;" or something similarly sinister?
Bad things.
11
21
Quote
Status: offline
rawdata
Forum User
Full Member
Registered: 02/17/03
Posts: 236
Geeklog produces this error message when you try to use a bad email address in registering. Go ahead and test it out yourself using his example.
Error
The email address provided does not appear to be a valid email address
It's very interesting that you think malicious code such as dropping a database can be executed when added to the where part of a SQL count statement and used for comparison with emails stored in the database. Why don't you give us an example where someone can actually execute malicious code for particular SQL statement in the where clause? I don't believe it can be done but go ahead and give an example that really works.
20
12
Quote
Anonymous
Anonymous
OK - my geeklog is not stopping that then - where should I look to see if that part of the code is broken?
16
14
Quote
Anonymous
Anonymous
Is that in an RFC somewhere? Which one?
...deon
8
16
Quote
Anonymous
Anonymous
Hey Dirk, this error is caught in DB_count, BEFORE geeklog validates the email address via COM_isemail - should this change then?
...deon
10
16
Quote
Anonymous
Anonymous
I noticed that the search function also returns errors when there is an apostraphe. That might be a security risk as well.
-Rob
18
19
Quote
Anonymous
Anonymous
Have a look on my site www.tuganz.org. Its on the "New User" (left block), username (anything), email (with an apostrophe) and I get the 1064 SQL error.
In users.php, it is calling a SELECT COUNT(*) to see how many usernames and email addresses exist before it validates the email address.
Let me know if you find out something is broke..
...deon
29
16
Quote
Me
Anonymous
RFC 2822
http://tools.ietf.org/html/rfc2822#section-3.4.1
Apostrophes are allowed.
16
21
Quote
All times are EST. The time is now 06:33 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content