Any person of whom an undertaking is required may agree with his surety for the deposit of any assets for which his surety may be held responsible with a bank, or safe deposit or trust company, authorized to do business in the state, if such deposit is otherwise proper and in such manner as to prevent withdrawal without the written consent of the surety or an order of court, made on notice to the surety. The agreement shall not affect the liability of the principal or surety as established by the terms of the undertaking.
N.Y. CPLR 2509