shadow1ng/fscan · error

webscan_listmap_key_invalid

webscan_listmap_key_invalid

Error message

webscan_listmap_key_invalid

What it means

Guard in ListMap.UnmarshalYAML: a key in the ordered YAML mapping failed the string assertion. ListMap requires string keys paired with string-list values, so a non-string key aborts decoding of the POC structure.

Source

Thrown at webscan/lib/Client.go:363

// UnmarshalYAML 实现ListMap的YAML解析接口
// 参数:
//   - unmarshal: YAML解析函数
//
// 返回:
//   - error: 解析错误
func (r *ListMap) UnmarshalYAML(unmarshal func(interface{}) error) error {
	// 解析YAML映射
	var tmp yaml.MapSlice
	if err := unmarshal(&tmp); err != nil {
		return err
	}

	// 转换为ListMap结构
	for _, one := range tmp {
		key, keyOk := one.Key.(string)
		if !keyOk {
			return fmt.Errorf("%s", i18n.GetText("webscan_listmap_key_invalid"))
		}

		valueSlice, valueOk := one.Value.([]interface{})
		if !valueOk {
			return fmt.Errorf("%s", i18n.GetText("webscan_listmap_value_invalid"))
		}

		var value []string
		// 将接口类型转换为字符串
		for _, val := range valueSlice {
			v := fmt.Sprintf("%v", val)
			value = append(value, v)
		}
		*r = append(*r, ListItem{key, value})
	}
	return nil
}

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Make all list-map keys scalar strings
  2. Quote keys that look like numbers or booleans
  3. Correct the offending POC YAML file
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at webscan/lib/Client.go:363 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06). Data as JSON: /api/errors/36b9c6cb27d56747. Report an issue: GitHub.