Don't underestimate what that little wrench will do, or how much torque you need to hold the bed rails together. With the lock washer, it only needs to be compressed, plus maybe another half turn at the most. The force created by the threads drawing through the nut create an incredible amount of pressure on the joining faces.
The included wrench has 2 distinct ends, one has the legs of the wrench equal lengths more or less, the other end has a shorter leg on one side. Because of the shape of the wrenches, I will assume there is little or no space to get a box end wrench around it, if there is any room behind it, then a box end wrench can be ground down enough to fit around it. A rail bolt wrench may work too, they are made to fit into even a deeper, hole. They are used for handrail assembly.
Back to the offered wrench, the one end with the short leg, in my opinion is the workhorse, the short side is always on the leading side of the turn, as in if you are turning to the right, or clockwise, the short side is on the right side. That side is shorter so it does not bottom out as quickly in the shallow hole the captured nut is in. The wrench with the equal lengths are for the nut when it is in the midway point, where the nut is being turned where the legs of the wrench will still clear the bottom of the hole. As soon as one side of the wrench touches the bottom of the drilled hole, turn it around, and use the end with the short leg to complete the turn, so to speak, then swap ends again, turn that a little, then change ends of the wrench, and repeat.
You may have tried these techniques already, but it wasn't stated in your question to what extent you tried to work with the wrench. The picture of the wrench only shows a little distortion on the short leg of the one end that would occur if the wrench is turned the wrong way. Even though there a slight distortion, having the proper orientation of the wrench to the nut, that won't matter.
Remove the bolts and inspect the threads of both the bolt and the tapped (threaded) hole in the frame.
You have three possibilities here:
Either A) the frame threads are damaged, B) the bolt threads are damaged, or C) both threads are damaged.
If A) or C), you're unfortunately out of luck without drilling and tapping a new hole as Tyler has said (this won't work if the frame is plastic with threaded inserts). This is the most likely because your bolts are probably steel and your frame is probably aluminum, or plastic with inserts.
If B), take the bolts to a hardware store (Ace Hardware usually has a great selection of individual bolts and are usually more helpful, but a place like Home Depot or Lowe's will also work) and find new ones that match. Then take care not to over-tighten them!
General rule: if there isn't a torque specification on a bolt, run it down "snug" (until you start to feel resistance, then give it another quarter to half turn). "Snug" is subjective but it should get you pretty close. And it'll help when assembling cheaply-made parts.
Best Answer
A few alternative approaches that don't require guessing:
If the nut fastens to a removable bolt rather than a bracket with a permanent threaded rod, don't bother trying to match the nut. Replace both the bolt and nut with something about the same size that fits the existing holes.
If there is a removable bolt, but it also threads through other hardware, temporarily remove the bolt and nut and measure the size using the bolt.
If there is not a removable bolt, temporarily remove the nut and measure the size and thread of the exposed portion of the "bolt". Put the nut back on until you buy the replacement. If you have a thread gauge (or there are cheap ones you can buy), that will make it easier to get an accurate measurement on either the bolt or nut.
If you don't have a thread gauge and measurement is difficult, temporarily remove the nut. Lubricate the nut and threads, then make a quick "casting" of the thread with hot melt glue or other material, including enough material to grab to unscrew the casting. Unscrew the casting and put the nut back on the door. Then take the casting to the hardware store to find a matching nut.