<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Matasano Chargen - Latest Comments in Applicable Lessons from the Embedded World (aka Forth rules)</title><link>http://matasanochargen.disqus.com/</link><description></description><language>en</language><lastBuildDate>Sun, 24 May 2009 07:17:58 -0000</lastBuildDate><item><title>Re: Applicable Lessons from the Embedded World (aka Forth rules)</title><link>http://www.matasano.com/log/1349/applicable-lessons-from-the-embedded-world-aka-forth-rules/#comment-9852409</link><description>Great read, I have enjoyed reading it.&lt;br&gt;&lt;br&gt;Rina</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">AventIsis</dc:creator><pubDate>Sun, 24 May 2009 07:17:58 -0000</pubDate></item><item><title>Re: Applicable Lessons from the Embedded World (aka Forth rules)</title><link>http://www.matasano.com/log/1349/applicable-lessons-from-the-embedded-world-aka-forth-rules/#comment-7288846</link><description>Hi Jim&lt;br&gt;      long time no see no hear&lt;br&gt;ah yes , forth, fig forth etc ad nauseam is ported to more platforms on the planet than just about anything else.&lt;br&gt;Also highly useful in writing portable worms/viruses/malware&lt;br&gt;&lt;br&gt;&lt;br&gt;    gwen hastings</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">gwen hastings</dc:creator><pubDate>Tue, 17 Mar 2009 12:31:14 -0000</pubDate></item><item><title>Re: Applicable Lessons from the Embedded World (aka Forth rules)</title><link>http://www.matasano.com/log/1349/applicable-lessons-from-the-embedded-world-aka-forth-rules/#comment-5123536</link><description>Keep in mind that much of the 64K budget went to a full out cryptography implementation, with primitives for ciphers and random numbers.  Some of that also went to network I/O and the like.  If we measured the actual VM implementation itself, it would be pretty close to 20K.  I believe we ended up at 32K.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">wbrown</dc:creator><pubDate>Wed, 14 Jan 2009 19:36:38 -0000</pubDate></item><item><title>Re: Applicable Lessons from the Embedded World (aka Forth rules)</title><link>http://www.matasano.com/log/1349/applicable-lessons-from-the-embedded-world-aka-forth-rules/#comment-5123160</link><description>"However, the virtual machine was 64K in size, which was sufficient for a second stage payload, but not for first stage shellcode."  Just wanted to add a datapoint from an interview this week with an adware author: &lt;a href="http://philosecurity.org/2009/01/12/interview-with-an-adware-author" rel="nofollow"&gt;http://philosecurity.org/2009/01/12/interview-w...&lt;/a&gt; : &amp;lt;quote&amp;gt;I said, “Let’s install a Turing-complete language,” and for that I used tinyScheme, which is a BSD licensed, very small, very fast implementation of Scheme that can be compiled down into about a 20K executable if you know what you’re doing.&amp;lt;/quote&amp;gt;.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">newsham</dc:creator><pubDate>Wed, 14 Jan 2009 19:13:36 -0000</pubDate></item><item><title>Re: Applicable Lessons from the Embedded World (aka Forth rules)</title><link>http://www.matasano.com/log/1349/applicable-lessons-from-the-embedded-world-aka-forth-rules/#comment-5100236</link><description>In my hometown, we had a saying about FORTH: &lt;br&gt;&lt;br&gt;eww.&lt;br&gt;&lt;br&gt;:)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">davegmtso</dc:creator><pubDate>Tue, 13 Jan 2009 17:37:09 -0000</pubDate></item><item><title>Re: Applicable Lessons from the Embedded World (aka Forth rules)</title><link>http://www.matasano.com/log/1349/applicable-lessons-from-the-embedded-world-aka-forth-rules/#comment-5051385</link><description>A Taste of FORTH&lt;br&gt;&lt;br&gt;Wes brings up a good point.  Properly engineered, a minimal FORTH would be very useful for penetration and embedded hacking.  Before discussing FORTH in the abstract, we should take a look at some basic FORTH.   In the example FORTH session below:&lt;br&gt;&lt;br&gt;1. The colon character begins a word definition and the semicolon character ends the definition.&lt;br&gt;2. To execute a word all you need to do is type in the word and press ENTER.&lt;br&gt;3. Pressing ENTER doesn't automatically echo CR&lt;br&gt;4. Any numbers entered are pushed onto the stack.&lt;br&gt;5. Most words pull their arguments from the stack.&lt;br&gt;6. I'll put comments in parentheses, which are also FORTH's words for starting/ending comments&lt;br&gt;&lt;br&gt;Example Session&lt;br&gt;&lt;br&gt;( this is a comment.  comment text follows an open paren and space -- a comment word )&lt;br&gt;&lt;br&gt;( echo an asterisk to the terminal )&lt;br&gt;&lt;br&gt;42 EMIT &amp;lt;enter&amp;gt;  * OK&lt;br&gt;&lt;br&gt;( define a word )&lt;br&gt;&lt;br&gt;: STAR 42 EMIT ; &amp;lt;enter&amp;gt; OK&lt;br&gt;&lt;br&gt;STAR &amp;lt;enter&amp;gt; * OK&lt;br&gt;&lt;br&gt;: STARS 0 DO STAR LOOP ; &amp;lt;enter&amp;gt; OK&lt;br&gt;&lt;br&gt;CR &amp;lt;enter&amp;gt;&lt;br&gt;OK&lt;br&gt;&lt;br&gt;CR 20 STARS &amp;lt;enter&amp;gt;&lt;br&gt;******************** OK&lt;br&gt;&lt;br&gt;This is the most powerful programming syntax in the world.  It is also a knife with which you can cut yourself endlessly.  It requires you to define an application-specific vocabulary with which to describe a solution to your programming problem.  Your vocabulary will naturally pull its arguments off the stack and each word modifies the state of the program in sequence.  &lt;br&gt;&lt;br&gt;But you have total control of the interpreter/compiler.  If you wish, your new word can read the next word out of the input stream at compile or interpret time which allows you to define your own syntax and programming model.  You can even detect whether your word is being run during compile or interpret time and alter it's behavior.&lt;br&gt;&lt;br&gt;This is a fantastically powerful and immediate extensible language.  You could directly write a simple LISP or C interpreter in FORTH by simply defining a compiler vocabulary.&lt;br&gt;&lt;br&gt;Notes:&lt;br&gt;&lt;br&gt;While writing this small introduction I noticed that the two best books on FORTH programming and philosophy are now free on the web.  They're written by Leo Brodie.  Here they are:&lt;br&gt;&lt;br&gt;Starting FORTH:  &lt;a href="http://home.iae.nl/users/mhx/sf.html" rel="nofollow"&gt;http://home.iae.nl/users/mhx/sf.html&lt;/a&gt;&lt;br&gt;Thinking FORTH: &lt;a href="http://thinking-forth.sourceforge.net/" rel="nofollow"&gt;http://thinking-forth.sourceforge.net/&lt;/a&gt;&lt;br&gt;&lt;br&gt;(I'm a senior software engineer and I believe these books to be some of the most significant works on programming.  I'd rank them up there with Knuth's 'Art of Computer Programming', the Dragon compiler book, Wirth's 'Algorithms + Data Structures = Programs' and the Gamma et al "Design Patterns" book.)&lt;br&gt;&lt;br&gt;Even if your interest in FORTH is only fleeting, you should really study both of these books.  Most programmer's don't get to use their favorite language on a daily basis, but like Tai Chi FORTH may not become your primary tool, but it could become your primary discipline as it focuses your mind and makes you a better practitioner in whichever language you use.&lt;br&gt;&lt;br&gt;Good luck &lt;br&gt;&lt;br&gt;Jim Burnes</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jim Burnes</dc:creator><pubDate>Sat, 10 Jan 2009 22:25:19 -0000</pubDate></item><item><title>Re: Applicable Lessons from the Embedded World (aka Forth rules)</title><link>http://www.matasano.com/log/1349/applicable-lessons-from-the-embedded-world-aka-forth-rules/#comment-5032521</link><description>Ooops -- answer below.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">wbrown</dc:creator><pubDate>Fri, 09 Jan 2009 23:09:37 -0000</pubDate></item><item><title>Re: Applicable Lessons from the Embedded World (aka Forth rules)</title><link>http://www.matasano.com/log/1349/applicable-lessons-from-the-embedded-world-aka-forth-rules/#comment-5032512</link><description>Good question, and that's actually kind of hard to answer.  All the Forths out there are pretty small already.  The answer to the question depends in part on what you're asking.  Full featured Forths?  Machine Forth for the ARM is 1478 cells of 32 bits.  Jone's Forth, when you compile it and strip of symbols, is 8K including ELF headers.  I've seen reference to 4K Forth systems.  A gentleman said that he implemented Charlie Moore's Machine Forth in 5.5K, and that enough Forth to implement and build itself in.&lt;br&gt;&lt;br&gt;So, this is kind of a trick question, as you can probably see.  We can get away with implementing our Forth on a host machine, and compiling down a very small Forth with just the words that we need for the purpose.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">wbrown</dc:creator><pubDate>Fri, 09 Jan 2009 23:08:34 -0000</pubDate></item><item><title>Re: Applicable Lessons from the Embedded World (aka Forth rules)</title><link>http://www.matasano.com/log/1349/applicable-lessons-from-the-embedded-world-aka-forth-rules/#comment-5026877</link><description>Interesting project. Sounds very similar to the metepreter with a bent towards making the payload smaller once you've injected your interpreter.  Also I'm surprised you didn't mention forth's role in open firmware as I think that's probably the most common place it's seen. That certainly was the first place I saw it. :-)&lt;br&gt;&lt;br&gt;Just out of curiosity any idea what the size in bytes is of the smallest forth implementation for the x86 family of processors?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Pete Markowsky</dc:creator><pubDate>Fri, 09 Jan 2009 21:06:30 -0000</pubDate></item></channel></rss>