<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Haiders WebSpace &#187; Forms</title>
	<atom:link href="http://blog.creativeitp.com/tag/forms/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.creativeitp.com</link>
	<description>Let&#039;s talk about IT</description>
	<lastBuildDate>Sat, 27 Feb 2010 13:15:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>JavaScript Injection (Form Editing)</title>
		<link>http://blog.creativeitp.com/posts-and-articles/javascript/javascript-injection-form-editing/</link>
		<comments>http://blog.creativeitp.com/posts-and-articles/javascript/javascript-injection-form-editing/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 20:40:52 +0000</pubDate>
		<dc:creator>Haider al-Khateeb</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Attack]]></category>
		<category><![CDATA[Forms]]></category>

		<guid isPermaLink="false">http://blog.creativeitp.com/?p=148</guid>
		<description><![CDATA[JavaScript codes can be injected in the address bars of web browsers to edit online forms before submitting them, bellow I am posting an example for archiving purposes. Assuming the page has a contact form, where submitted data is sent to an email address included in a hidden HTML input tag as in the following [...]]]></description>
			<content:encoded><![CDATA[<p>JavaScript codes can be injected in the address bars of web browsers to edit online forms before submitting them, bellow I am posting an example for archiving purposes.</p>
<p>Assuming the page has a contact form, where submitted data is sent to an email address included in a hidden HTML input tag as in the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">…
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;ContactForm&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit.php&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Email&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;admin@website.com&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
…</pre></div></div>

<p>To change the email address to: <b>myemail@hotmail.com</b>, the following code can be injected:</p>
<p><span id="more-148"></span></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">javascript<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">ContactForm</span>.<span style="color: #660066;">Email</span>.<span style="color: #660066;">value</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;myemail@hotmail.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Where <b>ContactForm</b> is the name of the form and <b>Email</b> is the name of the input tag.</p>
<p>To check that the value has actually been changed, view it with:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">javascript<span style="color: #339933;">:</span><span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">ContactForm</span>.<span style="color: #000066;">Name</span>.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>If the form has no name, check the form order in the page, if it is the first, you may refer to it using: <b>forms[0]</b>. Same thing applies to the input tag, you may refer to it using: <b>elements[0]</b>.</p>
<p>This way, assuming the form is the first, and the order of the input tag in that form is 4, our codes will be:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">javascript<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">forms</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">elements</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">value</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;myemail@hotmail.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>and</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">javascript<span style="color: #339933;">:</span><span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">forms</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">elements</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.creativeitp.com/posts-and-articles/javascript/javascript-injection-form-editing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Basic Form Validation</title>
		<link>http://blog.creativeitp.com/posts-and-articles/javascript/basic-form-validation/</link>
		<comments>http://blog.creativeitp.com/posts-and-articles/javascript/basic-form-validation/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 05:57:02 +0000</pubDate>
		<dc:creator>Haider al-Khateeb</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Forms]]></category>

		<guid isPermaLink="false">http://blog.creativeitp.com/?p=22</guid>
		<description><![CDATA[Who doesnt need to implement a data validation technique along with every online form? Bellow is a basic javascript code to check that no form is submitted with empty fields: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 [...]]]></description>
			<content:encoded><![CDATA[</p>
<p>Who doesnt need to implement a data validation technique along with every online form?</p>
<p>
Bellow is a basic javascript code to check that no form is submitted with empty fields:</p>
<p><span id="more-22"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script Language<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;JavaScript&quot;</span><span style="color: #339933;">&gt;&lt;!--</span>
<span style="color: #003366; font-weight: bold;">function</span> Validator<span style="color: #009900;">&#40;</span>Form<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>Form.<span style="color: #660066;">UserName</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Please enter a value for the <span style="color: #000099; font-weight: bold;">\&quot;</span>User Name<span style="color: #000099; font-weight: bold;">\&quot;</span> field.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    Form.<span style="color: #660066;">UserName</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>Form.<span style="color: #660066;">Password</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Please enter a value for the <span style="color: #000099; font-weight: bold;">\&quot;</span>Password<span style="color: #000099; font-weight: bold;">\&quot;</span> field.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    Form.<span style="color: #660066;">Password</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>Form.<span style="color: #660066;">FullName</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Please enter a value for the <span style="color: #000099; font-weight: bold;">\&quot;</span>Full Name<span style="color: #000099; font-weight: bold;">\&quot;</span> field.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    Form.<span style="color: #660066;">FullName</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #006600; font-style: italic;">//--&gt;&lt;/script&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>center<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>form <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Signup&quot;</span> action <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;submit_form.php&quot;</span> method <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;post&quot;</span> 
onsubmit<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;return Validator(this)&quot;</span> <span style="color: #339933;">&gt;</span>
Username<span style="color: #339933;">:</span> <span style="color: #339933;">&lt;</span>input type <span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text&quot;</span>  <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;UserName&quot;</span> size<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;20&quot;</span><span style="color: #339933;">&gt;</span> <span style="color: #339933;">&lt;</span>b<span style="color: #339933;">&gt;-&lt;/</span>b<span style="color: #339933;">&gt;</span> 
Password<span style="color: #339933;">:</span> <span style="color: #339933;">&lt;</span>input type <span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text&quot;</span>  <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Password&quot;</span> size<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;20&quot;</span><span style="color: #339933;">&gt;</span> <span style="color: #339933;">&lt;</span>b<span style="color: #339933;">&gt;-&lt;/</span>b<span style="color: #339933;">&gt;</span> 
Fullname<span style="color: #339933;">:</span> <span style="color: #339933;">&lt;</span>input type <span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text&quot;</span>  <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;FullName&quot;</span> size<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;20&quot;</span><span style="color: #339933;">&gt;</span> <span style="color: #339933;">&lt;</span>b<span style="color: #339933;">&gt;-&lt;/</span>b<span style="color: #339933;">&gt;</span> 
<span style="color: #339933;">&lt;</span>input <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Submit&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;submit&quot;</span> value<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Submit&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>form<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>center<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p"></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.creativeitp.com/posts-and-articles/javascript/basic-form-validation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
