Some pseudo-code....

Code:
 For each line
   Define an infinit line between cube-vertex A and B
   Calculate line/plane intersection for infinit line AB
   Check if the resulting point lies between A and B (is part of the segment/edge AB)
     Keep result and continue with next line
   else
     Delete result and continue with next line
Now you should have 4 points that would make up the polygon that intersects the cube.

Hope this helps.