Fuse Talk vulnerability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



e-zonemedia's Fuse Talk is vulnerable to malicious SQL.  Improper form
sanitization makes it possible for any user to manipulate data as (s)he
feels fit.  On the sign up form (join.cfm) is possible to pass a well
crafted form variable to the action template (it's the same template
subsequently join.cfm) that will execute malicious SQL.  This is made
possible by not filtering the (;) semi-colon. Examine the following code:

1;delete from users

or

1;exec sp_addlogin "OsamaBinLadenSucks"

I don't need to tell you the impact of this code.  Time and time again I see
you guys emphasize the need for proper form validation, but some people
don't listen. I would  have notified the company (www.e-mediazone.com), but
I think this news would be better delivered by a organization known as a
leader in security.  I trust if you choose to publish this vulnerability,
you would do so only after the problem has been rectified.

Thanks

Cole.

p.s.  I've attached the faulty template for your inspection. (look near line
241)
<!--- include header --->
<cfset DocumentTitle = "Join The Forums">
<cfinclude template="include/common/header.cfm">


<!--- javascript open window --->


<script language="javascript">
function AuthorIcon1(url,vara,x,y) {
	var options = "toolbar=no,scrollbars=no,resizable=no,width=" + x + ",height=" + y;
	msgWindow=window.open(url + vara,"WinOpen",options);
}
</script>

<script language="javascript">
function AuthorIcon2(url,x,y) {
	var options = "toolbar=no,scrollbars=yes,resizable=no,width=" + x + ",height=" + y;
	msgWindow=window.open(url,"WinOpen",options);
}
</script>

<!---------------------------------------------------------------------
T O P   H E A D E R
---------------------------------------------------------------------->
	<center>
		<table border="0" cellpadding="0" cellspacing="0" width="97%">
			<tr>
				<td valign="top" align="left">
					<cfinclude template="logocode.cfm">
					<cfinclude template="privatemessagecode.cfm">
				</td>
				<td align="right" valign="bottom"></td>
			</tr>
			<tr>
				<td colspan="2" align="right">
					<cfinclude template="include/common/menu.cfm">
				</td>
			</tr>
		</table>


<!---------------------------------------------------------------------
T I T L E   H E A D E R
---------------------------------------------------------------------->
<center>
<table border="0" cellpadding="3" cellspacing="1" width="97%">
	<tr>
		<cfoutput>
			<td bgcolor="#MCOLOR#" nowrap><center><font face="Arial" size="2" color="white"><b>Function</font></b></td>
			<td bgcolor="#MCOLOR#" width=""><font face="Arial" size="2" color="white"><b>Please complete the following form to join the forum.</b></font></td>
		</cfoutput>
	</tr>


<!---------------------------------------------------------------------
B O D Y
---------------------------------------------------------------------->
	<tr>
		<td valign="top" bgcolor="eeeeee"><center><img src="i/icons/joinfold.gif" border="0"></td>
		<td valign="top" bgcolor="D6D3D6">
		<font face="Arial" size="2">
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr>
					<td bgcolor="D6D3D6"><br>
					<center>
						<table border="0">
							<tr>
								<td>
									<br>
									<cfif isdefined("signup")>

										<!-------- check for required fields ----------->
										<cfset RequiredFields = "">


										<cfif isDefined("Password")>
											<cfif Password neq Verification or len(password) eq "0" or len(Verification) eq "0">
												<cfset RequiredFields = "No">
											</cfif>
										</cfif>

										<cfif isDefined("NickName")>
											<cfset NickName = HTMLEditFormat(Trim(NickName))>
											<cfset FirstName = "">
											<cfset LastName = "">
											<cfif Len(Nickname) eq "0" or Len(EmailAddress) eq "0">
												<cfset RequiredFields = "No">
											</cfif>
											<cfset nickname = Replace(nickname,"<","","ALL")>
											<cfset nickname = Replace(nickname,">","","ALL")>
											<cfset nickname = Replace(nickname,"&nbsp;","","ALL")>
										<cfelse>
											<cfset nickname = firstname & " "  & lastname>
											<cfif Len(FirstName) eq "0" or Len(LastName) eq "0" or Len(EmailAddress) eq "0">
												<cfset RequiredFields = "No">
											</cfif>
										</cfif>


										<!--- make sure the nickname does not contain special characters --->
										<cfset SpecialCheck ="0">
										<cfif SPECIALCHAR eq "No">
											<cfloop index="index" from="1" to="#Len(Nickname)#" step="1">
												<cfoutput>
													<cfset Char = Mid(Nickname, index, 1)>
													<cfset TChar = Asc(Char)>
													<cfif (tchar lt "65" or tchar gt "90") and (tchar lt "97" or tchar gt "122") and (tchar lt "48" or tchar gt "57")>
														<cfset SpecialCheck = SpecialCheck + 1>
													</cfif>
												</cfoutput>
											</cfloop>
										</cfif>


										<!---- check to see if email is banned --->
										<cfset Email = "">
										<cfquery name="qGetEmailaddresses" datasource="#ds#">
											select vchbanstring from banning where chbantype = 'EM'
										</cfquery>
										<cfoutput query="qGetEmailaddresses">
											<cfif right(Trim(EmailAddress), len(Trim(vchbanstring))) eq Trim(vchbanstring)>
												<cfset Email = "Yes">
											</cfif>
										</cfoutput>

										<!--- nickname ban --->
										<cfset NickCheck = "">
										<cfif Len(Nickname) neq "0">
											<cfquery name="qGetUserBanUsers" datasource="#ds#">
												select vchbanstring from banning where chbantype = 'UN' and vchbanstring = '#NickName#'
											</cfquery>
											<cfif qGetUserBanUsers.recordcount neq "0">
												<cfset NickCheck = "Yes">
											</cfif>
										</cfif>

										<!--- is html allowed in posts --->
										<cfif Trim(HTML) eq "No">
											<cfif Len(Signature) gt "0">
												<cfset CONVERTEDTEXT = HTMLEDITFormat(#signature#)>
												<cfset CONVERTEDTEXT = ReplaceNoCase(CONVERTEDTEXT, chr(10), "<BR>", "All")>
											<cfelse>
												<cfset convertedtext ="">
											</cfif>
											<cfinclude template="customhtml.cfm">
										<cfelse>
											<cfset CONVERTEDTEXT = ReplaceNoCase(#signature#, chr(10), "<BR>", "All")>
										</cfif>
										<cfset ConvertedText = ReplaceNoCase(ConvertedText, "<BR>" & chr(13) & "<BR>" & chr(13) & "<BR>" & chr(13), "","All")>

										<!---- check signature -------->
										<cfset SignLen = "">
										<cfif Len(CONVERTEDTEXT) gt "255">
											<cfset SignLen = "yes">
										</cfif>

										<cfif SignLen eq "Yes">
											<font face="Arial" size="2"><b><br><br><br><br>
											The signature you entered, has exceeded the maximum length.
											</b></font>
											<br><br><br><br><br><br><br><br>
										<cfelseif Email eq "Yes">
											<font face="Arial" size="2"><b><br><br><br><br>
											The E-mail address you entered, has been banned from the <cfoutput>#FORUMSNAME#</cfoutput> forum.
											</b></font>
											<br><br><br><br><br><br><br><br>
										<cfelseif SpecialCheck neq "0">
											<font face="Arial" size="2"><b><br><br><br><br>
											Your nickname contains special characters. Nicknames must only contain alphabetical or numeric characters.
											</b></font>
											<br><br><br><br><br><br><br><br>
										<cfelseif NickCheck eq "Yes">
											<font face="Arial" size="2"><b><br><br><br><br>
											The nickname you have chosen has been banned from the <cfoutput>#FORUMSNAME#</cfoutput> forum.
											</b></font>
											<br><br><br><br><br><br><br><br>
										<cfelseif Len(NickName) gt "20">
											<font face="Arial" size="2"><b><br><br><br><br>
											The username you entered has exceeded the maximum length of 20 characters.
											<p>
											Please click the back button in your browser and shorten your username.
											</b></font>
											<br><br><br><br><br><br><br><br>
										<cfelseif RequiredFields eq "No">
											<font face="Arial" size="2"><b><br><br><br><br>
											Not all the required fields have been filled out properly.
											<p>
											Use the back button in your browser to go back to the form.
											</b></font>
											<br><br><br><br><br><br><br><br>
										<cfelse>
											<!--- Check to see what the name format is set at and set variable values ----->

											<cfquery name="checkuser1" datasource="#ds#">
												select * from users where vchnickname = '#NickName#'
											</cfquery>

											<cfset EmailAddress = Trim(HTMLEditFormat(EmailAddress))>

											<cfquery name="checkuser2" datasource="#ds#">
												select * from users where vchemailaddress = <cfif UNIQUEEMAIL eq "Yes">'#EmailAddress#'<cfelse>'null'</cfif>
											</cfquery>

											<cfif checkuser1.recordcount eq "0" and checkuser2.recordcount eq "0">
												<cfif isDefined("password") is "No">
													<cfset Password = "">
													<cfloop index="i" from=1 to=8>
														<cfset Password = Password & chr(RandRange(97,122))>
													</cfloop>
												</cfif>

												<!--- Check to see if user clicked on the checkboxes to make his info available to other users --->
												<!--- Tombstone --->
												<cfif isDefined("Tombstone")>
													<cfset tombstonevalue= "Yes">
												<cfelse>
													<cfset tombstonevalue= "No">
												</cfif>
													<!--- Email ---->
												<cfif isDefined("EmailDisplay")>
													<cfset emailvalue= "Yes">
												<cfelse>
													<cfset emailvalue= "No">
												</cfif>

												<!--- check for authoricon validity ---->
												<cfset TestIco = Find("src=",#authoricon#,"1")>
												<cfset TestIco2 = Find("/",#authoricon#,"1")>
												<cfif TestIco neq "0" or TestIco2 neq "0">
													<cfset authoricon = "default.gif">
												</cfif>

												<cfinclude template="i\themes\#Trim(Lcase(DEFAULTTHEME))#\color.cfm">

												<cfquery name="qGetRanking" datasource="#ds#">
													select * from usertitles
													where imincount = 0
												</cfquery>

												<cfquery name="qgetdiff" datasource="#ds#">
													select chdifference from timezones where itimezoneid = #timezone#
												</cfquery>

												<cfinclude template="include\#Lcase(DBTYPE)#\join_insertquery.cfm">

												<cfquery name="qGetEmailMsg" datasource="#ds#">
													select txemailmessage1 from othersettings
												</cfquery>

												<cfquery name="qGetFooter" datasource="#ds#">
													select * from othersettings
												</cfquery>
<cfmail to="#emailaddress#" from="#NEWMEMBEREMAIL#" server="#SMTPSERVER#" subject="Welcome to the #FORUMSNAME# forum.">
#qGetEmailMsg.txEmailMessage1#

Login information:

Nickname: #nickname#
Password: #password#

#qGetFooter.txmailfooter#
</cfmail>
												<br><br><br><br>
												<font face="Arial" size="2" color="Black"><b>You have been signed up for the forums.
												<cfif GENERATEDPASS eq "Yes">
													Your password will be emailed to you.
												</cfif>
												</b>
												<p>
												To use the forums, click the login button on the top right menu.
												</font>
												<br><br><br><br><br><br><br>
											<cfelse>
												<br><br><br><br>
												<font face="Arial" size="2" color="Black"><b>Sorry, a user already exists with the same
												<cfif #checkuser1.recordcount# gt "0" and #checkuser2.recordcount# eq "0">nickname</cfif>
												<cfif UNIQUEEMAIL eq "Yes">
													<cfif #checkuser2.recordcount# gt "0" and #checkuser1.recordcount# eq "0">emailaddress</cfif>
												</cfif>
												<cfif #checkuser1.recordcount# gt "0" and #checkuser2.recordcount# gt "0">nickname<cfif UNIQUEEMAIL eq "Yes">, emailaddress</cfif></cfif>
													</b>
													<p>
													Use the back button in your browser to go back to the form.
													</font>
													<br><br><br><br><br><br><br>
											</cfif>
										</cfif>
									<cfelse>
										<form action="join.cfm" name="JoinFrm" method="post" <cfif trim(GENERATEDPASS) eq "No">OnSubmit="return verify();"</cfif>>
										<cfif Trim(AGREEMENT) eq "Yes"><font face="Verdana, Arial" size="1">
											<b>By registering to the <cfoutput><font face="Verdana, Arial" color="Navy" size="2">#FORUMSNAME#</font></cfoutput> forum, you hereby agree to the following <a href="javascript:WinOpen('agreement/agreement.cfm','620','460');"><font face="Verdana, Arial" color="navy" size="2">Rules & Regulations</font></a>.</b></font>
										</cfif>
										<p>
										<font face="Arial" size="2" color="Navy"><b>Required fields are marked with <font size="4">*</font></b></font><p>
										<table border="0">
										<Cfif trim(NAMEFORMAT) eq "Full Name">
											<tr>
												<td valign="top"><font face="Arial" size="2"><b>First Name: <font size="4">*</font></b></font> </td><td valign="top"><input type="text" name="firstname" size="45" maxlength="50"><br></td>
											</tr>
											<tr>
												<td valign="top"><font face="Arial" size="2"><b>Last Name: <font size="4">*</font></b></font> </td><td valign="top"><input type="text" name="Lastname" size="45" maxlength="50"><br></td>
											</tr>
										<cfelse>
											<tr>
												<td valign="top"><font face="Arial" size="2"><b>Nickname <font size="1">(max 20 characters)</font> :  <font size="4">*</font></b></font> </td><td valign="top"><input type="text" name="nickname" size="45" maxlength="50"><br></td>
											</tr>
										</cfif>
										<tr>
										<td valign="top"><font face="Arial" size="2"><b>City:</b></font> </td><td valign="top"><input type="text" name="city" size="45" maxlength="150"><br></td>
											</tr>
										<tr>
										<td valign="top"><font face="Arial" size="2"><b>Province/State:</b></font> </td><td valign="top">
											<cfquery name="qGetDefaultCountry" datasource="#ds#">
											select vchcountryname from countries where chdefault = 'Y'
											</cfquery>


											<cfquery name="qGetStateProv" datasource="#ds#">
											select * from stateprovince order by

											<cfif Trim(qGetDefaultCountry.vchcountryname) eq "United States">
												vchcountry desc,vchstateprov
											<cfelse>
												vchcountry asc,vchstateprov
											</cfif>

											</cfquery>
											<select name="stateprov">
												<cfoutput query="qGetStateProv">
												<option value="#istateprovid#" <cfif Trim(chdefault) eq "Y">selected</cfif>>#vchstateprov#
												</cfoutput>
											</select>
										</td>
									</tr>
									<tr>
										<td valign="top"><font face="Arial" size="2"><b>Country: </b></font></td><td valign="top">

										<cfquery name="GetCountry" datasource="#ds#" cachedwithin="#createtimespan(0,1,0,0)#">
										select * from countries order by vchcountryname asc
										</cfquery>

										<select name="country">
										<cfoutput query="GetCountry">
											<option value="#iCountryID#" <cfif trim(chdefault) eq "y">selected</cfif>>#vchCountryName#
										</cfoutput>
										</select><br></td>
											</tr>
											<tr>
												<td valign="top"><font face="Arial" size="2"><b>Time Zone:</b></font> </td>
												<td valign="top">
												<cfquery name="qGetTimeZones" datasource="#ds#" cachedwithin="#createtimespan(0,1,0,0)#">
												select * from timezones order by iorder asc
												</cfquery>
												<select name="timezone">
												<cfoutput query="qGetTimeZones">
												<option value="#itimezoneid#" <cfif itimezoneid eq SYSTIMEZONEID>selected</cfif>>#vchzonedescription#
												</cfoutput>

												</select>
												</td>
											</tr>
											<tr>
										<td valign="top"><font face="Arial" size="2"><b>Website:</td><td valign="top"> <input type="text" name="website" size="45" maxlength="255"><br></td>
											</tr><tr>
										<td valign="top"><font face="Arial" size="2"><b>ICQ #:</td><td valign="top"><input type="text" name="icqnumber" size="16" maxlength="16"><br></td>
											</tr><tr>
										<td valign="top"><font face="Arial" size="2"><b>E-mail Address: <font size="4">*</td><td valign="top"> <input type="text" maxlength="255" name="emailaddress" size="45"><br></td>
											</tr>


										<cfif trim(GENERATEDPASS) eq "No">
										<script language="JavaScript">
										function verify()
											{
												if (document.JoinFrm.password.value != document.JoinFrm.verification.value)
											{
											   	alert('Sorry your passwords do not match, please make sure both passwords match for verification \n');
												return false;
											}
												return true;
											}
										</script>
											<tr>
												<td valign="top"><font face="Arial" size="2"><b>Password: <font size="4">*</td><td valign="top"> <input type="password" maxlength="50" name="password" size="45"><br></td>
											</tr>
											<tr>
												<td valign="top"><font face="Arial" size="2"><b>Verification: <font size="4">*</td><td valign="top"> <input type="password" maxlength="50" name="verification" size="45"><br></td>
											</tr>
										</cfif>
										<tr>
										<td valign="top"><font face="Arial" size="2"><b>Profile Visibility: </td><td valign="top"> <input type="checkbox" name="tombstone" value="available"><br></td>
											</tr>
										<tr>
										<td valign="top"><font face="Arial" size="2"><b>E-Mail Visibility: </td><td valign="top"> <input type="checkbox" name="emaildisplay" value="available"><br></td>
											</tr>
											<tr>
										<td valign="top"><font face="Arial" size="2"><b>Signature:<br><font size="1">(max 255 characters) </td><td valign="top"><textarea name="signature" rows="5" cols="38" maxlength="255" wrap="virtual"></textarea><br>
											<br>
											<font face="Arial" size="1">
											<cfif Trim(HTML) eq "No">
												HTML code is not permitted. Special <a href="javascript:WinOpen('symbols.cfm','500','420');"><font face="Verdana, Arial"><b>symbols</b></font></a> permit some HTML functionality.
											<cfelse>
												HTML code is permitted. Special <a href="javascript:WinOpen('symbols.cfm','500','420');"><font face="Verdana, Arial"><b>symbols</b></font></a> permit some HTML functionality.
											</cfif>
										</td>
										</tr>
											<cfif Trim(ICONS) eq "Yes">
												<cfquery name="qGetAuthorIcons" datasource="#ds#">
													select * from authoricons where chstatus = 'Enabled' order by vchiconname asc
												</cfquery>
												<cfset Piccount = 0>
													<tr>
															<td colspan="2">
																<br><font face="Arial" size="2"><b>Select the author icon you wish to use: </b>
																<select name="authoricon">
																	<cfoutput query="qGetAuthorIcons">
																		<option value="#vchiconfilename#" <cfif trim(chdefault) eq "y">selected</cfif>>#vchiconname#
																	</cfoutput>
																</select>
																<cfoutput>
																<input type="button" title="Click to preview the author icon you selected" value="View" class="ftsubbut" style="background: ###MCOLOR#" name="View" onclick="AuthorIcon1('viewicon.cfm?icon=',document.JoinFrm.authoricon[document.JoinFrm.authoricon.selectedIndex].value,'40','40');">
																<input type="button" title="Click to preview all author icons" value="View All" class="ftsubbut" style="background: ###MCOLOR#" name="ViewAll" onclick="AuthorIcon2('viewicon.cfm?all=y&formname=JoinFrm','620','500');">
																</cfoutput>
																</font></b>

																	<br>
																</td>
															</tr>
										<cfelse>
											<input type="hidden" name="authoricon" value="default.gif">
										</cfif>
										<tr>
											<td colspan="2" align="right"><br><br><cfoutput><input type="submit" value="Submit!" class="ftsubbut" style="background: ###MCOLOR#"></cfoutput></td>
										</tr>
									</table>
									<br>
									<br>
									<input type="hidden" name="signup">
									</form>
								</cfif>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			</center>
		</td>
	</tr>


<!---------------------------------------------------------------------
F O O T E R
---------------------------------------------------------------------->
	<cfoutput>
	<tr>
		<td bgcolor="#MCOLOR#"><br></td><td bgcolor="#MCOLOR#" width="" align="right">
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr>
					<td align="left"><font face="Arial" size="2" color="white">
						You are in 'join' mode</td><td align="right">
					</td>
				</tr>
			</table>
			</cfoutput>
		</td>
	</tr>
</table>
</center>

<!--- include the bottom template --->
<cfinclude template="custom/bottom.cfm">

<!--- include the copywrite information --->
<cfinclude template="copywrite.cfm">

</body>
</html>


[Index of Archives]     [Linux Security]     [Netfilter]     [PHP]     [Yosemite News]     [Linux Kernel]

  Powered by Linux