Any wall mount bracket shaped like a J or L would work. You can just use 49cent metal hose clamps to mount the bracket to the railing. Hose clamps are quite strong and don't loosen.
I wouldn't do this at all though. The speaker will resonate through the railing as well as vibrate. If the speaker isn't mounted to the shelf with screws, odds are it will fall off.
If it is mounted securely, it will vibrate like mad...
I would either hang it from the ceiling, use a speaker stand or put it somewhere else that is more "stable".