Yes, you can substitute aluminum foil for cupcake liners. But you have to keep some things in your mind like, First, whether the foil is well greased. Second, you have to be careful while moving the cupcakes from the aluminum foil. Also, you might need to use a muffin tin to prevent the cupcakes from spreading excessively.