The only time you can be so certain that you have picked 2 brown socks is when there are no more white socks and black socks. This means that to be 100% sure that you have picked 2 brown socks, you must pick all 12 white socks and all 18 black socks and only then you can pick 2 brown socks without looking. Therefore the total number of socks that should be picked is:
Total number of socks = 12 white socks + 18 black socks + 2 brown socks
Total number of socks = 32 socks
A total picking of 32 socks is required to be certain without looking that 2 brown have already been chosen.