The legs are attached to the treads of the stairs with 2 to 5 screws per bracket, ensuring no damage to the bannister or walls surrounding the staircase.