Modified to provide additional firepower for defence.
Description from Peter Bowers's Boeing Aircraft since 1916
Because of its defensive nature, the XB-40 was a true flying fortress. Fourteen power-driven machine guns were mounted, with an extra turret in the radio compartment position and twin-gun installations at the waist stations instead of singles, plus a two-gun chin turret and the regular top, belly, and tail turrets. The normal ammunition load was ll,135 rounds, which could be increased to l7,265 rounds if the fuel load was reduced.
Only 20 were modified to be YB-40s. Another source indicated that only 15 were modified.
One problem that limited the use of the YB-40 was the fact that the YB-40 was significantly heaver that a empty B-17. The YB-40 could not keep up with the B-17 on the run to home.
Aeroplane Photo Supply No. 4099
Another story from Bowers's book
One YB-40 was used in a very unusual way. The Germans had a number of flyable B-l7s available. While most were used to train fighter pilots in anti-B-17 tactics, some were used for sneak penetrations of Allied territory. At least one made a practice of following homeward-bound B-17 formations, pretending to be a crippled straggler and drawing a B-17 out of the formation to cover it from fighter attack. Once the protective B-17 had pulled in close, the decoy either blasted it with its own guns or called German fighters in by radio to do the job. After being caught by this trick several times, Yankee ingenuity set a countertrap. The next time the decoy appeared it was not a standard B-17 but a YB-40 that left the formation. Once the decoy had been positively identified as ‘not one of ours’, a broadside from the YB-40 brought that particular German stratagem to an end.