Regex to match executing a stored procedure within a stored procedure

Unless you’re working with a custom string format, which requires you writing a regular expression, I suppose (suggest?) you’ll look it up online, right? If you need a Regex to match an IP, MAC or an E-mail, would you spend time writing it? Chances are that you might leave room for false positives and/or false negatives, unless you really test it. That’s why it’s common to look it up online. I needed to take a list of proc names and parse thousands of create procedure scripts, looking up if anything from the input list was used (executed) from those procs. A procedure executing another procedure. ...

February 16, 2013 · 2 min · Bruno Garcia

Pitfalls on WIF+SAML2 and Selenium

WIF and SAML 2.0 First some background: There is a known issue on WIF (Windows Identity Foundation) for SAML 2.0 that generates cookies with a name being a GUID and the value, base64 encoded data that grows every SAMLRequest the module handles. The decoded value looks like: 0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15 It starts with small ones but get really, really large. Every client gets one of these cookies and each time they are bigger, to the point that when they are sent back to the server, an HTTP error is thrown: HTTP 400 - Bad Request (Request Header too long) ...

December 12, 2012 · 5 min · Bruno Garcia

Top level domains and punycode with C#

Punycode is used to encode Unicode characters into ASCII for IDN (Internationalized domain name). On the RFC 3492 you’ll find: “Punycode is a simple and efficient transfer encoding syntax designed for use with Internationalized Domain Names in Applications (IDNA). It uniquely and reversibly transforms a Unicode string into an ASCII string.” Now if you are looking for validating TLD (Top level domains), you must have that information in mind. The ICANN list of TLD also contains the IDN ccTLD that started to be included in 2010. ...

November 10, 2012 · 2 min · Bruno Garcia

Simple TCP Forwarder in C#

When people ask: What would I use a TCP Forwarding tool for? Normally the answer goes like “to eavesdrop someone’s connection”. Most of our connections go over SSL (at least the most important ones) and the certificate would be invalidated in case a MITM would be on going. There are some troubleshooting situations when one would use a TCP forwarding tool as a proxy from one box to another but on what basis this technique/tool is used can vary a lot. ...

October 9, 2012 · 6 min · Bruno Garcia

ICMP for stealth transport of data

ICMP (Internet Control Message Protocol) has been used for data transfer since always. Known as ICMP Tunnel, there are several projects and articles about this, mainly open source, like ICMP-Chat for unix-like that is about 10 years old now. Also an interesting article, explaining how to tunnel TCP over ICMP with a simple command line tool for unix-like environment, also ported to Windows. In case you are not familiar with the idea, a description from Wikipedia follows: ...

March 11, 2012 · 7 min · Bruno Garcia

HttpModules. Now even easier to be misused.

Attacks like DDoS or simple web defaces are just vandalism and for sure quite annoying. However, what is considered to be a serious threat is when skilled attackers target one application (or one company), looking for specific information. They dig until they find a security hole, escalate privileges and once they have access to one server, they begin to obtain access to other computer systems within that network. What does it have to do with HttpModules? ...

February 22, 2012 · 6 min · Bruno Garcia