I managed to figure it out. Data added to the properties attribute are considered to be custom properties, so one just has to target the key of that custom property.
query RunInput {
cart {
lines {
id
quantity
custom_data: attribute(key: "_custom_data") {
value
}
}
}