AFAIK Sieve (the scripting language Cyrus loves) does not support attachment extraction. What you can do though is that you create a Sieve script which identified the e-mails having attachments (from sender, message size, whatever criteria you'd like to use), and automatically file those messages to some specific IMAP folder, say TemporaryAttachmentsFolder.
Then you can put in cron a shell script, which periodically polls that TemporaryAttachmentsFolder directory, and extracts the attachments with a tool like ripmime and saves them elsewhere. Or, if you are truly l337, you can replace the traditional cron with incron and make the extraction happen in real-time.