Legal yes. But unless you set things up with a lender in advance, it's unlikely you will have enough time at this point.
Buying foreclosures at a sherriffs sale or on the court house steps is incredibly risky and unless you are very experienced I would not reccomend this to anyone. Have you done title search before bidding, do you know if there are any other liens on the property (tax, IRS, etc)
Rarely are foreclosurs the deal buyers assume them to be and before you start buying any more and possibly spending a lot of money I would encourage you to read the blog I've written about Foreclosures which I've included below.