The imageboards were translated from Futaba's script:
http://www.2chan.net/script/ (which is public domain or something of the sorts) and then heavily modified by the 4chan staff. Closest you can get, code-wise, is Futallaby.
http://www.1chan.net/futallaby/
If you're looking for an imageboard that isn't shit and is easily modifiable to suit your needs, try Wakaba.
http://wakaba.c3.cx/s/web/wakaba_kareha.html
If you want to create your own 4chan clone in 5 simple clicks, with cancerous-inducing features like stickies and Something Awful-imported baggage, try Kusaba (formerly known as Trevorchan).
http://code.google.com/p/kusaba/ (actual website is kusaba.org, but Trevor is a retard and let the domain expire)
If you want to be able to post multiple images per post, there's Thorn:
http://sovietrussia.org/code/src/thorn-11b9.tar.bz2 . AnonIB is based on this.
If you want FORCED INDENTATION OF CODE to run on Google's App Engine, with Trevor's stamp of quality (in all honesty, he got better), use pyib.
http://code.google.com/p/pyib/
sovietrussia.org uses a script called Matsuba. I think I saw a download link somewhere, but I can't find it anymore.
If you're looking for text board software:
dis.4chan.org is based on Shiichan. Shii recognizes it's crap and doesn't recommend using it.
http://wakaba.c3.cx/shii/
Kareha is a nice script for text boards, but it can be a bit CPU intensive.
http://wakaba.c3.cx/s/web/wakaba_kareha.html
Kusaba can also do text boards.
Wishlist: MrVacBob-sama, please let us use <a href> or something that works like it ([url] tags, for example).