Melt butter in a medium-sized saucepan over low heat. Whisk in cocoa powder, then pour in buttermilk. Increase heat to medium high and bring to a simmer, whisking constantly.
Once the mixture is simmering, remove from the heat and whisk in powdered sugar and vanilla until smooth. Pour over cake or brownies to cover. Use a rubber spatula to smooth out and spread if needed. Cake or brownies can still be warm.