Step flashing should only be fastened to the roof deck. Do not fasten step flashing to the wall on the vertical leg. Doing so would prevent you from removing it without removing the siding. While a single-piece counterflashing (shown in bubble lower right) will work, the more elaborate two-piece counterflashing shown allows for inspection and replacement of the underlayment, including any adhesive flashing membrane, which is also recommended to protect the wall to roof intersection. Even with a two-piece underlayment, there is no need to fasten the step flashing to the wall.